diff --git a/firmware/config.h b/firmware/config.h index 4199023..2b3ac1b 100644 --- a/firmware/config.h +++ b/firmware/config.h @@ -10,7 +10,7 @@ #define DELAY_LOOP_MS 50 #define POWERSAVING_SLEEP_S 600 #define EMERGENCY_SLEEP_S 172800 // Sleep for 2 days to recover -#define RESET_ESP_TIME_INTERVAL_MS 1200000 // (60*60*6*1000) // reset every 6 hours +#define RESET_ESP_TIME_INTERVAL_MS (60*60*6*1000) // (60*60*6*1000) // reset every 6 hours #define WIND_SENSOR_MEAS_TIME_S 15 #define INITIAL_WEBSERVER_TIME 20 diff --git a/firmware/firmware.ino b/firmware/firmware.ino index 1e626e5..22eeaba 100644 --- a/firmware/firmware.ino +++ b/firmware/firmware.ino @@ -186,7 +186,7 @@ void loop() // call sub loop function _loop(); - //Needed to give WIFI time to function properly + // Needed to give WIFI time to function properly delay(DELAY_LOOP_MS); update_sensor_cnt++; @@ -200,7 +200,8 @@ void loop() #endif } -void _loop() { +void _loop() +{ #ifdef WEBUPDATER_FEATURE if (UPDATE_WEBSERVER_INTVERVAL_S * 1000 / DELAY_LOOP_MS <= update_webserver_cnt) @@ -253,7 +254,7 @@ void _loop() { #endif #ifdef RESET_ESP_TIME_INTERVAL - // if millis() reached interval (1h) restart ESP + // if millis() reached interval restart ESP if (RESET_ESP_TIME_INTERVAL_MS <= millis()) { debug("Resetting firmware intentionally"); @@ -263,7 +264,8 @@ void _loop() { #endif #ifndef BATTERY_POWERED - if (UPDATE_SENSOR_INTERVAL_S * 1000 / DELAY_LOOP_MS > update_sensor_cnt) { + if (UPDATE_SENSOR_INTERVAL_S * 1000 / DELAY_LOOP_MS > update_sensor_cnt) + { return; } #endif @@ -278,7 +280,8 @@ void _loop() { #endif update_sensor_cnt = 0; - for (uint8_t i = 0; i < VALUES; i++) { + for (uint8_t i = 0; i < VALUES; i++) + { if (sensors[i]) { currentSensorData[i] = sensors[i](); } else { @@ -302,7 +305,8 @@ void _loop() { } -void logToSerial(float sensorValues[]) { +void logToSerial(float sensorValues[]) +{ Serial.println(""); Serial.println("Current readings:"); Serial.println("Temperature: " + String(sensorValues[SENSOR_TEMPERATURE]) + " °C"); diff --git a/firmware/webUpdater.ino b/firmware/webUpdater.ino index 219e908..16aedf1 100644 --- a/firmware/webUpdater.ino +++ b/firmware/webUpdater.ino @@ -80,6 +80,7 @@ void showHTMLMain(void) "windspeed" + String(_webUpdater_sensValues[SENSOR_WINDSPEED]) + "" "pressure" + String(_webUpdater_sensValues[SENSOR_PRESSURE]) + "" "batvoltage" + String(_webUpdater_sensValues[SENSOR_BAT_VOLTAGE]) + "" +"millis" + String(millis()) + "" "" "";