mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-05-22 01:27:11 +08:00
fix(sleep): fix enter light sleep mode error
This commit is contained in:
@ -162,11 +162,16 @@ void esp_sleep_start(void)
|
||||
uart_tx_wait_idle(0);
|
||||
uart_tx_wait_idle(1);
|
||||
|
||||
int slept = 0;
|
||||
int cpu_wait = 1;
|
||||
pm_soc_clk_t clk;
|
||||
const esp_irqflag_t irqflag = soc_save_local_irq();
|
||||
const uint32_t wdevflag = save_local_wdev();
|
||||
|
||||
if (s_lock_cnt) {
|
||||
cpu_wait = 0;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
save_soc_clk(&clk);
|
||||
|
||||
const uint32_t sleep_us = min_sleep_us(&clk);
|
||||
@ -184,13 +189,14 @@ void esp_sleep_start(void)
|
||||
|
||||
update_soc_clk(&clk, sleep_us);
|
||||
|
||||
slept = 1;
|
||||
cpu_wait = 0;
|
||||
}
|
||||
}
|
||||
|
||||
exit:
|
||||
restore_local_wdev(wdevflag);
|
||||
soc_restore_local_irq(irqflag);
|
||||
|
||||
if (!slept)
|
||||
if (cpu_wait)
|
||||
soc_wait_int();
|
||||
}
|
||||
|
Reference in New Issue
Block a user