mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-09-25 20:20:55 +02:00
Merge pull request #313 from airgradienthq/fix/mode-cloud-disable
Fix bootloop when cloud connection is disabled
This commit is contained in:
@@ -555,6 +555,11 @@ static bool sgp41Init(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void checkForFirmwareUpdate(void) {
|
void checkForFirmwareUpdate(void) {
|
||||||
|
if (configuration.isCloudConnectionDisabled()) {
|
||||||
|
Serial.println("Cloud connection is disabled, skip firmware update");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
AirgradientOTA *agOta;
|
AirgradientOTA *agOta;
|
||||||
if (networkOption == UseWifi) {
|
if (networkOption == UseWifi) {
|
||||||
agOta = new AirgradientOTAWifi;
|
agOta = new AirgradientOTAWifi;
|
||||||
@@ -1562,6 +1567,8 @@ void restartIfCeClientIssueOverTwoHours() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void networkingTask(void *args) {
|
void networkingTask(void *args) {
|
||||||
|
// If cloud connection enabled, run first transmission to server at boot
|
||||||
|
if (configuration.isCloudConnectionDisabled() == false) {
|
||||||
// OTA check on boot
|
// OTA check on boot
|
||||||
#ifndef ESP8266
|
#ifndef ESP8266
|
||||||
checkForFirmwareUpdate();
|
checkForFirmwareUpdate();
|
||||||
@@ -1578,10 +1585,10 @@ void networkingTask(void *args) {
|
|||||||
postUsingCellular(true);
|
postUsingCellular(true);
|
||||||
measurementSchedule.update();
|
measurementSchedule.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset scheduler
|
// Reset scheduler
|
||||||
configSchedule.update();
|
configSchedule.update();
|
||||||
transmissionSchedule.update();
|
transmissionSchedule.update();
|
||||||
|
}
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
// Handle reconnection based on mode
|
// Handle reconnection based on mode
|
||||||
@@ -1637,7 +1644,7 @@ void networkingTask(void *args) {
|
|||||||
// If connection to AirGradient server disable don't run config and transmission schedule
|
// If connection to AirGradient server disable don't run config and transmission schedule
|
||||||
if (configuration.isCloudConnectionDisabled()) {
|
if (configuration.isCloudConnectionDisabled()) {
|
||||||
delay(1000);
|
delay(1000);
|
||||||
return;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run scheduler
|
// Run scheduler
|
||||||
|
Reference in New Issue
Block a user