Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

Commit 8e631ef

Browse files
committed
lte: reduce AT+CEREG from 2 to 1
this way we only get unsolicited result codes for *state* changes (registered, registration lost), instead of for every *cell* change. This means fewer UART break signals, which in turn means fewer callbacks to deal with.
1 parent a641ac5 commit 8e631ef

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

esp32/lte/lteppp.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -520,7 +520,8 @@ static void TASK_LTE (void *pvParameters) {
520520
lteppp_send_at_cmd("ATE0", LTE_RX_TIMEOUT_MIN_MS);
521521
// disable PSM if enabled by default
522522
lteppp_send_at_cmd("AT+CPSMS=0", LTE_RX_TIMEOUT_MIN_MS);
523-
523+
// set registration URC to 1, ie for status changes
524+
lteppp_send_at_cmd("AT+CEREG=1", LTE_RX_TIMEOUT_MIN_MS);
524525
// at least enable access to the SIM
525526
lteppp_send_at_cmd("AT+CFUN?", LTE_RX_TIMEOUT_MAX_MS);
526527
char *pos = strstr(lteppp_trx_buffer, "+CFUN: ");

esp32/mods/modlte.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -280,15 +280,15 @@ static bool lte_check_attached(bool legacy) {
280280
mp_hal_delay_ms(LTE_RX_TIMEOUT_MIN_MS);
281281
lte_push_at_command("AT+CEREG?", LTE_RX_TIMEOUT_MIN_MS);
282282
}
283-
if (((pos = strstr(modlte_rsp.data, "+CEREG: 2,1,")) || (pos = strstr(modlte_rsp.data, "+CEREG: 2,5,")))
283+
if (((pos = strstr(modlte_rsp.data, "+CEREG: 1,1")) || (pos = strstr(modlte_rsp.data, "+CEREG: 1,5")))
284284
&& (strlen(pos) >= 31) && (pos[30] == '7' || pos[30] == '9')) {
285285
attached = true;
286286
}
287287
} else {
288-
if ((pos = strstr(modlte_rsp.data, "+CEREG: 2,1,")) || (pos = strstr(modlte_rsp.data, "+CEREG: 2,5,"))) {
288+
if ((pos = strstr(modlte_rsp.data, "+CEREG: 1,1")) || (pos = strstr(modlte_rsp.data, "+CEREG: 1,5"))) {
289289
attached = true;
290290
} else {
291-
if((pos = strstr(modlte_rsp.data, "+CEREG: 2,4")))
291+
if((pos = strstr(modlte_rsp.data, "+CEREG: 1,4")))
292292
{
293293
lte_ue_is_out_of_coverage = true;
294294
}

0 commit comments

Comments
 (0)