fix(bt/controller): Fixed the timeout of wake up timer when using RC OSC

(cherry picked from commit 873708579c99069d073f3d6c7ba6db154cbf16b9)

Co-authored-by: chenjianhua <chenjianhua@espressif.com>
This commit is contained in:
Chen Jian Hua 2024-09-27 18:33:16 +08:00
parent 4b666f74ff
commit 5bf4347ad9

View File

@ -807,7 +807,8 @@ static void btdm_sleep_enter_phase1_wrapper(uint32_t lpcycles)
// allow a maximum time uncertainty to be about 488ppm(1/2048) at least as clock drift
// and set the timer in advance
uint32_t uncertainty = (us_to_sleep >> 11);
#if CONFIG_FREERTOS_USE_TICKLESS_IDLE
#if CONFIG_BT_CTRL_MAIN_XTAL_PU_DURING_LIGHT_SLEEP
// recalculate clock drift when Bluetooth using main XTAL during light sleep
if (rtc_clk_slow_src_get() == SOC_RTC_SLOW_CLK_SRC_RC_SLOW) {
uncertainty = us_to_sleep * BTDM_RTC_SLOW_CLK_RC_DRIFT_PERCENT / 100;
}