Skip to content

Conversation

@maxim-kukushkin
Copy link

@maxim-kukushkin maxim-kukushkin commented Jun 20, 2020

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 and delayMicroseconds. The latter one doesn't return the control back to the system (unlike delay()) 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

@maxim-kukushkin
Copy link
Author

Any chance for this PR to get reviewed and merged?

@maxim-kukushkin
Copy link
Author

@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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants