Skip to content

Commit

Permalink
Explicitly allocated cq in non-ht mode enables normal usage
Browse files Browse the repository at this point in the history
Signed-off-by: Pascal Pieper <[email protected]>
  • Loading branch information
Cirromulus committed Sep 7, 2023
1 parent 4cf13d7 commit 3b7e546
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion klippy/extras/output_pin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 6 additions & 4 deletions klippy/mcu.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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.]:
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 3b7e546

Please sign in to comment.