Merge branch 'develop' into hotfix/correct-ota-update-message-on-display

This commit is contained in:
Phat Nguyen
2024-05-24 13:30:09 +07:00
committed by GitHub
5 changed files with 31 additions and 7 deletions

View File

@ -219,15 +219,20 @@ void setup() {
#ifdef ESP8266
// ota not supported
#else
// otaHandler.updateFirmwareIfOutdated(ag->deviceId());
otaHandler.updateFirmwareIfOutdated(ag->deviceId());
/** Update first OTA */
measurements.otaBootCount = 0;
#endif
apiClient.fetchServerConfiguration();
configSchedule.update();
if (apiClient.isFetchConfigureFailed()) {
if (ag->isOne()) {
stateMachine.displayHandle(
AgStateMachineWiFiOkServerOkSensorConfigFailed);
if (apiClient.isNotAvailableOnDashboard()) {
stateMachine.displayHandle(
AgStateMachineWiFiOkServerOkSensorConfigFailed);
}
}
stateMachine.handleLeds(
AgStateMachineWiFiOkServerOkSensorConfigFailed);
@ -882,8 +887,9 @@ static void configUpdateHandle() {
doOta = true;
Serial.println("First OTA");
} else {
int bootDiff = measurements.bootCount - measurements.otaBootCount;
if (bootDiff >= 30) {
/** 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 {
Serial.println(