From 3b7e546b4a1709f6678bb52fbeeaf82b6bb8a3b2 Mon Sep 17 00:00:00 2001 From: Pascal Pieper Date: Mon, 27 Sep 2021 23:15:44 +0200 Subject: [PATCH] Explicitly allocated cq in non-ht mode enables normal usage Signed-off-by: Pascal Pieper --- klippy/extras/output_pin.py | 2 +- klippy/mcu.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/klippy/extras/output_pin.py b/klippy/extras/output_pin.py index 3c01839991c1..f2e684e71ba5 100644 --- a/klippy/extras/output_pin.py +++ b/klippy/extras/output_pin.py @@ -63,7 +63,7 @@ def get_status(self, eventtime): return {'value': self.last_value} def _set_pin(self, print_time, value, cycle_time, is_resend=False): if value == self.last_value and cycle_time == self.last_cycle_time: - if not is_resend: + if not is_resend or value == self.shutdown_value: return print_time = max(print_time, self.last_print_time + self._pin_min_time) if self.is_pwm: diff --git a/klippy/mcu.py b/klippy/mcu.py index 56fcd5f101e0..29019aa11a44 100644 --- a/klippy/mcu.py +++ b/klippy/mcu.py @@ -424,8 +424,10 @@ def _build_config(self): self._start_value * self._pwm_max)) return self._oid = self._mcu.create_oid() + cmd_queue = None if not self._is_ht: self._mcu.request_move_queue_slot() + cmd_queue = self._mcu.alloc_command_queue() self._mcu.add_config_cmd( "config_pwm_out oid=%d pin=%s cycle_ticks=%d value=%d" @@ -438,8 +440,8 @@ def _build_config(self): % (self._oid, self._last_clock, svalue), on_restart=True) self._set_cmd = self._mcu.lookup_command( - "queue_pwm_out oid=%c clock=%u value=%hu", - fast_track=self._is_ht) # might be ugly without cq? + "queue_pwm_out oid=%c clock=%u value=%hu", cq=cmd_queue, + fast_track=self._is_ht) return # Software PWM if self._shutdown_value not in [0., 1.]: @@ -469,10 +471,10 @@ def _build_config(self): "queue_digital_out oid=%d clock=%d on_ticks=%d" % (self._oid, self._last_clock, svalue), is_init=True) self._set_cmd = self._mcu.lookup_command( - "queue_digital_out oid=%c clock=%u on_ticks=%u", + "queue_digital_out oid=%c clock=%u on_ticks=%u", cq=cmd_queue, fast_track=self._is_ht) self._set_cycle_ticks = self._mcu.lookup_command( - "set_digital_out_pwm_cycle oid=%c cycle_ticks=%u", cq=None) + "set_digital_out_pwm_cycle oid=%c cycle_ticks=%u", cq=cmd_queue) def set_pwm(self, print_time, value, cycle_time=None): req_clock = self._mcu.print_time_to_clock(print_time) # FIXME: let sync_channel replace uncommitted values