mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-07-05 04:06: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;
|
||||
}
|
||||
case OtaState::OTA_STATE_SUCCESS: {
|
||||
if (ag->isOne()) {
|
||||
oledDisplay.showNewFirmwareSuccess(String(processing));
|
||||
} else {
|
||||
Serial.println("Rebooting... " + String(processing));
|
||||
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()) {
|
||||
oledDisplay.showNewFirmwareSuccess(String(i));
|
||||
} else {
|
||||
Serial.println("Rebooting... " + String(i));
|
||||
}
|
||||
|
||||
delay(1000);
|
||||
}
|
||||
esp_restart();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -41,16 +41,13 @@ public:
|
||||
OtaUpdateOutcome ret = attemptToPerformOta(&config);
|
||||
Serial.println(ret);
|
||||
if (ret == OtaUpdateOutcome::UPDATE_PERFORMED) {
|
||||
Serial.println("OTA update performed, restarting ...");
|
||||
int i = 6;
|
||||
while (i != 0) {
|
||||
i = i - 1;
|
||||
if (this->callback) {
|
||||
this->callback(OtaState::OTA_STATE_SUCCESS, String(i));
|
||||
}
|
||||
delay(1000);
|
||||
if (this->callback) {
|
||||
this->callback(OtaState::OTA_STATE_SUCCESS, "");
|
||||
}
|
||||
} else {
|
||||
if(this->callback) {
|
||||
this->callback(OtaState::OTA_STATE_FAIL, "");
|
||||
}
|
||||
esp_restart();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user