whitecatboard / Lua-RTOS-ESP32

Lua RTOS for ESP32
Other
1.19k stars 221 forks source link

stepper: timer divider out of range #266

Closed the0ne closed 4 years ago

the0ne commented 5 years ago

fixes the bug - confirmed to work

the0ne commented 5 years ago
/examples/lua > s1 = stepper.attach(pio.GPIO26, pio.GPIO14)
stepper0, at pins step=GPIO14, dir=GPIO26
/examples/lua > s1:move(10)
/examples/lua > stepper.start(s1)
/examples/lua > 
the0ne commented 5 years ago

Hi guys, I ask you some patient on this issue. I have to review some items, and adapt the internals using the Lua RTOS timer driver to ensure that the use of steppers haven't collisions with other Lua RTOS features that also use timers. In this review I will solve this issue. 2 or 3 days will be needed for that.

@jolivepetrus do you think it might make sense to commit this in the meantime? As it's only one number changed and has been tested successfully I think it could be better than the current state which throws an error.

jolivepetrus commented 5 years ago

@the0ne,

Need to check before merge.

the0ne commented 5 years ago

@jolivepetrus looks like we got confirmation it works =) See https://github.com/whitecatboard/Lua-RTOS-ESP32/issues/288#issuecomment-515698296

After change config.devider from 1 to 2 with reference to pr262 I can confirm the amounts of steps are correct. Also the timing seems to be correct.

The stepper motor stops after 10 revolutions and 10 seconds exactly.

the0ne commented 4 years ago

@jolivepetrus please note that without this fix, the stepper currently can't work for anybody

the documentation is clear on the fact that 1 is not a valid divider: /* Counter clock divider. The divider's range is from from 2 to 65536. */

please note that user @ar055 has confirmed the stepper works again with the fix included.