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

Fixed delays causing not to achieve low power after deepsleep #255

Open
wants to merge 1 commit into
base: release-candidate
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions esp32/lte/lteppp.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,14 +277,10 @@ lte_legacy_t lteppp_get_legacy(void) {
}

void lteppp_deinit (void) {

// enable airplane low power mode
lteppp_send_at_cmd("AT!=\"setlpm airplane=1 enable=1\"", LTE_RX_TIMEOUT_MAX_MS);

uart_set_hw_flow_ctrl(LTE_UART_ID, UART_HW_FLOWCTRL_DISABLE, 0);
uart_set_rts(LTE_UART_ID, false);
xSemaphoreTake(xLTESem, portMAX_DELAY);
lteppp_lte_state = E_LTE_INIT;
lteppp_lte_state = E_LTE_DEINIT;
xSemaphoreGive(xLTESem);
}

Expand Down Expand Up @@ -392,11 +388,7 @@ static void TASK_LTE (void *pvParameters) {
}
}

// disable PSM if enabled by default
lteppp_send_at_cmd("AT+CPSMS?", LTE_RX_TIMEOUT_MAX_MS);
if (!strstr(lteppp_trx_buffer, "+CPSMS: 0")) {
lteppp_send_at_cmd("AT+CPSMS=0", LTE_RX_TIMEOUT_MIN_MS);
}

// enable airplane low power mode
lteppp_send_at_cmd("AT!=\"setlpm airplane=1 enable=1\"", LTE_RX_TIMEOUT_MAX_MS);

Expand Down
3 changes: 2 additions & 1 deletion esp32/lte/lteppp.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
DEFINE TYPES
******************************************************************************/
typedef enum {
E_LTE_INIT = 0,
E_LTE_DEINIT = 0,
E_LTE_INIT,
E_LTE_IDLE,
E_LTE_ATTACHING,
E_LTE_ATTACHED,
Expand Down
9 changes: 2 additions & 7 deletions esp32/mods/modlte.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,12 +355,7 @@ static mp_obj_t lte_init_helper(lte_obj_t *self, const mp_arg_val_t *args) {
if (!lte_push_at_command("AT", LTE_RX_TIMEOUT_MAX_MS)) {
lte_pause_ppp();
}
// disable PSM if enabled by default
lte_push_at_command("AT+CPSMS?", LTE_RX_TIMEOUT_MAX_MS);
if (!strstr(modlte_rsp.data, "+CPSMS: 0")) {
lte_push_at_command("AT+CPSMS=0", LTE_RX_TIMEOUT_MIN_MS);
}


lte_push_at_command("AT!=\"setlpm airplane=1 enable=1\"", LTE_RX_TIMEOUT_MIN_MS);
lte_push_at_command("AT+CFUN?", LTE_RX_TIMEOUT_MIN_MS);
if (strstr(modlte_rsp.data, "+CFUN: 0")) {
Expand Down Expand Up @@ -469,7 +464,7 @@ STATIC mp_obj_t lte_deinit(mp_uint_t n_args, const mp_obj_t *pos_args, mp_map_t
}
if (!args[0].u_bool || !args[2].u_bool) { /* backward compatibility for dettach method FIXME */
vTaskDelay(100);
lte_push_at_command("AT!=\"setlpm airplane=1 enable=1\"", LTE_RX_TIMEOUT_MAX_MS);
// lte_push_at_command("AT!=\"setlpm airplane=1 enable=1\"", LTE_RX_TIMEOUT_MAX_MS);
lteppp_deinit();
lte_obj.init = false;
vTaskDelay(100);
Expand Down