mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-07-28 07:57:18 +02:00
Fix OTA request on boot when cloud Connection 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,27 +1567,29 @@ void restartIfCeClientIssueOverTwoHours() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void networkingTask(void *args) {
|
void networkingTask(void *args) {
|
||||||
// OTA check on boot
|
// If cloud connection enabled, run first transmission to server at boot
|
||||||
|
if (configuration.isCloudConnectionDisabled() == false) {
|
||||||
|
// OTA check on boot
|
||||||
#ifndef ESP8266
|
#ifndef ESP8266
|
||||||
checkForFirmwareUpdate();
|
checkForFirmwareUpdate();
|
||||||
checkForUpdateSchedule.update();
|
checkForUpdateSchedule.update();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Because cellular interval is longer, needs to send first measures cycle on
|
// Because cellular interval is longer, needs to send first measures cycle on
|
||||||
// boot to indicate that its online
|
// boot to indicate that its online
|
||||||
if (networkOption == UseCellular) {
|
if (networkOption == UseCellular) {
|
||||||
Serial.println("Prepare first measures cycle to send on boot for 20s");
|
Serial.println("Prepare first measures cycle to send on boot for 20s");
|
||||||
delay(20000);
|
delay(20000);
|
||||||
networkSignalCheck();
|
networkSignalCheck();
|
||||||
newMeasurementCycle();
|
newMeasurementCycle();
|
||||||
postUsingCellular(true);
|
postUsingCellular(true);
|
||||||
measurementSchedule.update();
|
measurementSchedule.update();
|
||||||
|
}
|
||||||
|
// Reset scheduler
|
||||||
|
configSchedule.update();
|
||||||
|
transmissionSchedule.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset scheduler
|
|
||||||
configSchedule.update();
|
|
||||||
transmissionSchedule.update();
|
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
// Handle reconnection based on mode
|
// Handle reconnection based on mode
|
||||||
if (networkOption == UseWifi) {
|
if (networkOption == UseWifi) {
|
||||||
|
Reference in New Issue
Block a user