gcode: Log g-code error responses

Be sure to log g-code errors even if debug logging is not enabled.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2017-07-17 11:24:15 -04:00
parent 3ac60b31a2
commit 12ca45a264
1 changed files with 3 additions and 2 deletions

View File

@ -152,14 +152,15 @@ class GCodeParser:
os.write(self.fd, "ok\n") os.write(self.fd, "ok\n")
self.need_ack = False self.need_ack = False
def respond(self, msg): def respond(self, msg):
logging.debug(msg)
if self.is_fileinput: if self.is_fileinput:
return return
os.write(self.fd, msg+"\n") os.write(self.fd, msg+"\n")
def respond_info(self, msg): def respond_info(self, msg):
logging.debug(msg)
lines = [l.strip() for l in msg.strip().split('\n')] lines = [l.strip() for l in msg.strip().split('\n')]
self.respond("// " + "\n// ".join(lines)) self.respond("// " + "\n// ".join(lines))
def respond_error(self, msg): def respond_error(self, msg):
logging.warning(msg)
lines = msg.strip().split('\n') lines = msg.strip().split('\n')
if len(lines) > 1: if len(lines) > 1:
self.respond_info("\n".join(lines[:-1])) self.respond_info("\n".join(lines[:-1]))
@ -250,7 +251,7 @@ class GCodeParser:
# Tn command has to be handled specially # Tn command has to be handled specially
self.cmd_Tn(params) self.cmd_Tn(params)
return return
self.respond('echo:Unknown command:"%s"' % (cmd,)) self.respond_info('Unknown command:"%s"' % (cmd,))
def cmd_Tn(self, params): def cmd_Tn(self, params):
# Select Tool # Select Tool
index = self.get_int('T', params) index = self.get_int('T', params)