Updated ESP reset intervak. Modified code formatting.
This commit is contained in:
parent
01108980dd
commit
7c935946ac
3 changed files with 12 additions and 7 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -80,6 +80,7 @@ void showHTMLMain(void)
|
|||
"<tr><td>windspeed</td><td>" + String(_webUpdater_sensValues[SENSOR_WINDSPEED]) + "</td></tr>"
|
||||
"<tr><td>pressure</td><td>" + String(_webUpdater_sensValues[SENSOR_PRESSURE]) + "</td></tr>"
|
||||
"<tr><td>batvoltage</td><td>" + String(_webUpdater_sensValues[SENSOR_BAT_VOLTAGE]) + "</td></tr>"
|
||||
"<tr><td>millis</td><td>" + String(millis()) + "</td></tr>"
|
||||
"</table>"
|
||||
"</body></html>";
|
||||
|
||||
|
|
Loading…
Reference in a new issue