mirror of
https://github.com/andreili/klipper.git
synced 2025-08-23 11:24:06 +02:00
toolhead: Default note_mcu_movequeue_activity() to set step_gen_time
Change note_mcu_movequeue_activity() to default to setting the step_gen_time (instead of the previous default to not set it). Most users of the mcu "move queue" will be for stepper activity. There is also little harm in incrementing the tracking of the last possible step generation time, but accidentally generating a step without incrementing the tracking can lead to very hard to debug failures. The two cases (output_pin.py and pwm_tool.py) where note_mcu_movequeue_activity() is called and definitely not related to step generation can explicitly pass 'is_step_gen=False'. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
f8da8099d5
commit
126275d1f4
@ -50,10 +50,11 @@ class GCodeRequestQueue:
|
||||
del rqueue[:pos+1]
|
||||
self.next_min_flush_time = next_time + max(min_wait, min_sched_time)
|
||||
# Ensure following queue items are flushed
|
||||
self.toolhead.note_mcu_movequeue_activity(self.next_min_flush_time)
|
||||
self.toolhead.note_mcu_movequeue_activity(self.next_min_flush_time,
|
||||
is_step_gen=False)
|
||||
def _queue_request(self, print_time, value):
|
||||
self.rqueue.append((print_time, value))
|
||||
self.toolhead.note_mcu_movequeue_activity(print_time)
|
||||
self.toolhead.note_mcu_movequeue_activity(print_time, is_step_gen=False)
|
||||
def queue_gcode_request(self, value):
|
||||
self.toolhead.register_lookahead_callback(
|
||||
(lambda pt: self._queue_request(pt, value)))
|
||||
|
@ -115,7 +115,8 @@ class MCU_queued_pwm:
|
||||
# Continue flushing to resend time
|
||||
wakeclock += self._duration_ticks
|
||||
wake_print_time = self._mcu.clock_to_print_time(wakeclock)
|
||||
self._toolhead.note_mcu_movequeue_activity(wake_print_time)
|
||||
self._toolhead.note_mcu_movequeue_activity(wake_print_time,
|
||||
is_step_gen=False)
|
||||
def set_pwm(self, print_time, value):
|
||||
clock = self._mcu.print_time_to_clock(print_time)
|
||||
if self._invert:
|
||||
|
@ -342,8 +342,7 @@ class ToolHead:
|
||||
for cb in move.timing_callbacks:
|
||||
cb(next_move_time)
|
||||
# Generate steps for moves
|
||||
self.note_mcu_movequeue_activity(next_move_time + self.kin_flush_delay,
|
||||
set_step_gen_time=True)
|
||||
self.note_mcu_movequeue_activity(next_move_time + self.kin_flush_delay)
|
||||
self._advance_move_time(next_move_time)
|
||||
def _flush_lookahead(self):
|
||||
# Transit from "NeedPrime"/"Priming"/"Drip"/main state to "NeedPrime"
|
||||
@ -539,8 +538,7 @@ class ToolHead:
|
||||
drip_completion.wait(curtime + wait_time)
|
||||
continue
|
||||
npt = min(self.print_time + DRIP_SEGMENT_TIME, next_print_time)
|
||||
self.note_mcu_movequeue_activity(npt + self.kin_flush_delay,
|
||||
set_step_gen_time=True)
|
||||
self.note_mcu_movequeue_activity(npt + self.kin_flush_delay)
|
||||
for stepper in addstepper:
|
||||
stepper.generate_steps(npt)
|
||||
self._advance_move_time(npt)
|
||||
@ -638,9 +636,9 @@ class ToolHead:
|
||||
callback(self.get_last_move_time())
|
||||
return
|
||||
last_move.timing_callbacks.append(callback)
|
||||
def note_mcu_movequeue_activity(self, mq_time, set_step_gen_time=False):
|
||||
def note_mcu_movequeue_activity(self, mq_time, is_step_gen=True):
|
||||
self.need_flush_time = max(self.need_flush_time, mq_time)
|
||||
if set_step_gen_time:
|
||||
if is_step_gen:
|
||||
self.step_gen_time = max(self.step_gen_time, mq_time)
|
||||
if self.do_kick_flush_timer:
|
||||
self.do_kick_flush_timer = False
|
||||
|
Loading…
x
Reference in New Issue
Block a user