diff --git a/klippy/extras/neopixel.py b/klippy/extras/neopixel.py index f21e5f6c..03856c1f 100644 --- a/klippy/extras/neopixel.py +++ b/klippy/extras/neopixel.py @@ -102,7 +102,8 @@ class PrinterNeoPixel: minclock = self.mcu.print_time_to_clock(print_time) scmd = self.neopixel_send_cmd.send for i in range(8): - params = scmd([self.oid], minclock=minclock) + params = scmd([self.oid], minclock=minclock, + reqclock=BACKGROUND_PRIORITY_CLOCK) if params['success']: break else: diff --git a/klippy/mcu.py b/klippy/mcu.py index a6246fb8..1d661050 100644 --- a/klippy/mcu.py +++ b/klippy/mcu.py @@ -339,8 +339,8 @@ class RetryAsyncCommand: if params['#sent_time'] >= self.min_query_time: self.min_query_time = self.reactor.NEVER self.reactor.async_complete(self.completion, params) - def get_response(self, cmd, cmd_queue, minclock=0): - self.serial.raw_send_wait_ack(cmd, minclock, minclock, cmd_queue) + def get_response(self, cmd, cmd_queue, minclock=0, reqclock=0): + self.serial.raw_send_wait_ack(cmd, minclock, reqclock, cmd_queue) first_query_time = query_time = self.reactor.monotonic() while 1: params = self.completion.wait(query_time + self.RETRY_TIME) @@ -368,11 +368,12 @@ class CommandQueryWrapper: if cmd_queue is None: cmd_queue = serial.get_default_command_queue() self._cmd_queue = cmd_queue - def send(self, data=(), minclock=0): + def send(self, data=(), minclock=0, reqclock=0): cmd = self._cmd.encode(data) xh = self._xmit_helper(self._serial, self._response, self._oid) + reqclock = max(minclock, reqclock) try: - return xh.get_response(cmd, self._cmd_queue, minclock=minclock) + return xh.get_response(cmd, self._cmd_queue, minclock, reqclock) except serialhdl.error as e: raise error(str(e)) diff --git a/klippy/serialhdl.py b/klippy/serialhdl.py index e3c612e7..9f5c2863 100644 --- a/klippy/serialhdl.py +++ b/klippy/serialhdl.py @@ -235,11 +235,11 @@ class SerialRetryCommand: self.serial.register_response(self.handle_callback, name, oid) def handle_callback(self, params): self.last_params = params - def get_response(self, cmd, cmd_queue, minclock=0): + def get_response(self, cmd, cmd_queue, minclock=0, reqclock=0): retries = 5 retry_delay = .010 while 1: - self.serial.raw_send_wait_ack(cmd, minclock, minclock, cmd_queue) + self.serial.raw_send_wait_ack(cmd, minclock, reqclock, cmd_queue) params = self.last_params if params is not None: self.serial.register_response(None, self.name, self.oid)