gcode: Check for invalid speeds
Raise an error if the move speed is set to a zero or negative value. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
253517096e
commit
c9d21574d8
|
@ -255,7 +255,10 @@ class GCodeParser:
|
||||||
# value relative to base coordinate position
|
# value relative to base coordinate position
|
||||||
self.last_position[p] = v + self.base_position[p]
|
self.last_position[p] = v + self.base_position[p]
|
||||||
if 'F' in params:
|
if 'F' in params:
|
||||||
self.speed = float(params['F']) / 60.
|
speed = float(params['F']) / 60.
|
||||||
|
if speed <= 0.:
|
||||||
|
raise ValueError()
|
||||||
|
self.speed = speed
|
||||||
except ValueError, e:
|
except ValueError, e:
|
||||||
self.last_position = self.toolhead.get_position()
|
self.last_position = self.toolhead.get_position()
|
||||||
raise error("Unable to parse move '%s'" % (params['#original'],))
|
raise error("Unable to parse move '%s'" % (params['#original'],))
|
||||||
|
|
Loading…
Reference in New Issue