Fix OTA request on boot when cloud Connection disabled

This commit is contained in:
samuelbles07
2025-05-05 17:36:14 +07:00
parent 5e07923690
commit e2084f0738

View File

@ -555,6 +555,11 @@ static bool sgp41Init(void) {
}
void checkForFirmwareUpdate(void) {
if (configuration.isCloudConnectionDisabled()) {
Serial.println("Cloud connection is disabled, skip firmware update");
return;
}
AirgradientOTA *agOta;
if (networkOption == UseWifi) {
agOta = new AirgradientOTAWifi;
@ -1562,6 +1567,8 @@ void restartIfCeClientIssueOverTwoHours() {
}
void networkingTask(void *args) {
// If cloud connection enabled, run first transmission to server at boot
if (configuration.isCloudConnectionDisabled() == false) {
// OTA check on boot
#ifndef ESP8266
checkForFirmwareUpdate();
@ -1578,10 +1585,10 @@ void networkingTask(void *args) {
postUsingCellular(true);
measurementSchedule.update();
}
// Reset scheduler
configSchedule.update();
transmissionSchedule.update();
}
while (1) {
// Handle reconnection based on mode