bugfix(ledc):fix pwm duty setting error

This commit is contained in:
espressif
2020-05-08 19:09:44 +08:00
parent dd9c36619e
commit d1fc18d31d

View File

@ -203,7 +203,6 @@ esp_err_t ledc_fade_up(ledc_channel_t channel, uint8_t* flag)
p_ledc_obj[channel]->duty_p += duty_value;
}
pwm_set_duty(channel, p_ledc_obj[channel]->duty_p);
pwm_start();
i[channel]++;
if (i[channel] == 100) {
i[channel] = 0;
@ -235,7 +234,6 @@ esp_err_t ledc_fade_down(ledc_channel_t channel, uint8_t* flag)
p_ledc_obj[channel]->duty_p -= duty_value;
}
pwm_set_duty(channel, p_ledc_obj[channel]->duty_p);
pwm_start();
i[channel]++;
if (i[channel] == 100) {
i[channel] = 0;
@ -270,6 +268,7 @@ static void ledc_task(void* pvParameters)
}
}
}
pwm_start();
xTaskResumeAll();
vTaskDelay(LEDC_STEP_TIME / portTICK_PERIOD_MS);
}