mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-23 22:54:10 -06:00
respond: An extra for sending messages to the printer host. (#1053)
I have made one change to `gcode.py` to support quoted parameter values. I have added support for the basic `M118` command (see https://reprap.org/wiki/G-code#M118:_Echo_message_on_host). I have also added a `RESPOND` command that takes extended parameters. `ECHO` might be a better name than `RESPOND` but is already defined in `gcode.py`. Signed-off-by: Alec B. Plumb <alec@etherwalker.com>
This commit is contained in:
parent
f6c9150349
commit
59e9b6562f
4 changed files with 81 additions and 2 deletions
|
@ -3,7 +3,7 @@
|
|||
# Copyright (C) 2016-2018 Kevin O'Connor <kevin@koconnor.net>
|
||||
#
|
||||
# This file may be distributed under the terms of the GNU GPLv3 license.
|
||||
import os, re, logging, collections
|
||||
import os, re, logging, collections, shlex
|
||||
import homing, kinematics.extruder
|
||||
|
||||
class error(Exception):
|
||||
|
@ -356,7 +356,7 @@ class GCodeParser:
|
|||
return params
|
||||
eargs = m.group('args')
|
||||
try:
|
||||
eparams = [earg.split('=', 1) for earg in eargs.split()]
|
||||
eparams = [earg.split('=', 1) for earg in shlex.split(eargs)]
|
||||
eparams = { k.upper(): v for k, v in eparams }
|
||||
eparams.update({k: params[k] for k in params if k.startswith('#')})
|
||||
return eparams
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue