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:
|
||||
raise
|
||||
msg = "Failed to verify BLTouch probe is raised; retrying."
|
||||
logging.warning(msg)
|
||||
self.gcode.respond_info(msg)
|
||||
self.next_cmd_time += RETRY_RESET_TIME
|
||||
continue
|
||||
|
@ -172,9 +171,7 @@ class BLTouchEndstopWrapper:
|
|||
self.gcode.respond_info("BLTouch commands: %s" % (
|
||||
", ".join(sorted([c for c in Commands if c is not None]))))
|
||||
return
|
||||
msg = "Sending BLTOUCH_DEBUG COMMAND=%s" % (cmd,)
|
||||
self.gcode.respond_info(msg)
|
||||
logging.info(msg)
|
||||
self.gcode.respond_info("Sending BLTOUCH_DEBUG COMMAND=%s" % (cmd,))
|
||||
self.sync_print_time()
|
||||
self.send_cmd(cmd, duration=self.pin_move_time)
|
||||
self.send_cmd(None)
|
||||
|
|
|
@ -1457,7 +1457,8 @@ class MenuManager:
|
|||
elif action == 'exit':
|
||||
self.exit()
|
||||
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:
|
||||
if len(str(args[0])) > 0:
|
||||
self.printer.send_event(
|
||||
|
@ -1530,11 +1531,9 @@ class MenuManager:
|
|||
key1, key2,
|
||||
self.parameters[key1].get(key2)
|
||||
)
|
||||
logging.info(msg)
|
||||
self.gcode.respond_info(msg)
|
||||
else:
|
||||
msg = "{0} = {1}".format(key1, self.parameters.get(key1))
|
||||
logging.info(msg)
|
||||
self.gcode.respond_info(msg)
|
||||
|
||||
# buttons & encoder callbacks
|
||||
|
|
|
@ -280,15 +280,11 @@ class TMC2130:
|
|||
gcode.respond_info("========== Write-only registers ==========")
|
||||
for reg_name, val in self.regs.items():
|
||||
if reg_name not in ReadRegisters:
|
||||
msg = self.fields.pretty_format(reg_name, val)
|
||||
logging.info(msg)
|
||||
gcode.respond_info(msg)
|
||||
gcode.respond_info(self.fields.pretty_format(reg_name, val))
|
||||
gcode.respond_info("========== Queried registers ==========")
|
||||
for reg_name in ReadRegisters:
|
||||
val = self.get_register(reg_name)
|
||||
msg = self.fields.pretty_format(reg_name, val)
|
||||
logging.info(msg)
|
||||
gcode.respond_info(msg)
|
||||
gcode.respond_info(self.fields.pretty_format(reg_name, val))
|
||||
cmd_INIT_TMC_help = "Initialize TMC stepper driver registers"
|
||||
def cmd_INIT_TMC(self, params):
|
||||
logging.info("INIT_TMC 2130 %s", self.name)
|
||||
|
|
|
@ -359,9 +359,7 @@ class TMC2208:
|
|||
gcode.respond_info("========== Write-only registers ==========")
|
||||
for reg_name, val in self.regs.items():
|
||||
if reg_name not in ReadRegisters:
|
||||
msg = self.fields.pretty_format(reg_name, val)
|
||||
logging.info(msg)
|
||||
gcode.respond_info(msg)
|
||||
gcode.respond_info(self.fields.pretty_format(reg_name, val))
|
||||
gcode.respond_info("========== Queried registers ==========")
|
||||
for reg_name in ReadRegisters:
|
||||
try:
|
||||
|
@ -373,9 +371,7 @@ class TMC2208:
|
|||
if reg_name == "IOIN":
|
||||
drv_type = self.fields.get_field("SEL_A", val)
|
||||
reg_name = "IOIN@TMC220x" if drv_type else "IOIN@TMC222x"
|
||||
msg = self.fields.pretty_format(reg_name, val)
|
||||
logging.info(msg)
|
||||
gcode.respond_info(msg)
|
||||
gcode.respond_info(self.fields.pretty_format(reg_name, val))
|
||||
cmd_INIT_TMC_help = "Initialize TMC stepper driver registers"
|
||||
def cmd_INIT_TMC(self, params):
|
||||
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]
|
||||
msg = "Making the following Z adjustments:\n%s\nz_adjust = %.6f" % (
|
||||
"\n".join(stepstrs), z_adjust)
|
||||
logging.info(msg)
|
||||
self.gcode.respond_info(msg)
|
||||
# Move each z stepper (sorted from lowest to highest) until they match
|
||||
positions.sort()
|
||||
|
|
|
@ -307,20 +307,21 @@ class GCodeParser:
|
|||
os.write(self.fd, msg+"\n")
|
||||
except os.error:
|
||||
logging.exception("Write g-code response")
|
||||
def respond_info(self, msg):
|
||||
logging.debug(msg)
|
||||
def respond_info(self, msg, log=True):
|
||||
if log:
|
||||
logging.info(msg)
|
||||
lines = [l.strip() for l in msg.strip().split('\n')]
|
||||
self.respond("// " + "\n// ".join(lines))
|
||||
def respond_error(self, msg):
|
||||
logging.warning(msg)
|
||||
lines = msg.strip().split('\n')
|
||||
if len(lines) > 1:
|
||||
self.respond_info("\n".join(lines))
|
||||
self.respond_info("\n".join(lines), log=False)
|
||||
self.respond('!! %s' % (lines[0].strip(),))
|
||||
if self.is_fileinput:
|
||||
self.printer.request_exit('error_exit')
|
||||
def _respond_state(self, state):
|
||||
self.respond_info("Klipper state: %s" % (state,))
|
||||
self.respond_info("Klipper state: %s" % (state,), log=False)
|
||||
# Parameter parsing helpers
|
||||
class sentinel: pass
|
||||
def get_str(self, name, params, default=sentinel, parser=str,
|
||||
|
@ -695,7 +696,7 @@ class GCodeParser:
|
|||
self.request_restart('firmware_restart')
|
||||
cmd_ECHO_when_not_ready = True
|
||||
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_help = "Report the printer status"
|
||||
def cmd_STATUS(self, params):
|
||||
|
@ -714,4 +715,4 @@ class GCodeParser:
|
|||
for cmd in sorted(self.gcode_handlers):
|
||||
if cmd in self.gcode_help:
|
||||
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, pressure_advance_lookahead_time))
|
||||
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
|
||||
class DummyExtruder:
|
||||
|
|
|
@ -65,7 +65,7 @@ def background_coordinate_descent(printer, adj_params, params, error_func):
|
|||
while calc_proc.is_alive():
|
||||
if eventtime > last_report_time + 5.:
|
||||
last_report_time = eventtime
|
||||
gcode.respond_info("Working on calibration...")
|
||||
gcode.respond_info("Working on calibration...", log=False)
|
||||
eventtime = reactor.pause(eventtime + .1)
|
||||
# Return results
|
||||
res = parent_conn.recv()
|
||||
|
|
|
@ -462,7 +462,7 @@ class ToolHead:
|
|||
max_velocity, max_accel, self.requested_accel_to_decel,
|
||||
square_corner_velocity))
|
||||
self.printer.set_rollover_info("toolhead", "toolhead: %s" % (msg,))
|
||||
gcode.respond_info(msg)
|
||||
gcode.respond_info(msg, log=False)
|
||||
def cmd_M204(self, params):
|
||||
gcode = self.printer.lookup_object('gcode')
|
||||
if 'P' in params and 'T' in params and 'S' not in params:
|
||||
|
|
Loading…
Reference in New Issue