forked from airgradienthq/arduino
Merge branch 'hotfix/factory-reset-offline-mode' into hotfix/offline-mode-should-not-show-server-status
This commit is contained in:
@ -402,9 +402,8 @@ static void factoryConfigReset(void) {
|
||||
mqttTask = NULL;
|
||||
}
|
||||
|
||||
/** Disconnect WIFI */
|
||||
wifiConnector.disconnect();
|
||||
wifiConnector.reset();
|
||||
/** Reset WIFI */
|
||||
WiFi.disconnect(true, true);
|
||||
|
||||
/** Reset local config */
|
||||
configuration.reset();
|
||||
@ -440,7 +439,7 @@ static void factoryConfigReset(void) {
|
||||
static void wdgFeedUpdate(void) {
|
||||
ag->watchdog.reset();
|
||||
Serial.println();
|
||||
Serial.println("External watchdog feed");
|
||||
Serial.println("Offline mode or isPostToAirGradient = false: watchdog reset");
|
||||
Serial.println();
|
||||
}
|
||||
|
||||
@ -584,11 +583,6 @@ static void sendDataToAg() {
|
||||
stateMachine.handleLeds(AgStateMachineNormal);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Must reset each 5min to avoid ESP32 reset
|
||||
*/
|
||||
static void resetWatchdog() { ag->watchdog.reset(); }
|
||||
|
||||
void dispSensorNotFound(String ss) {
|
||||
ss = ss + " not found";
|
||||
oledDisplay.setText("Sensor init", "Error:", ss.c_str());
|
||||
@ -1101,10 +1095,19 @@ static void updatePm(void) {
|
||||
}
|
||||
|
||||
static void sendDataToServer(void) {
|
||||
/** Ignore send data to server if postToAirGradient disabled */
|
||||
if (configuration.isPostDataToAirGradient() == false) {
|
||||
return;
|
||||
}
|
||||
|
||||
String syncData = measurements.toString(false, fwMode, wifiConnector.RSSI(),
|
||||
ag, &configuration);
|
||||
if (apiClient.postToServer(syncData)) {
|
||||
resetWatchdog();
|
||||
ag->watchdog.reset();
|
||||
Serial.println();
|
||||
Serial.println(
|
||||
"Online mode and isPostToAirGradient = true: watchdog reset");
|
||||
Serial.println();
|
||||
}
|
||||
|
||||
measurements.bootCount++;
|
||||
|
Reference in New Issue
Block a user