         
         snprintf(message, sizeof(message), "level:%d", (int)cm);
         smartthing.send(message);
+
+        lastDistance = 0;
 #endif        
-      }        
+      }
     }
     
     lastCheck = time;


Queue<40> measurements;
float lastDistance = 0;

int lastLedState = 0;
unsigned long lastCheck = 0;

      }

      Serial.print(diff);

#if DEBUG_RAW_HISTORY      
      Serial.print("  :: Last 10 :: ");
      
      for (int i = max(0, measurements.size() - 10); i < measurements.size(); ++i) 
