mirror of https://github.com/Desuuuu/klipper.git
gcode: Change respond_info() to log by default
It makes sense to log most respond_info() content, so do that by default. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
d62a41b930
commit
1731fbbca4
|
@ -118,7 +118,6 @@ class BLTouchEndstopWrapper:
|
||||||
if retry >= 2:
|
if retry >= 2:
|
||||||
raise
|
raise
|
||||||
msg = "Failed to verify BLTouch probe is raised; retrying."
|
msg = "Failed to verify BLTouch probe is raised; retrying."
|
||||||
logging.warning(msg)
|
|
||||||
self.gcode.respond_info(msg)
|
self.gcode.respond_info(msg)
|
||||||
self.next_cmd_time += RETRY_RESET_TIME
|
self.next_cmd_time += RETRY_RESET_TIME
|
||||||
continue
|
continue
|
||||||
|
@ -172,9 +171,7 @@ class BLTouchEndstopWrapper:
|
||||||
self.gcode.respond_info("BLTouch commands: %s" % (
|
self.gcode.respond_info("BLTouch commands: %s" % (
|
||||||
", ".join(sorted([c for c in Commands if c is not None]))))
|
", ".join(sorted([c for c in Commands if c is not None]))))
|
||||||
return
|
return
|
||||||
msg = "Sending BLTOUCH_DEBUG COMMAND=%s" % (cmd,)
|
self.gcode.respond_info("Sending BLTOUCH_DEBUG COMMAND=%s" % (cmd,))
|
||||||
self.gcode.respond_info(msg)
|
|
||||||
logging.info(msg)
|
|
||||||
self.sync_print_time()
|
self.sync_print_time()
|
||||||
self.send_cmd(cmd, duration=self.pin_move_time)
|
self.send_cmd(cmd, duration=self.pin_move_time)
|
||||||
self.send_cmd(None)
|
self.send_cmd(None)
|
||||||
|
|
|
@ -1457,7 +1457,8 @@ class MenuManager:
|
||||||
elif action == 'exit':
|
elif action == 'exit':
|
||||||
self.exit()
|
self.exit()
|
||||||
elif action == 'respond':
|
elif action == 'respond':
|
||||||
self.gcode.respond_info("{}".format(' '.join(map(str, args))))
|
self.gcode.respond_info("{}".format(' '.join(map(str, args))),
|
||||||
|
log=False)
|
||||||
elif action == 'event' and len(args) > 0:
|
elif action == 'event' and len(args) > 0:
|
||||||
if len(str(args[0])) > 0:
|
if len(str(args[0])) > 0:
|
||||||
self.printer.send_event(
|
self.printer.send_event(
|
||||||
|
@ -1530,11 +1531,9 @@ class MenuManager:
|
||||||
key1, key2,
|
key1, key2,
|
||||||
self.parameters[key1].get(key2)
|
self.parameters[key1].get(key2)
|
||||||
)
|
)
|
||||||
logging.info(msg)
|
|
||||||
self.gcode.respond_info(msg)
|
self.gcode.respond_info(msg)
|
||||||
else:
|
else:
|
||||||
msg = "{0} = {1}".format(key1, self.parameters.get(key1))
|
msg = "{0} = {1}".format(key1, self.parameters.get(key1))
|
||||||
logging.info(msg)
|
|
||||||
self.gcode.respond_info(msg)
|
self.gcode.respond_info(msg)
|
||||||
|
|
||||||
# buttons & encoder callbacks
|
# buttons & encoder callbacks
|
||||||
|
|
|
@ -280,15 +280,11 @@ class TMC2130:
|
||||||
gcode.respond_info("========== Write-only registers ==========")
|
gcode.respond_info("========== Write-only registers ==========")
|
||||||
for reg_name, val in self.regs.items():
|
for reg_name, val in self.regs.items():
|
||||||
if reg_name not in ReadRegisters:
|
if reg_name not in ReadRegisters:
|
||||||
msg = self.fields.pretty_format(reg_name, val)
|
gcode.respond_info(self.fields.pretty_format(reg_name, val))
|
||||||
logging.info(msg)
|
|
||||||
gcode.respond_info(msg)
|
|
||||||
gcode.respond_info("========== Queried registers ==========")
|
gcode.respond_info("========== Queried registers ==========")
|
||||||
for reg_name in ReadRegisters:
|
for reg_name in ReadRegisters:
|
||||||
val = self.get_register(reg_name)
|
val = self.get_register(reg_name)
|
||||||
msg = self.fields.pretty_format(reg_name, val)
|
gcode.respond_info(self.fields.pretty_format(reg_name, val))
|
||||||
logging.info(msg)
|
|
||||||
gcode.respond_info(msg)
|
|
||||||
cmd_INIT_TMC_help = "Initialize TMC stepper driver registers"
|
cmd_INIT_TMC_help = "Initialize TMC stepper driver registers"
|
||||||
def cmd_INIT_TMC(self, params):
|
def cmd_INIT_TMC(self, params):
|
||||||
logging.info("INIT_TMC 2130 %s", self.name)
|
logging.info("INIT_TMC 2130 %s", self.name)
|
||||||
|
|
|
@ -359,9 +359,7 @@ class TMC2208:
|
||||||
gcode.respond_info("========== Write-only registers ==========")
|
gcode.respond_info("========== Write-only registers ==========")
|
||||||
for reg_name, val in self.regs.items():
|
for reg_name, val in self.regs.items():
|
||||||
if reg_name not in ReadRegisters:
|
if reg_name not in ReadRegisters:
|
||||||
msg = self.fields.pretty_format(reg_name, val)
|
gcode.respond_info(self.fields.pretty_format(reg_name, val))
|
||||||
logging.info(msg)
|
|
||||||
gcode.respond_info(msg)
|
|
||||||
gcode.respond_info("========== Queried registers ==========")
|
gcode.respond_info("========== Queried registers ==========")
|
||||||
for reg_name in ReadRegisters:
|
for reg_name in ReadRegisters:
|
||||||
try:
|
try:
|
||||||
|
@ -373,9 +371,7 @@ class TMC2208:
|
||||||
if reg_name == "IOIN":
|
if reg_name == "IOIN":
|
||||||
drv_type = self.fields.get_field("SEL_A", val)
|
drv_type = self.fields.get_field("SEL_A", val)
|
||||||
reg_name = "IOIN@TMC220x" if drv_type else "IOIN@TMC222x"
|
reg_name = "IOIN@TMC220x" if drv_type else "IOIN@TMC222x"
|
||||||
msg = self.fields.pretty_format(reg_name, val)
|
gcode.respond_info(self.fields.pretty_format(reg_name, val))
|
||||||
logging.info(msg)
|
|
||||||
gcode.respond_info(msg)
|
|
||||||
cmd_INIT_TMC_help = "Initialize TMC stepper driver registers"
|
cmd_INIT_TMC_help = "Initialize TMC stepper driver registers"
|
||||||
def cmd_INIT_TMC(self, params):
|
def cmd_INIT_TMC(self, params):
|
||||||
logging.info("INIT_TMC 2208 %s", self.name)
|
logging.info("INIT_TMC 2208 %s", self.name)
|
||||||
|
|
|
@ -84,7 +84,6 @@ class ZTilt:
|
||||||
stepstrs = ["%s = %.6f" % (s.get_name(), so) for so, s in positions]
|
stepstrs = ["%s = %.6f" % (s.get_name(), so) for so, s in positions]
|
||||||
msg = "Making the following Z adjustments:\n%s\nz_adjust = %.6f" % (
|
msg = "Making the following Z adjustments:\n%s\nz_adjust = %.6f" % (
|
||||||
"\n".join(stepstrs), z_adjust)
|
"\n".join(stepstrs), z_adjust)
|
||||||
logging.info(msg)
|
|
||||||
self.gcode.respond_info(msg)
|
self.gcode.respond_info(msg)
|
||||||
# Move each z stepper (sorted from lowest to highest) until they match
|
# Move each z stepper (sorted from lowest to highest) until they match
|
||||||
positions.sort()
|
positions.sort()
|
||||||
|
|
|
@ -307,20 +307,21 @@ class GCodeParser:
|
||||||
os.write(self.fd, msg+"\n")
|
os.write(self.fd, msg+"\n")
|
||||||
except os.error:
|
except os.error:
|
||||||
logging.exception("Write g-code response")
|
logging.exception("Write g-code response")
|
||||||
def respond_info(self, msg):
|
def respond_info(self, msg, log=True):
|
||||||
logging.debug(msg)
|
if log:
|
||||||
|
logging.info(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)
|
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))
|
self.respond_info("\n".join(lines), log=False)
|
||||||
self.respond('!! %s' % (lines[0].strip(),))
|
self.respond('!! %s' % (lines[0].strip(),))
|
||||||
if self.is_fileinput:
|
if self.is_fileinput:
|
||||||
self.printer.request_exit('error_exit')
|
self.printer.request_exit('error_exit')
|
||||||
def _respond_state(self, state):
|
def _respond_state(self, state):
|
||||||
self.respond_info("Klipper state: %s" % (state,))
|
self.respond_info("Klipper state: %s" % (state,), log=False)
|
||||||
# Parameter parsing helpers
|
# Parameter parsing helpers
|
||||||
class sentinel: pass
|
class sentinel: pass
|
||||||
def get_str(self, name, params, default=sentinel, parser=str,
|
def get_str(self, name, params, default=sentinel, parser=str,
|
||||||
|
@ -695,7 +696,7 @@ class GCodeParser:
|
||||||
self.request_restart('firmware_restart')
|
self.request_restart('firmware_restart')
|
||||||
cmd_ECHO_when_not_ready = True
|
cmd_ECHO_when_not_ready = True
|
||||||
def cmd_ECHO(self, params):
|
def cmd_ECHO(self, params):
|
||||||
self.respond_info(params['#original'])
|
self.respond_info(params['#original'], log=False)
|
||||||
cmd_STATUS_when_not_ready = True
|
cmd_STATUS_when_not_ready = True
|
||||||
cmd_STATUS_help = "Report the printer status"
|
cmd_STATUS_help = "Report the printer status"
|
||||||
def cmd_STATUS(self, params):
|
def cmd_STATUS(self, params):
|
||||||
|
@ -714,4 +715,4 @@ class GCodeParser:
|
||||||
for cmd in sorted(self.gcode_handlers):
|
for cmd in sorted(self.gcode_handlers):
|
||||||
if cmd in self.gcode_help:
|
if cmd in self.gcode_help:
|
||||||
cmdhelp.append("%-10s: %s" % (cmd, self.gcode_help[cmd]))
|
cmdhelp.append("%-10s: %s" % (cmd, self.gcode_help[cmd]))
|
||||||
self.respond_info("\n".join(cmdhelp))
|
self.respond_info("\n".join(cmdhelp), log=False)
|
||||||
|
|
|
@ -216,7 +216,7 @@ class PrinterExtruder:
|
||||||
"pressure_advance_lookahead_time: %.6f" % (
|
"pressure_advance_lookahead_time: %.6f" % (
|
||||||
pressure_advance, pressure_advance_lookahead_time))
|
pressure_advance, pressure_advance_lookahead_time))
|
||||||
self.printer.set_rollover_info(self.name, "%s: %s" % (self.name, msg))
|
self.printer.set_rollover_info(self.name, "%s: %s" % (self.name, msg))
|
||||||
gcode.respond_info(msg)
|
gcode.respond_info(msg, log=False)
|
||||||
|
|
||||||
# Dummy extruder class used when a printer has no extruder at all
|
# Dummy extruder class used when a printer has no extruder at all
|
||||||
class DummyExtruder:
|
class DummyExtruder:
|
||||||
|
|
|
@ -65,7 +65,7 @@ def background_coordinate_descent(printer, adj_params, params, error_func):
|
||||||
while calc_proc.is_alive():
|
while calc_proc.is_alive():
|
||||||
if eventtime > last_report_time + 5.:
|
if eventtime > last_report_time + 5.:
|
||||||
last_report_time = eventtime
|
last_report_time = eventtime
|
||||||
gcode.respond_info("Working on calibration...")
|
gcode.respond_info("Working on calibration...", log=False)
|
||||||
eventtime = reactor.pause(eventtime + .1)
|
eventtime = reactor.pause(eventtime + .1)
|
||||||
# Return results
|
# Return results
|
||||||
res = parent_conn.recv()
|
res = parent_conn.recv()
|
||||||
|
|
|
@ -462,7 +462,7 @@ class ToolHead:
|
||||||
max_velocity, max_accel, self.requested_accel_to_decel,
|
max_velocity, max_accel, self.requested_accel_to_decel,
|
||||||
square_corner_velocity))
|
square_corner_velocity))
|
||||||
self.printer.set_rollover_info("toolhead", "toolhead: %s" % (msg,))
|
self.printer.set_rollover_info("toolhead", "toolhead: %s" % (msg,))
|
||||||
gcode.respond_info(msg)
|
gcode.respond_info(msg, log=False)
|
||||||
def cmd_M204(self, params):
|
def cmd_M204(self, params):
|
||||||
gcode = self.printer.lookup_object('gcode')
|
gcode = self.printer.lookup_object('gcode')
|
||||||
if 'P' in params and 'T' in params and 'S' not in params:
|
if 'P' in params and 'T' in params and 'S' not in params:
|
||||||
|
|
Loading…
Reference in New Issue