From 56c3ebc4e706009d67c06a300abdcaa288e3bc29 Mon Sep 17 00:00:00 2001 From: Omar Chebib Date: Tue, 1 Mar 2022 16:06:41 +0800 Subject: [PATCH] Sleep: fix wrong debug level Fix usage of ESP_LOGD in sleep_modes.c which triggers a panic when used in debug log level. --- components/esp32/sleep_modes.c | 9 +++++---- components/esp32s2beta/sleep_modes.c | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/components/esp32/sleep_modes.c b/components/esp32/sleep_modes.c index b3fefd3b84..fc3f96fd15 100644 --- a/components/esp32/sleep_modes.c +++ b/components/esp32/sleep_modes.c @@ -681,10 +681,11 @@ static uint32_t get_power_down_flags(void) } const char* option_str[] = {"OFF", "ON", "AUTO(OFF)" /* Auto works as OFF */}; - ESP_LOGD(TAG, "RTC_PERIPH: %s, RTC_SLOW_MEM: %s, RTC_FAST_MEM: %s", - option_str[s_config.pd_options[ESP_PD_DOMAIN_RTC_PERIPH]], - option_str[s_config.pd_options[ESP_PD_DOMAIN_RTC_SLOW_MEM]], - option_str[s_config.pd_options[ESP_PD_DOMAIN_RTC_FAST_MEM]]); + /* This function is called from a critical section, log with ESP_EARLY_LOGD. */ + ESP_EARLY_LOGD(TAG, "RTC_PERIPH: %s, RTC_SLOW_MEM: %s, RTC_FAST_MEM: %s", + option_str[s_config.pd_options[ESP_PD_DOMAIN_RTC_PERIPH]], + option_str[s_config.pd_options[ESP_PD_DOMAIN_RTC_SLOW_MEM]], + option_str[s_config.pd_options[ESP_PD_DOMAIN_RTC_FAST_MEM]]); // Prepare flags based on the selected options uint32_t pd_flags = 0; diff --git a/components/esp32s2beta/sleep_modes.c b/components/esp32s2beta/sleep_modes.c index 3c25a2c5d6..56db237ce2 100644 --- a/components/esp32s2beta/sleep_modes.c +++ b/components/esp32s2beta/sleep_modes.c @@ -652,10 +652,11 @@ static uint32_t get_power_down_flags(void) } const char* option_str[] = {"OFF", "ON", "AUTO(OFF)" /* Auto works as OFF */}; - ESP_LOGD(TAG, "RTC_PERIPH: %s, RTC_SLOW_MEM: %s, RTC_FAST_MEM: %s", - option_str[s_config.pd_options[ESP_PD_DOMAIN_RTC_PERIPH]], - option_str[s_config.pd_options[ESP_PD_DOMAIN_RTC_SLOW_MEM]], - option_str[s_config.pd_options[ESP_PD_DOMAIN_RTC_FAST_MEM]]); + /* This function is called from a critical section, log with ESP_EARLY_LOGD. */ + ESP_EARLY_LOGD(TAG, "RTC_PERIPH: %s, RTC_SLOW_MEM: %s, RTC_FAST_MEM: %s", + option_str[s_config.pd_options[ESP_PD_DOMAIN_RTC_PERIPH]], + option_str[s_config.pd_options[ESP_PD_DOMAIN_RTC_SLOW_MEM]], + option_str[s_config.pd_options[ESP_PD_DOMAIN_RTC_FAST_MEM]]); // Prepare flags based on the selected options uint32_t pd_flags = 0;