mirror of
https://github.com/airgradienthq/arduino.git
synced 2025-07-28 07:57:18 +02:00
Handling cellular client not ready better
This commit is contained in:
@ -1455,7 +1455,12 @@ void networkSignalCheck() {
|
|||||||
} else if (networkOption == UseCellular) {
|
} else if (networkOption == UseCellular) {
|
||||||
auto result = cell->retrieveSignal();
|
auto result = cell->retrieveSignal();
|
||||||
if (result.status != CellReturnStatus::Ok) {
|
if (result.status != CellReturnStatus::Ok) {
|
||||||
// TODO: Need to do something when get signal failed
|
agClient->setClientReady(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (result.data == 99) {
|
||||||
|
// 99 indicate cellular not attached to network
|
||||||
|
agClient->setClientReady(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Serial.printf("Cellular signal strength %d\n", result.data);
|
Serial.printf("Cellular signal strength %d\n", result.data);
|
||||||
@ -1496,11 +1501,8 @@ void networkingTask(void *args) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (networkOption == UseCellular) {
|
else if (networkOption == UseCellular) {
|
||||||
// Check if last fetch config and post measures failed
|
if (agClient->isClientReady() == false) {
|
||||||
// It can be an indication that module has a problem
|
Serial.println("Cellular client not ready, ensuring connection...");
|
||||||
if (agClient->isLastFetchConfigSucceed() == false ||
|
|
||||||
agClient->isLastPostMeasureSucceed() == false) {
|
|
||||||
Serial.println("Last server communication might failed, checking...");
|
|
||||||
if (agClient->ensureClientConnection() == false) {
|
if (agClient->ensureClientConnection() == false) {
|
||||||
Serial.println("Cellular client connection not ready, retry in 5s...");
|
Serial.println("Cellular client connection not ready, retry in 5s...");
|
||||||
delay(5000);
|
delay(5000);
|
||||||
|
Submodule src/Libraries/airgradient-client updated: b76bb9635b...774f8b70e6
@ -10,7 +10,7 @@
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
#include <esp32-hal-log.h>
|
#include <esp32-hal-log.h>
|
||||||
#define AgLog(c, ...) log_d(c, ##__VA_ARGS__)
|
#define AgLog(c, ...) log_i(c, ##__VA_ARGS__)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user