mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-07-29 16:37:17 +02:00
Fix: ota not callback on first powerup perform
This commit is contained in:
@ -219,6 +219,7 @@ void setup() {
|
|||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
// ota not supported
|
// ota not supported
|
||||||
#else
|
#else
|
||||||
|
otaHandler.setHandlerCallback(otaHandlerCallback);
|
||||||
otaHandler.updateFirmwareIfOutdated(ag->deviceId());
|
otaHandler.updateFirmwareIfOutdated(ag->deviceId());
|
||||||
|
|
||||||
/** Update first OTA */
|
/** Update first OTA */
|
||||||
@ -485,6 +486,7 @@ static bool sgp41Init(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void otaHandlerCallback(OtaState state, String mesasge) {
|
static void otaHandlerCallback(OtaState state, String mesasge) {
|
||||||
|
Serial.println("OTA message: " + mesasge);
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case OtaState::OTA_STATE_BEGIN:
|
case OtaState::OTA_STATE_BEGIN:
|
||||||
displayExecuteOta(state, fwNewVersion, 0);
|
displayExecuteOta(state, fwNewVersion, 0);
|
||||||
@ -562,7 +564,7 @@ static void displayExecuteOta(OtaState state, String msg, int processing) {
|
|||||||
while (i != 0) {
|
while (i != 0) {
|
||||||
i = i - 1;
|
i = i - 1;
|
||||||
if (ag->isOne()) {
|
if (ag->isOne()) {
|
||||||
oledDisplay.showFirmwareUpdateSuccess(String(i));
|
oledDisplay.showFirmwareUpdateSuccess(i);
|
||||||
} else {
|
} else {
|
||||||
Serial.println("Rebooting... " + String(i));
|
Serial.println("Rebooting... " + String(i));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user