stepper: Make toggling the step gpio after timer read conditional

On the Linux mcu, toggling the pin after the time is read is not
valid.  Make that optimization dependent on CONFIG_HAVE_STRICT_TIMING.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2020-05-25 00:32:12 -04:00
parent 835ec3513d
commit 98192d710f
1 changed files with 5 additions and 1 deletions

View File

@ -154,8 +154,12 @@ stepper_event(struct timer *t)
return stepper_event_nodelay(s);
// Normal step code - schedule the unstep event
if (!CONFIG_HAVE_STRICT_TIMING)
gpio_out_toggle_noirq(s->step_pin);
uint32_t step_delay = timer_from_us(CONFIG_STEP_DELAY);
uint32_t min_next_time = timer_read_time() + step_delay;
if (CONFIG_HAVE_STRICT_TIMING)
// Toggling gpio after reading the time is a micro-optimization
gpio_out_toggle_noirq(s->step_pin);
s->count--;
if (likely(s->count & 1))