toolhead: Just warn if M204 doesn't contain valid S, P, or T

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2019-06-21 12:28:58 -04:00
parent 98915fb1d0
commit f6e9db2d05
1 changed files with 7 additions and 3 deletions

View File

@ -467,13 +467,17 @@ class ToolHead:
gcode.respond_info(msg, log=False)
def cmd_M204(self, params):
gcode = self.printer.lookup_object('gcode')
if 'P' in params and 'T' in params and 'S' not in params:
if 'S' in params:
# Use S for accel
accel = gcode.get_float('S', params, above=0.)
elif 'P' in params and 'T' in params:
# Use minimum of P and T for accel
accel = min(gcode.get_float('P', params, above=0.),
gcode.get_float('T', params, above=0.))
else:
# Use S for accel
accel = gcode.get_float('S', params, above=0.)
gcode.respond_info('Invalid M204 command "%s"'
% (params['#original'],))
return
self.max_accel = min(accel, self.config_max_accel)
self._calc_junction_deviation()