Skip to content

Commit

Permalink
Tweaked the wait_for_at function to handle the initial 0x00 character…
Browse files Browse the repository at this point in the history
… on the modem serial line to avoid a modem reboot caused by the previous change to this function.
  • Loading branch information
dajtxx committed May 15, 2024
1 parent d6b720f commit acae023
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion firmware/wombat/src/Utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,10 +292,18 @@ bool wait_for_at(void) {
int i = 0;
while (LTE_Serial.available() && i < (MAX_G_BUFFER-1)) {
int ch = LTE_Serial.read();
// After power up there is often a 0x00 on the serial line from the modem.
if (ch < 1) {
continue;
}

// Between 1 and 9 inclusive means noise.
if (ch < 10) {
// Should only be reading CR, LF, and A-Z.
return false;
ESP_LOGI(TAG, "wait_for_at: %02x", ch);
continue;
}

g_buffer[i++] = (char)(ch & 0xFF);
g_buffer[i] = 0;
}
Expand Down

0 comments on commit acae023

Please sign in to comment.