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: steps:
- uses: actions/checkout@v4.2.2 - uses: actions/checkout@v4.2.2
with: with:
fetch-depth: 0
submodules: 'true' submodules: 'true'
- uses: arduino/compile-sketches@v1.1.2 - uses: arduino/compile-sketches@v1.1.2
with: with:

2
.gitignore vendored
View File

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

View File

@ -939,6 +939,11 @@ void initializeNetwork() {
networkOption = UseWifi; 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())) { if (!agClient->begin(ag->deviceId().c_str())) {
oledDisplay.setText("Client", "initialization", "failed"); oledDisplay.setText("Client", "initialization", "failed");
delay(5000); delay(5000);
@ -948,6 +953,11 @@ void initializeNetwork() {
ESP.restart(); ESP.restart();
} }
if (networkOption == UseCellular) {
// Disabling it again
agSerial->setDebug(false);
}
if (networkOption == UseWifi) { if (networkOption == UseWifi) {
if (!wifiConnector.connect()) { if (!wifiConnector.connect()) {
Serial.println("Cannot initiate wifi connection"); Serial.println("Cannot initiate wifi connection");
@ -1500,11 +1510,13 @@ void networkingTask(void *args) {
else if (networkOption == UseCellular) { else if (networkOption == UseCellular) {
if (agClient->isClientReady() == false) { if (agClient->isClientReady() == false) {
Serial.println("Cellular client not ready, ensuring connection..."); Serial.println("Cellular client not ready, ensuring connection...");
agSerial->setDebug(true);
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);
continue; continue;
} }
agSerial->setDebug(false);
} }
} }