Commit b1023818 authored by Eric Duminil's avatar Eric Duminil
Browse files

Notes

parent e3af69a3
...@@ -76,7 +76,6 @@ void setup() { ...@@ -76,7 +76,6 @@ void setup() {
Serial.println(BOARD); Serial.println(BOARD);
#ifdef AMPEL_WIFI #ifdef AMPEL_WIFI
// Try to connect to Wi-Fi
WiFiConnect(SENSOR_ID); WiFiConnect(SENSOR_ID);
Serial.print(F("WiFi STATUS: ")); Serial.print(F("WiFi STATUS: "));
...@@ -126,7 +125,7 @@ void loop() { ...@@ -126,7 +125,7 @@ void loop() {
} }
#endif #endif
//NOTE: Loop should never take more than 1000ms. Split in smaller methods and logic if needed. //NOTE: Loop should never take more than 1000ms. Split in smaller methods and logic if needed.
//TODO: Restart every day or week, in order to not let t0 overflow? //NOTE: Only use millis() for duration comparison, not timestamps comparison. Otherwise, problems happen when millis roll over.
uint32_t t0 = millis(); uint32_t t0 = millis();
keepServicesAlive(); keepServicesAlive();
......
...@@ -36,6 +36,7 @@ namespace util { ...@@ -36,6 +36,7 @@ namespace util {
} }
} }
//NOTE: Only use seconds() for duration comparison, not timestamps comparison. Otherwise, problems happen when millis roll over.
#define seconds() (millis() / 1000UL) #define seconds() (millis() / 1000UL)
extern uint32_t max_loop_duration; extern uint32_t max_loop_duration;
const extern String SENSOR_ID; const extern String SENSOR_ID;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment