Merge branch 'bugfix/crash_on_enabling_verbose_logs_v4.0' into 'release/v4.0'

esp_wifi: Fixes issue of crashing when verbose logs are enabled (v4.0)

See merge request espressif/esp-idf!12493
This commit is contained in:
Jiang Jiang Jian 2021-03-23 03:05:28 +00:00
commit d3fa4c3749

View File

@ -1147,34 +1147,24 @@ static esp_err_t adc_set_atten(adc_unit_t adc_unit, adc_channel_t channel, adc_a
void adc_power_acquire()
{
bool powered_on = false;
portENTER_CRITICAL(&rtc_spinlock);
s_adc_power_on_cnt++;
if (s_adc_power_on_cnt == 1) {
adc_power_on_internal();
powered_on = true;
}
portEXIT_CRITICAL(&rtc_spinlock);
if (powered_on) {
ESP_LOGV(TAG, "%s: ADC powered on", __func__);
}
}
void adc_power_release(void)
{
bool powered_off = false;
portENTER_CRITICAL(&rtc_spinlock);
s_adc_power_on_cnt--;
if (s_adc_power_on_cnt < 0) {
portEXIT_CRITICAL(&rtc_spinlock);
} else if (s_adc_power_on_cnt == 0) {
adc_power_off_internal();
powered_off = true;
}
portEXIT_CRITICAL(&rtc_spinlock);
if (powered_off) {
ESP_LOGV(TAG, "%s: ADC powered off", __func__);
}
}
static void adc_power_on_internal(void)