mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-07-28 07:57:18 +02:00
Apply stop main task for wifi too
Improve flow OTA success display
This commit is contained in:
@ -209,7 +209,6 @@ void setup() {
|
||||
// Comment below line to disable debug measurement readings
|
||||
measurements.setDebug(true);
|
||||
|
||||
// bool connectToWifi = false;
|
||||
bool connectToNetwork = true;
|
||||
if (ag->isOne()) { // Offline mode only available for indoor monitor
|
||||
/** Show message confirm offline mode, should me perform if LED bar button
|
||||
@ -541,29 +540,27 @@ void checkForFirmwareUpdate(void) {
|
||||
}
|
||||
|
||||
// Indicate main task that ota is performing
|
||||
// Only for cellular because it can disturb i2c line
|
||||
Serial.println("Check for firmware update");
|
||||
if (networkOption == UseCellular) {
|
||||
Serial.println("Disabling scheduler to read sensors for cellular OTA");
|
||||
Serial.println("Check for firmware update, disabling main task");
|
||||
otaInProgress = true;
|
||||
if (configuration.hasSensorSGP) {
|
||||
if (configuration.hasSensorSGP && networkOption == UseCellular) {
|
||||
// Only for cellular because it can disturb i2c line
|
||||
Serial.println("Disable SGP41 task for cellular OTA");
|
||||
ag->sgp41.end();
|
||||
}
|
||||
}
|
||||
|
||||
agOta->setHandlerCallback(otaHandlerCallback);
|
||||
agOta->updateIfAvailable(ag->deviceId().c_str(), GIT_VERSION);
|
||||
|
||||
// Only goes to this line if OTA is not success
|
||||
// Handled by otaHandlerCallback
|
||||
if (networkOption == UseCellular) {
|
||||
|
||||
otaInProgress = false;
|
||||
if (configuration.hasSensorSGP) {
|
||||
if (configuration.hasSensorSGP && networkOption == UseCellular) {
|
||||
// Re-start SGP41 task
|
||||
if (!sgp41Init()) {
|
||||
Serial.println("Failed re-start SGP41 task");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
delete agOta;
|
||||
Serial.println();
|
||||
@ -634,11 +631,8 @@ static void displayExecuteOta(AirgradientOTA::OtaResult result, String msg, int
|
||||
}
|
||||
break;
|
||||
case AirgradientOTA::Success: {
|
||||
int i = 6;
|
||||
while (i != 0) {
|
||||
i = i - 1;
|
||||
Serial.println("OTA update performed, restarting ...");
|
||||
int i = 6;
|
||||
int i = 3;
|
||||
while (i != 0) {
|
||||
i = i - 1;
|
||||
if (ag->isOne()) {
|
||||
@ -646,11 +640,9 @@ static void displayExecuteOta(AirgradientOTA::OtaResult result, String msg, int
|
||||
} else {
|
||||
Serial.println("Rebooting... " + String(i));
|
||||
}
|
||||
|
||||
delay(1000);
|
||||
}
|
||||
oledDisplay.setBrightness(0);
|
||||
}
|
||||
oledDisplay.setAirGradient(0);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
Reference in New Issue
Block a user