Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.
Prev Previous commit
Next Next commit
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()
  • Loading branch information
peter-pycom committed Dec 18, 2020
commit 358085bda144a97d48a9dd6deccb2fe6eb3a91b7
8 changes: 8 additions & 0 deletions esp32/lte/lteppp.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,10 @@ char* lteppp_get_log_buff(void)
lte_modem_conn_state_t lteppp_modem_state(void)
{
lte_modem_conn_state_t state;
if (!xLTESem){
// lte task hasn't been initialized yet, so we don't need to (and can't) protect this read
return lteppp_modem_conn_state;
}
xSemaphoreTake(xLTESem, portMAX_DELAY);
state = lteppp_modem_conn_state;
xSemaphoreGive(xLTESem);
Expand Down Expand Up @@ -382,6 +386,10 @@ bool lteppp_wait_at_rsp (const char *expected_rsp, uint32_t timeout, bool from_m

lte_state_t lteppp_get_state(void) {
lte_state_t state;
if (!xLTESem){
// lte task hasn't been initialized yet, so we don't need to (and can't) protect this read
return lteppp_lte_state;
}
xSemaphoreTake(xLTESem, portMAX_DELAY);
state = lteppp_lte_state;
xSemaphoreGive(xLTESem);
Expand Down