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