diff --git a/components/esp_hw_support/sleep_modes.c b/components/esp_hw_support/sleep_modes.c index 989934c98e..01d82d9694 100644 --- a/components/esp_hw_support/sleep_modes.c +++ b/components/esp_hw_support/sleep_modes.c @@ -8,6 +8,7 @@ #include #include #include +#include #include "esp_attr.h" #include "esp_rom_caps.h" @@ -273,7 +274,6 @@ static portMUX_TYPE spinlock_rtc_deep_sleep = portMUX_INITIALIZER_UNLOCKED; static const char *TAG = "sleep"; static RTC_FAST_ATTR int32_t s_sleep_sub_mode_ref_cnt[ESP_SLEEP_MODE_MAX] = { 0 }; //in this mode, 2uA is saved, but RTC memory can't use at high temperature, and RTCIO can't be used as INPUT. -static bool s_ultra_low_enabled = false; static bool s_periph_use_8m_flag = false; @@ -904,7 +904,8 @@ static esp_err_t IRAM_ATTR esp_sleep_start(uint32_t pd_flags, esp_sleep_mode_t m if (s_sleep_sub_mode_ref_cnt[ESP_SLEEP_USE_ADC_TESEN_MONITOR_MODE]) { sleep_flags |= RTC_SLEEP_USE_ADC_TESEN_MONITOR; } - if (!s_ultra_low_enabled) { + + if (s_sleep_sub_mode_ref_cnt[ESP_SLEEP_ULTRA_LOW_MODE] == 0) { sleep_flags |= RTC_SLEEP_NO_ULTRA_LOW; } if (periph_using_8m) { diff --git a/components/esp_hw_support/test_apps/rtc_power_modes/main/test_rtc_power.c b/components/esp_hw_support/test_apps/rtc_power_modes/main/test_rtc_power.c index 3e5201a65d..2904ec2efd 100644 --- a/components/esp_hw_support/test_apps/rtc_power_modes/main/test_rtc_power.c +++ b/components/esp_hw_support/test_apps/rtc_power_modes/main/test_rtc_power.c @@ -49,9 +49,7 @@ TEST_CASE("Power Test: DSLP_DEFAULT", "[pm]") TEST_CASE("Power Test: DSLP_ULTRA_LOW", "[pm]") { esp_sleep_sub_mode_config(ESP_SLEEP_USE_ADC_TESEN_MONITOR_MODE, false); //This is the default option. Add this line to avoid the case executing this case directly after the DSLP_8MD256 case. - - extern void rtc_sleep_enable_ultra_low(bool); - rtc_sleep_enable_ultra_low(true); + esp_sleep_sub_mode_config(ESP_SLEEP_ULTRA_LOW_MODE, true); test_deepsleep(); }