Fixed bug in ledc_set_fade_with_step where returned while holding critical section.

Merges PR #515 https://github.com/espressif/esp-idf/pull/515
This commit is contained in:
Jonathan Kaufmann 2017-04-12 18:23:32 -05:00 committed by Angus Gratton
parent 793003d0fa
commit bf82b441ae

View File

@ -541,6 +541,7 @@ esp_err_t ledc_set_fade_with_step(ledc_mode_t speed_mode, ledc_channel_t channel
int duty_cur = LEDC.channel_group[speed_mode].channel[channel].duty_rd.duty_read >> LEDC_DUTY_DECIMAL_BIT_NUM; int duty_cur = LEDC.channel_group[speed_mode].channel[channel].duty_rd.duty_read >> LEDC_DUTY_DECIMAL_BIT_NUM;
int duty_delta = target_duty > duty_cur ? target_duty - duty_cur : duty_cur - target_duty; int duty_delta = target_duty > duty_cur ? target_duty - duty_cur : duty_cur - target_duty;
if (duty_delta == 0) { if (duty_delta == 0) {
portEXIT_CRITICAL(&ledc_spinlock);
return ESP_OK; return ESP_OK;
} }
s_ledc_fade_rec[speed_mode][channel]->speed_mode = speed_mode; s_ledc_fade_rec[speed_mode][channel]->speed_mode = speed_mode;