From d55baaf2654e989aac570d47910ca9434ec5814a Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sun, 28 Sep 2025 14:05:09 -0400 Subject: [PATCH] bus: Additional devices require i2c_write_noack() Currently, the LEDHelper() and GCodeRequestQueue() helper classes require that their callbacks do not block. As a result, the pca9533, pca9632, and sx1509 devices need to use non-blocking i2c write calls. Signed-off-by: Kevin O'Connor --- klippy/extras/bus.py | 3 +++ klippy/extras/pca9533.py | 4 ++-- klippy/extras/pca9632.py | 4 ++-- klippy/extras/sx1509.py | 3 ++- 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/klippy/extras/bus.py b/klippy/extras/bus.py index b04fbe764..676ff3b93 100644 --- a/klippy/extras/bus.py +++ b/klippy/extras/bus.py @@ -213,6 +213,9 @@ class MCU_I2C: "i2c_read_response oid=%c response=%*s", oid=self.oid, cq=self.cmd_queue) def i2c_write_noack(self, data, minclock=0, reqclock=0): + if self.i2c_write_cmd is None: + self._to_write.append(data) + return self.i2c_write_cmd.send([self.oid, data], minclock=minclock, reqclock=reqclock) def i2c_write(self, data, minclock=0, reqclock=0): diff --git a/klippy/extras/pca9533.py b/klippy/extras/pca9533.py index a94e1334e..20f1a6ca9 100644 --- a/klippy/extras/pca9533.py +++ b/klippy/extras/pca9533.py @@ -27,8 +27,8 @@ class PCA9533: minclock = 0 if print_time is not None: minclock = self.i2c.get_mcu().print_time_to_clock(print_time) - self.i2c.i2c_write([PCA9533_PLS0, ls0], minclock=minclock, - reqclock=BACKGROUND_PRIORITY_CLOCK) + self.i2c.i2c_write_noack([PCA9533_PLS0, ls0], minclock=minclock, + reqclock=BACKGROUND_PRIORITY_CLOCK) def get_status(self, eventtime): return self.led_helper.get_status(eventtime) diff --git a/klippy/extras/pca9632.py b/klippy/extras/pca9632.py index b8a813c33..099676e0f 100644 --- a/klippy/extras/pca9632.py +++ b/klippy/extras/pca9632.py @@ -37,8 +37,8 @@ class PCA9632: if self.prev_regs.get(reg) == val: return self.prev_regs[reg] = val - self.i2c.i2c_write([reg, val], minclock=minclock, - reqclock=BACKGROUND_PRIORITY_CLOCK) + self.i2c.i2c_write_noack([reg, val], minclock=minclock, + reqclock=BACKGROUND_PRIORITY_CLOCK) def handle_connect(self): #Configure MODE1 self.reg_write(PCA9632_MODE1, 0x00) diff --git a/klippy/extras/sx1509.py b/klippy/extras/sx1509.py index fd36c7fe1..99df55df3 100644 --- a/klippy/extras/sx1509.py +++ b/klippy/extras/sx1509.py @@ -92,7 +92,8 @@ class SX1509(object): # Byte data += [self.reg_i_on_dict[reg] & 0xFF] clock = self._mcu.print_time_to_clock(print_time) - self._i2c.i2c_write(data, minclock=self._last_clock, reqclock=clock) + self._i2c.i2c_write_noack(data, minclock=self._last_clock, + reqclock=clock) self._last_clock = clock class SX1509_digital_out(object):