Merge pull request #295 from airgradienthq/feat/enable-at-debug

Enable cellular AT command debug when in network registration
This commit is contained in:
Samuel Siburian
2025-03-31 17:09:43 +07:00
committed by GitHub
4 changed files with 16 additions and 1 deletions

View File

@ -38,6 +38,7 @@ jobs:
steps:
- uses: actions/checkout@v4.2.2
with:
fetch-depth: 0
submodules: 'true'
- uses: arduino/compile-sketches@v1.1.2
with:

2
.gitignore vendored
View File

@ -4,5 +4,7 @@ build
/.idea/
.pio
.cache
.clangd
logs
gen_compile_commands.py
compile_commands.json

View File

@ -939,6 +939,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);
@ -948,6 +953,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");
@ -1500,11 +1510,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);
}
}