Skip to content

Commit f97f890

Browse files
authored
Update hardware_utils.cpp
1 parent fb55b83 commit f97f890

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/common/hardware_utils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ void _setPwmFrequency(long pwm_frequency,const int pinA, const int pinB, const i
139139
if(pinD != NOT_SET) _setHighFrequency(pwm_frequency, pinD); // stepper motor
140140

141141
#elif defined(ESP_H) // if esp32 boards
142-
if(pwm_frequency == NOT_SET) pwm_frequency = 40000; // default frequency 20khz
143-
else pwm_frequency = constrain(pwm_frequency, 0, 60000); // constrain to 30kHz max
142+
if(pwm_frequency == NOT_SET) pwm_frequency = 40000; // default frequency 20khz - centered pwm has twice lower frequency
143+
else pwm_frequency = constrain(2*pwm_frequency, 0, 60000); // constrain to 30kHz max - centered pwm has twice lower frequency
144144

145145
if(pinD == NOT_SET){
146146
bldc_motor_slots_t m_slot = {};

0 commit comments

Comments
 (0)