mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-07-05 12:16:31 +02:00
Move rebooting process out of OtaHandler
This commit is contained in:
@ -487,10 +487,22 @@ static void displayExecuteOta(OtaState state, String msg, int processing) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case OtaState::OTA_STATE_SUCCESS: {
|
case OtaState::OTA_STATE_SUCCESS: {
|
||||||
|
int i = 6;
|
||||||
|
while(i != 0) {
|
||||||
|
i = i - 1;
|
||||||
|
Serial.println("OTA update performed, restarting ...");
|
||||||
|
int i = 6;
|
||||||
|
while (i != 0) {
|
||||||
|
i = i - 1;
|
||||||
if (ag->isOne()) {
|
if (ag->isOne()) {
|
||||||
oledDisplay.showNewFirmwareSuccess(String(processing));
|
oledDisplay.showNewFirmwareSuccess(String(i));
|
||||||
} else {
|
} else {
|
||||||
Serial.println("Rebooting... " + String(processing));
|
Serial.println("Rebooting... " + String(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
delay(1000);
|
||||||
|
}
|
||||||
|
esp_restart();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -41,16 +41,13 @@ public:
|
|||||||
OtaUpdateOutcome ret = attemptToPerformOta(&config);
|
OtaUpdateOutcome ret = attemptToPerformOta(&config);
|
||||||
Serial.println(ret);
|
Serial.println(ret);
|
||||||
if (ret == OtaUpdateOutcome::UPDATE_PERFORMED) {
|
if (ret == OtaUpdateOutcome::UPDATE_PERFORMED) {
|
||||||
Serial.println("OTA update performed, restarting ...");
|
|
||||||
int i = 6;
|
|
||||||
while (i != 0) {
|
|
||||||
i = i - 1;
|
|
||||||
if (this->callback) {
|
if (this->callback) {
|
||||||
this->callback(OtaState::OTA_STATE_SUCCESS, String(i));
|
this->callback(OtaState::OTA_STATE_SUCCESS, "");
|
||||||
}
|
}
|
||||||
delay(1000);
|
} else {
|
||||||
|
if(this->callback) {
|
||||||
|
this->callback(OtaState::OTA_STATE_FAIL, "");
|
||||||
}
|
}
|
||||||
esp_restart();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user