Skip to content
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

Avoid divide by zero error in coordinated move() #322

Merged
merged 2 commits into from
Oct 23, 2017
Merged

Avoid divide by zero error in coordinated move() #322

merged 2 commits into from
Oct 23, 2017

Conversation

blurfl
Copy link
Collaborator

@blurfl blurfl commented Oct 22, 2017

Division of two floats can be truncated to zero if cast as a long. finalNmberOfSteps is used as a denominator in subsequent calculations.
This corrects issue #321.

Division of two floats can be truncated to zero if cast as a long. finalNmberOfSteps is used as a denominator in subsequent calculations.
 This corrects issue #321.
@@ -446,7 +446,7 @@ int cordinatedMove(const float& xEnd, const float& yEnd, const float& zEnd, fl
//compute feed details
MMPerMin = constrain(MMPerMin, 1, MAXFEED); //constrain the maximum feedrate, 35ipm = 900 mmpm
float stepSizeMM = computeStepSize(MMPerMin);
long finalNumberOfSteps = abs(distanceToMoveInMM/stepSizeMM);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 👍

@BarbourSmith BarbourSmith merged commit 0e10eab into MaslowCNC:master Oct 23, 2017
@BarbourSmith
Copy link
Member

Great catch! That's a tricky one. This is your second really good tricky bug in a row @blurfl . Awesome job
👍 👍 👍

@blurfl blurfl deleted the avoid-divide-by-zero-error-in-coordinatedMove() branch October 26, 2017 01:54
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