let hw watchdog run independently of POST success

This commit is contained in:
Achim
2024-09-21 08:09:58 +07:00
parent ca5fc8d65b
commit 76e40fea8c
4 changed files with 4 additions and 28 deletions

View File

@ -206,11 +206,7 @@ void loop() {
tvocSchedule.run(); tvocSchedule.run();
} }
/** Auto reset watchdog timer if offline mode or postDataToAirGradient */ watchdogFeedSchedule.run();
if (configuration.isOfflineMode() ||
(configuration.isPostDataToAirGradient() == false)) {
watchdogFeedSchedule.run();
}
/** Check for handle WiFi reconnect */ /** Check for handle WiFi reconnect */
wifiConnector.handle(); wifiConnector.handle();
@ -542,13 +538,11 @@ static void sendDataToServer(void) {
String syncData = measurements.toString(false, fwMode, wifiConnector.RSSI(), String syncData = measurements.toString(false, fwMode, wifiConnector.RSSI(),
&ag, &configuration); &ag, &configuration);
if (apiClient.postToServer(syncData)) { if (apiClient.postToServer(syncData)) {
ag.watchdog.reset();
Serial.println(); Serial.println();
Serial.println( Serial.println(
"Online mode and isPostToAirGradient = true: watchdog reset"); "Online mode and isPostToAirGradient = true: watchdog reset");
Serial.println(); Serial.println();
} }
measurements.bootCount++; measurements.bootCount++;
} }

View File

@ -204,11 +204,7 @@ void loop() {
tvocSchedule.run(); tvocSchedule.run();
} }
/** Auto reset watchdog timer if offline mode or postDataToAirGradient */ watchdogFeedSchedule.run();
if (configuration.isOfflineMode() ||
(configuration.isPostDataToAirGradient() == false)) {
watchdogFeedSchedule.run();
}
/** Check for handle WiFi reconnect */ /** Check for handle WiFi reconnect */
wifiConnector.handle(); wifiConnector.handle();
@ -594,13 +590,11 @@ static void sendDataToServer(void) {
String syncData = measurements.toString(false, fwMode, wifiConnector.RSSI(), String syncData = measurements.toString(false, fwMode, wifiConnector.RSSI(),
&ag, &configuration); &ag, &configuration);
if (apiClient.postToServer(syncData)) { if (apiClient.postToServer(syncData)) {
ag.watchdog.reset();
Serial.println(); Serial.println();
Serial.println( Serial.println(
"Online mode and isPostToAirGradient = true: watchdog reset"); "Online mode and isPostToAirGradient = true: watchdog reset");
Serial.println(); Serial.println();
} }
measurements.bootCount++; measurements.bootCount++;
} }

View File

@ -231,11 +231,7 @@ void loop() {
tvocSchedule.run(); tvocSchedule.run();
} }
/** Auto reset watchdog timer if offline mode or postDataToAirGradient */ watchdogFeedSchedule.run();
if (configuration.isOfflineMode() ||
(configuration.isPostDataToAirGradient() == false)) {
watchdogFeedSchedule.run();
}
/** Check for handle WiFi reconnect */ /** Check for handle WiFi reconnect */
wifiConnector.handle(); wifiConnector.handle();
@ -635,13 +631,11 @@ static void sendDataToServer(void) {
String syncData = measurements.toString(false, fwMode, wifiConnector.RSSI(), String syncData = measurements.toString(false, fwMode, wifiConnector.RSSI(),
&ag, &configuration); &ag, &configuration);
if (apiClient.postToServer(syncData)) { if (apiClient.postToServer(syncData)) {
ag.watchdog.reset();
Serial.println(); Serial.println();
Serial.println( Serial.println(
"Online mode and isPostToAirGradient = true: watchdog reset"); "Online mode and isPostToAirGradient = true: watchdog reset");
Serial.println(); Serial.println();
} }
measurements.bootCount++; measurements.bootCount++;
} }

View File

@ -298,11 +298,7 @@ void loop() {
} }
} }
/** Auto reset watchdog timer if offline mode or postDataToAirGradient */ watchdogFeedSchedule.run();
if (configuration.isOfflineMode() ||
(configuration.isPostDataToAirGradient() == false)) {
watchdogFeedSchedule.run();
}
/** Check for handle WiFi reconnect */ /** Check for handle WiFi reconnect */
wifiConnector.handle(); wifiConnector.handle();
@ -1240,13 +1236,11 @@ static void sendDataToServer(void) {
String syncData = measurements.toString(false, fwMode, wifiConnector.RSSI(), String syncData = measurements.toString(false, fwMode, wifiConnector.RSSI(),
ag, &configuration); ag, &configuration);
if (apiClient.postToServer(syncData)) { if (apiClient.postToServer(syncData)) {
ag->watchdog.reset();
Serial.println(); Serial.println();
Serial.println( Serial.println(
"Online mode and isPostToAirGradient = true: watchdog reset"); "Online mode and isPostToAirGradient = true: watchdog reset");
Serial.println(); Serial.println();
} }
measurements.bootCount++; measurements.bootCount++;
} }