Skip to content

Commit

Permalink
Merge pull request #79 from ramboerik/fix-stm32f4-too-long-first-pulse
Browse files Browse the repository at this point in the history
Fix first pulse being too long as the pulse's interval wasn't loaded …
  • Loading branch information
luni64 authored Oct 9, 2020
2 parents 0e9d47d + cfb50b0 commit 57e532f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/timer/stm32/TimerField.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ TimerField::TimerField(TeensyStep::TF_Handler *_handler) :
void TimerField::stepTimerStart()
{
stepTimer.resume();
// force reload of all timer's registers here saves 1.2ms in startup time
// https://github.com/stm32duino/wiki/wiki/HardwareTimer-library
// Force update on the step timer registers as it might be slow(>50ms sometimes) to start otherwise.
stepTimer.refresh();
stepTimerRunning = true;
}
Expand Down Expand Up @@ -109,6 +108,9 @@ void TimerField::setStepFrequency(unsigned f)

bool TimerField::begin()
{
stepTimer.setPreloadEnable(false);
accTimer.setPreloadEnable(false);
pulseTimer.setPreloadEnable(false);
return true;
}

Expand Down

0 comments on commit 57e532f

Please sign in to comment.