From 7c2aa35e4fad7617100592a5119a2a86029d4ebf Mon Sep 17 00:00:00 2001 From: samuelbles07 Date: Tue, 18 Mar 2025 01:02:10 +0700 Subject: [PATCH] Fix wifi connection error when using cellular --- examples/OneOpenAir/OneOpenAir.ino | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/OneOpenAir/OneOpenAir.ino b/examples/OneOpenAir/OneOpenAir.ino index 47855bc..a739657 100644 --- a/examples/OneOpenAir/OneOpenAir.ino +++ b/examples/OneOpenAir/OneOpenAir.ino @@ -938,8 +938,12 @@ void initializeNetwork() { } if (!agClient->begin()) { - // TODO: Is assert here properly added? - assert("Failed start Airgradient Client"); + oledDisplay.setText("Client", "initialization", "failed"); + delay(5000); + oledDisplay.showRebooting(); + delay(2500); + oledDisplay.setText("", "", ""); + ESP.restart(); } if (networkOption == UseWifi) { @@ -972,10 +976,6 @@ void initializeNetwork() { return; } } - else if (networkOption == UseCellular) { - // TODO: check if cellular ready - // Display something on display if error, and ignore the rest of the function just like wifi - } // Send data for the first time to AG server at boot sendDataToAg(); @@ -1108,12 +1108,12 @@ static void updateDisplayAndLedBar(void) { return; } - if (wifiConnector.isConnected() == false) { + if (wifiConnector.isConnected() == false && networkOption == UseWifi) { stateMachine.displayHandle(AgStateMachineWiFiLost); stateMachine.handleLeds(AgStateMachineWiFiLost); return; } - // TODO: Also show for cellular connection + // TODO: Also show for cellular connection problem if (configuration.isCloudConnectionDisabled()) { // Ignore API related check since cloud is disabled