mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-01 19:54:32 +02:00
bugfix(ledc): fix integer divided by zero in function ledc_set_fade_with_time
This commit is contained in:
@@ -514,6 +514,9 @@ esp_err_t ledc_set_fade_with_time(ledc_mode_t speed_mode, ledc_channel_t channel
|
|||||||
return ESP_OK;
|
return ESP_OK;
|
||||||
}
|
}
|
||||||
int total_cycles = max_fade_time_ms * freq / 1000;
|
int total_cycles = max_fade_time_ms * freq / 1000;
|
||||||
|
if (total_cycles == 0) {
|
||||||
|
return ledc_set_duty(speed_mode, channel, target_duty);
|
||||||
|
}
|
||||||
int scale, cycle_num;
|
int scale, cycle_num;
|
||||||
if (total_cycles > duty_delta) {
|
if (total_cycles > duty_delta) {
|
||||||
scale = 1;
|
scale = 1;
|
||||||
|
Reference in New Issue
Block a user