8000 lte: fix core dump during machine.deepsleep() · pycom/pycom-micropython-sigfox@358085b · GitHub
[go: up one dir, main page]

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

Commit 358085b

Browse files
committed
lte: fix core dump during machine.deepsleep()
since 26adae2 it is possible that the lte task is not running. with this commit we can safely check the status, notably from modmachine.c machine_deepsleep()
1 parent 94865e5 commit 358085b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

esp32/lte/lteppp.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,10 @@ char* lteppp_get_log_buff(void)
214214
lte_modem_conn_state_t lteppp_modem_state(void)
215215
{
216216
lte_modem_conn_state_t state;
217+
if (!xLTESem){
218+
// lte task hasn't been initialized yet, so we don't need to (and can't) protect this read
219+
return lteppp_modem_conn_state;
220+
}
217221
xSemaphoreTake(xLTESem, portMAX_DELAY);
218222
state = lteppp_modem_conn_state;
219223
xSemaphoreGive(xLTESem);
@@ -382,6 +386,10 @@ bool lteppp_wait_at_rsp (const char *expected_rsp, uint32_t timeout, bool from_m
382386

383387
lte_state_t lteppp_get_state(void) {
384388
lte_state_t state;
389+
if (!xLTESem){
390+
// lte task hasn't been initialized yet, so we don't need to (and can't) protect this read
391+
return lteppp_lte_state;
392+
}
385393
xSemaphoreTake(xLTESem, portMAX_DELAY);
386394
state = lteppp_lte_state;
387395
xSemaphoreGive(xLTESem);

0 commit comments

Comments
 (0)
0