Skip to content

Commit 97abb54

Browse files
committed
Update esp32_ledc_mcu.cpp to ensure ledc_timer is initialised to a known state (ledc_timer = false)
1 parent c72f063 commit 97abb54

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/drivers/hardware_specific/esp32/esp32_ledc_mcu.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ bool _ledcAttachChannelAdvanced(uint8_t pin, int _channel, int _group, uint32_t
7676

7777
ledc_timer_bit_t res = static_cast<ledc_timer_bit_t>(resolution);
7878
ledc_timer_config_t ledc_timer;
79+
memset(&ledc_timer, 0, sizeof(ledc_timer));
7980
ledc_timer.speed_mode = group;
8081
ledc_timer.timer_num = LEDC_TIMER_0;
8182
ledc_timer.duty_resolution = res;
@@ -401,4 +402,4 @@ void _writeDutyCycle6PWM(float dc_a, float dc_b, float dc_c, PhaseState *phase
401402
_setPwmPairDutyCycle(params, 4, 5, dc_c, ((ESP32LEDCDriverParams*)params)->dead_zone, phase_state[2]);
402403
}
403404

404-
#endif
405+
#endif

0 commit comments

Comments
 (0)