Skip to content

Commit

Permalink
Fix for numbered lines
Browse files Browse the repository at this point in the history
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
  • Loading branch information
pedrolamas committed Oct 14, 2021
1 parent 8e40d42 commit a0be333
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 17 deletions.
10 changes: 1 addition & 9 deletions klippy/extras/display_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,7 @@ def cmd_M73(self, gcmd):
curtime = self.printer.get_reactor().monotonic()
self.expire_progress = curtime + M73_TIMEOUT
def cmd_M117(self, gcmd):
msg = gcmd.get_commandline()
umsg = msg.upper()
if not umsg.startswith('M117'):
# Parse out additional info if M117 recd during a print
start = umsg.find('M117')
end = msg.rfind('*')
if end >= 0:
msg = msg[:end]
msg = msg[start:]
msg = gcmd.get_sanitizedcommandline()
if len(msg) > 5:
self.message = msg[5:]
else:
Expand Down
2 changes: 1 addition & 1 deletion klippy/extras/gcode_macro.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def cmd(self, gcmd):
if self.in_script:
raise gcmd.error("Macro %s called recursively" % (self.alias,))
params = gcmd.get_command_parameters()
commandline = gcmd.get_commandline()
commandline = gcmd.get_sanitizedcommandline()
kwparams = dict(self.kwparams)
kwparams.update(params)
kwparams.update(self.variables)
Expand Down
8 changes: 1 addition & 7 deletions klippy/extras/respond.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,7 @@ def __init__(self, config):
gcode.register_command('RESPOND', self.cmd_RESPOND, True,
desc=self.cmd_RESPOND_help)
def cmd_M118(self, gcmd):
msg = gcmd.get_commandline()
umsg = msg.upper()
if not umsg.startswith('M118'):
# Parse out additional info if M118 recd during a print
start = umsg.find('M118')
end = msg.rfind('*')
msg = msg[start:end]
msg = gcmd.get_sanitizedcommandline()
if len(msg) > 5:
msg = msg[5:]
else:
Expand Down
4 changes: 4 additions & 0 deletions klippy/gcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ class GCodeCommand:
def __init__(self, gcode, command, commandline, params, need_ack):
self._command = command
self._commandline = commandline
self._sanitizedcommandline = self.commandline_r.sub(
r'\1', commandline).strip()
self._params = params
self._need_ack = need_ack
# Method wrappers
Expand All @@ -24,6 +26,8 @@ def get_command(self):
return self._command
def get_commandline(self):
return self._commandline
def get_sanitizedcommandline(self):
return self._sanitizedcommandline
def get_command_parameters(self):
return self._params
def ack(self, msg=None):
Expand Down

0 comments on commit a0be333

Please sign in to comment.