From 3aadda6fb35514b952cdafb16c248f4ccbcfe235 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Fri, 22 Aug 2025 16:53:34 -0400 Subject: [PATCH] mcu: Disable waiting in send_wait_ack() if in debugging mode Signed-off-by: Kevin O'Connor --- klippy/extras/bus.py | 5 ----- klippy/mcu.py | 8 ++++++-- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/klippy/extras/bus.py b/klippy/extras/bus.py index 033e9341..9fb46639 100644 --- a/klippy/extras/bus.py +++ b/klippy/extras/bus.py @@ -182,7 +182,6 @@ class MCU_I2C: self.i2c_write_cmd = self.i2c_read_cmd = None printer = self.mcu.get_printer() printer.register_event_handler("klippy:connect", self._handle_connect) - self._debugoutput = printer.get_start_args().get('debugoutput') # backward support i2c_write inside the init section self._to_write = [] def _handle_connect(self): @@ -217,10 +216,6 @@ class MCU_I2C: if self.i2c_write_cmd is None: self._to_write.append(data) return - if self._debugoutput is not None: - self.i2c_write_cmd.send([self.oid, data], - minclock=minclock, reqclock=reqclock) - return self.i2c_write_cmd.send_wait_ack([self.oid, data], minclock=minclock, reqclock=reqclock) def i2c_read(self, write, read_len, retry=True): diff --git a/klippy/mcu.py b/klippy/mcu.py index db02e2a4..146b5bac 100644 --- a/klippy/mcu.py +++ b/klippy/mcu.py @@ -84,7 +84,7 @@ class CommandQueryWrapper: # Wrapper around command sending class CommandWrapper: - def __init__(self, serial, msgformat, cmd_queue=None): + def __init__(self, serial, msgformat, cmd_queue=None, debugoutput=False): self._serial = serial msgparser = serial.get_msgparser() self._cmd = msgparser.lookup_command(msgformat) @@ -92,6 +92,9 @@ class CommandWrapper: cmd_queue = serial.get_default_command_queue() self._cmd_queue = cmd_queue self._msgtag = msgparser.lookup_msgid(msgformat) & 0xffffffff + if debugoutput: + # Can't use send_wait_ack when in debugging mode + self.send_wait_ack = self.send def send(self, data=(), minclock=0, reqclock=0): cmd = self._cmd.encode(data) self._serial.raw_send(cmd, minclock, reqclock, self._cmd_queue) @@ -888,7 +891,8 @@ class MCU: def alloc_command_queue(self): return self._serial.alloc_command_queue() def lookup_command(self, msgformat, cq=None): - return CommandWrapper(self._serial, msgformat, cq) + return CommandWrapper(self._serial, msgformat, cq, + debugoutput=self.is_fileoutput()) def lookup_query_command(self, msgformat, respformat, oid=None, cq=None, is_async=False): return CommandQueryWrapper(self._serial, msgformat, respformat, oid,