aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--docs/Config_Changes.md6
-rw-r--r--klippy/gcode.py12
2 files changed, 11 insertions, 7 deletions
diff --git a/docs/Config_Changes.md b/docs/Config_Changes.md
index 5535dc85..ecac5a7a 100644
--- a/docs/Config_Changes.md
+++ b/docs/Config_Changes.md
@@ -8,6 +8,12 @@ All dates in this document are approximate.
## Changes
+20241201: In some cases Klipper may have ignored leading characters or
+spaces in a traditional G-Code command. For example, "99M123" may have
+been interpreted as "M123" and "M 321" may have been interpreted as
+"M321". Klipper will now report these cases with an "Unknown command"
+warning.
+
20241112: Option `CHIPS=<chip_name>` in `TEST_RESONANCES` and
`SHAPER_CALIBRATE` requires specifying the full name(s) of the accel
chip(s). For example, `adxl345 rpi` instead of short name - `rpi`.
diff --git a/klippy/gcode.py b/klippy/gcode.py
index ee2a09d9..8a6b3b8d 100644
--- a/klippy/gcode.py
+++ b/klippy/gcode.py
@@ -198,16 +198,14 @@ class GCodeDispatch:
line = line[:cpos]
# Break line into parts and determine command
parts = self.args_r.split(line.upper())
- numparts = len(parts)
- cmd = ""
- if numparts >= 3 and parts[1] != 'N':
- cmd = parts[1] + parts[2].strip()
- elif numparts >= 5 and parts[1] == 'N':
+ if ''.join(parts[:2]) == 'N':
# Skip line number at start of command
- cmd = parts[3] + parts[4].strip()
+ cmd = ''.join(parts[3:5]).strip()
+ else:
+ cmd = ''.join(parts[:3]).strip()
# Build gcode "params" dictionary
params = { parts[i]: parts[i+1].strip()
- for i in range(1, numparts, 2) }
+ for i in range(1, len(parts), 2) }
gcmd = GCodeCommand(self, cmd, origline, params, need_ack)
# Invoke handler for command
handler = self.gcode_handlers.get(cmd, self.cmd_default)