Skip to content

Stepper: avoid division by zero #4318

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Stepper: avoid division by zero #4318

wants to merge 1 commit into from

Conversation

kennethlimcp
Copy link

Check for inputs of 0 and set it to 1 as the minimum

Was added here for Particle devices: https://github.com/kennethlimcp/spark-stepper/pull/2

Signed-off-by: Kenneth Lim kennethlimcp@gmail.com

Check for inputs of 0 and set it to 1 as the minimum

Signed-off-by: Kenneth Lim <kennethlimcp@gmail.com>
@matthijskooijman
Copy link
Collaborator

This PR touches on the same library as #4257, and IIRC there was some change to prevent zero division there as well. Since merging this one probably complicates merging that one, perhaps this commit could be included in that PR, or at least merged after it.

Looking at the actual commit, I'm wondering what the motivation for it is? Passing a 0 speed or number of steps doesn't make sense, so it's not a valid input. On AVR, I think division by zero doesn't actually trigger any exception, so no really special handling is needed, but perhaps that's different on the Particle devices (or arm devices in general)?

@facchinm facchinm changed the title lib: non-zero division Stepper: avoid division by zero Dec 21, 2015
@facchinm facchinm added the Library: Stepper The Stepper Arduino library label Dec 21, 2015
@kennethlimcp kennethlimcp deleted the lib/stepper branch September 24, 2017 13:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Library: Stepper The Stepper Arduino library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants