Avoid division by zero during estimation

master
Kliment Yanev 2012-01-07 19:50:54 +01:00
parent 9274f05694
commit 2a20f67eba
1 changed files with 1 additions and 1 deletions

View File

@ -142,7 +142,7 @@ def estimate_duration(g):
currenttravel = hypot3d(x, y, z, lastx, lasty, lastz)
distance = 2* ((lastf+f) * (f-lastf) * 0.5 ) / acceleration #2x because we have to accelerate and decelerate
if distance <= currenttravel:
if distance <= currenttravel and ( lastf + f )!=0 and f!=0:
moveduration = 2 * distance / ( lastf + f )
currenttravel -= distance
moveduration += currenttravel/f