gcode: Minor change to make M220 command take effect immediately (#1000)

This makes M220 (change print speed) command effect the next move command (G0/G1).
Before it only made a differenc once a G0/G1 command with an F parameter was executed.

Signed-off-by: Pontus Borg <liquidpontus@yahoo.se>
This commit is contained in:
bondus 2019-01-02 23:41:35 +01:00 committed by KevinOConnor
parent 1be24b8fc7
commit f4d323adbc
1 changed files with 2 additions and 2 deletions

View File

@ -491,14 +491,14 @@ class GCodeParser:
# value relative to base coordinate position # value relative to base coordinate position
self.last_position[3] = v + self.base_position[3] self.last_position[3] = v + self.base_position[3]
if 'F' in params: if 'F' in params:
speed = float(params['F']) * self.speed_factor speed = float(params['F'])
if speed <= 0.: if speed <= 0.:
raise error("Invalid speed in '%s'" % (params['#original'],)) raise error("Invalid speed in '%s'" % (params['#original'],))
self.speed = speed self.speed = speed
except ValueError as e: except ValueError as e:
raise error("Unable to parse move '%s'" % (params['#original'],)) raise error("Unable to parse move '%s'" % (params['#original'],))
try: try:
self.move_with_transform(self.last_position, self.speed) self.move_with_transform(self.last_position, self.speed * self.speed_factor)
except homing.EndstopError as e: except homing.EndstopError as e:
raise error(str(e)) raise error(str(e))
def cmd_G4(self, params): def cmd_G4(self, params):