Open maxim-kukushkin opened 4 years ago
Any chance for this PR to get reviewed and merged?
@tyhenry, would you be able to have a look at this PR and indicate if it's something that can be merged eventually? If the repo is not maintained any longer, may be a respective note can be added to the Readme.md?
Addressing #3
The restarts only happen on ESP devices and in case a long rotation is requested. The rotation is done by invocation of
step()
function in a loop, which ultimately does pin setup anddelayMicroseconds
. The latter one doesn't return the control back to the system (unlikedelay()
) sp the entire rotation happens in one solid execution. This is not a problem for an AVR, however on ESP (which has a network stack running in background) long runs without returning control back to the system cause watch dog to kick in and do a soft reset of the device.In order to prevent such behavior, this PR adds invocation of
yield()
between performin the motor steps (gives a quick control back to the system).The motor worked 360 degrees CW and CCW without restart with this change. The rotation speed visually wasn't affected. Returning control to the system is required for a reason, so perhaps there might be situations when the system actually starts doing some work and it will affect the motor performance, but it might be a matter for a bigger change. So far this PR should provide a reasonable relief, so that the library can be used on ESP devices