clearwater / SwitecX25

Arduino library for Switec X25.168 and friends
http://clearwater.github.com/gaugette/
Other
128 stars 44 forks source link

update the time0 variable at the end of advance() #6

Closed jboecker closed 8 years ago

jboecker commented 8 years ago

The advance() function updates the time0 variable and then sets the output pins to the corresponding state for the next step. If an interrupt service routine gets executed after time0 has been updated but before all pins have been set correctly, the duration of the next state will be shortened by the time it took to service the interrupt. This can result in missed steps.

This change moves the update of the time0 variable to the end of advance(). This errs on the side of longer instead of shorter delays when interrupts are handled while advance() is being executed.

clearwater commented 8 years ago

👍 nice work, thanks.