forked from airgradienthq/arduino
Merge pull request #295 from airgradienthq/feat/enable-at-debug
Enable cellular AT command debug when in network registration
This commit is contained in:
1
.github/workflows/check.yml
vendored
1
.github/workflows/check.yml
vendored
@ -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
2
.gitignore
vendored
@ -4,5 +4,7 @@ build
|
||||
/.idea/
|
||||
.pio
|
||||
.cache
|
||||
.clangd
|
||||
logs
|
||||
gen_compile_commands.py
|
||||
compile_commands.json
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Submodule src/Libraries/airgradient-client updated: 774f8b70e6...938a92830d
Reference in New Issue
Block a user