From f6e9db2d05e5550180ae394d2da519d37740e780 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Fri, 21 Jun 2019 12:28:58 -0400 Subject: [PATCH] toolhead: Just warn if M204 doesn't contain valid S, P, or T Signed-off-by: Kevin O'Connor --- klippy/toolhead.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/klippy/toolhead.py b/klippy/toolhead.py index 64790130..ef9368fc 100644 --- a/klippy/toolhead.py +++ b/klippy/toolhead.py @@ -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()