From 805546b78e332b6116eaf618f3e8e5f1db40301b Mon Sep 17 00:00:00 2001 From: Phat Nguyen Date: Wed, 22 May 2024 11:34:42 +0700 Subject: [PATCH 1/3] check firmware update after powerup --- examples/OneOpenAir/OneOpenAir.ino | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/OneOpenAir/OneOpenAir.ino b/examples/OneOpenAir/OneOpenAir.ino index ed911d5..a9f81eb 100644 --- a/examples/OneOpenAir/OneOpenAir.ino +++ b/examples/OneOpenAir/OneOpenAir.ino @@ -219,7 +219,7 @@ void setup() { #ifdef ESP8266 // ota not supported #else - // otaHandler.updateFirmwareIfOutdated(ag->deviceId()); + otaHandler.updateFirmwareIfOutdated(ag->deviceId()); #endif apiClient.fetchServerConfiguration(); From 7550ef7b0c9286310a983fba39f8df47c977e540 Mon Sep 17 00:00:00 2001 From: Phat Nguyen Date: Wed, 22 May 2024 11:45:56 +0700 Subject: [PATCH 2/3] change OTA update period each 2h. --- examples/OneOpenAir/OneOpenAir.ino | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/examples/OneOpenAir/OneOpenAir.ino b/examples/OneOpenAir/OneOpenAir.ino index a9f81eb..82742a1 100644 --- a/examples/OneOpenAir/OneOpenAir.ino +++ b/examples/OneOpenAir/OneOpenAir.ino @@ -220,6 +220,9 @@ void setup() { // ota not supported #else otaHandler.updateFirmwareIfOutdated(ag->deviceId()); + + /** Update first OTA */ + measurements.otaBootCount = 0; #endif apiClient.fetchServerConfiguration(); @@ -861,7 +864,9 @@ static void configUpdateHandle() { doOta = true; Serial.println("First OTA"); } else { - if ((measurements.bootCount - measurements.otaBootCount) >= 30) { + /** Only check for update each 2h*/ + const float otaBootCount = 120.0f / (SERVER_SYNC_INTERVAL / 60000.0f); + if ((measurements.bootCount - measurements.otaBootCount) >= (int)otaBootCount) { doOta = true; } else { Serial.println( From d85d89087813dc1a345d8b79af2d99d1f9918a6d Mon Sep 17 00:00:00 2001 From: Phat Nguyen Date: Fri, 24 May 2024 08:26:24 +0700 Subject: [PATCH 3/3] Change OTA update period from 2h to 1h --- examples/OneOpenAir/OneOpenAir.ino | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/OneOpenAir/OneOpenAir.ino b/examples/OneOpenAir/OneOpenAir.ino index 82742a1..594878e 100644 --- a/examples/OneOpenAir/OneOpenAir.ino +++ b/examples/OneOpenAir/OneOpenAir.ino @@ -864,8 +864,8 @@ static void configUpdateHandle() { doOta = true; Serial.println("First OTA"); } else { - /** Only check for update each 2h*/ - const float otaBootCount = 120.0f / (SERVER_SYNC_INTERVAL / 60000.0f); + /** Only check for update each 1h*/ + const float otaBootCount = 60.0f / (SERVER_SYNC_INTERVAL / 60000.0f); if ((measurements.bootCount - measurements.otaBootCount) >= (int)otaBootCount) { doOta = true; } else {