Fix wifi connection error when using cellular

This commit is contained in:
samuelbles07
2025-03-18 01:02:10 +07:00
parent e93009f31c
commit 7c2aa35e4f

View File

@ -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