Enable cellular at debug when registering network

On boot, airgradient-client change cellular init timeout to 5 mins
This commit is contained in:
samuelbles07
2025-03-31 13:53:56 +07:00
parent 37de127887
commit 145c612867
3 changed files with 15 additions and 1 deletions

View File

@ -934,6 +934,11 @@ void initializeNetwork() {
networkOption = UseWifi;
}
if (networkOption == UseCellular) {
// Enable serial stream debugging to check the AT command when doing registration
agSerial->setDebug(true);
}
if (!agClient->begin(ag->deviceId().c_str())) {
oledDisplay.setText("Client", "initialization", "failed");
delay(5000);
@ -943,6 +948,11 @@ void initializeNetwork() {
ESP.restart();
}
if (networkOption == UseCellular) {
// Disabling it again
agSerial->setDebug(false);
}
if (networkOption == UseWifi) {
if (!wifiConnector.connect()) {
Serial.println("Cannot initiate wifi connection");
@ -1495,11 +1505,13 @@ void networkingTask(void *args) {
else if (networkOption == UseCellular) {
if (agClient->isClientReady() == false) {
Serial.println("Cellular client not ready, ensuring connection...");
agSerial->setDebug(true);
if (agClient->ensureClientConnection() == false) {
Serial.println("Cellular client connection not ready, retry in 5s...");
delay(5000);
continue;
}
agSerial->setDebug(false);
}
}