Skip to content

Commit

Permalink
Merge pull request #567 from Paciente8159/566-bug-esp32-running-at-ha…
Browse files Browse the repository at this point in the history
…lf-the-steprate

fixed ESP32 step rate with emulated PWM
  • Loading branch information
Paciente8159 authored Nov 14, 2023
2 parents f181f35 + 289da86 commit f1e974b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions uCNC/src/hal/mcus/esp32/mcu_esp32.c
Original file line number Diff line number Diff line change
Expand Up @@ -739,7 +739,7 @@ void mcu_freq_to_clocks(float frequency, uint16_t *ticks, uint16_t *prescaller)
#ifndef IC74HC595_HAS_PWMS
uint32_t totalticks = (uint32_t)(500000.0f / frequency);
#else
uint32_t totalticks = (uint32_t)(125000.0f / frequency);
uint32_t totalticks = (uint32_t)(62500.0f / frequency);
#endif
*prescaller = 1;
while (totalticks > 0xFFFF)
Expand All @@ -756,7 +756,7 @@ float mcu_clocks_to_freq(uint16_t ticks, uint16_t prescaller)
#ifndef IC74HC595_HAS_PWMS
return (500000.0f / ((float)ticks * (float)prescaller));
#else
return (125000.0f / ((float)ticks * (float)prescaller));
return (62500.0f / ((float)ticks * (float)prescaller));
#endif
}

Expand Down

0 comments on commit f1e974b

Please sign in to comment.