11 Commits

Author SHA1 Message Date
Kevin O'Connor
c454e88d9a stepper: Implement active callbacks via motion_queuing.register_flush_callback()
Use the existing register_flush_callback() system to implement motor
activity checking.  This simplifies the generate_steps() code.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-08-11 19:43:35 -04:00
Kevin O'Connor
c09ca4cf5a motion_queuing: Add register_flush_callback()
Move register_flush_callback() from mcu.py code to motion_queuing
module.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-08-11 19:43:34 -04:00
Kevin O'Connor
6f685e9e01 motion_queuing: Add allocate_stepcompress() call
Allocate the low-level C stepcompress object in the motion_queuing
module.  This simplifies the mcu.py code as it no longer needs to
track the stepqueues for the steppersync object.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-08-11 19:43:34 -04:00
Kevin O'Connor
126275d1f4 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>
2025-08-11 19:43:34 -04:00
Kevin O'Connor
c917bd893d pwm_tool: Use mcu.min_schedule_time() and mcu.max_nominal_duration()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-04-28 19:28:52 -04:00
Kevin O'Connor
1d92be71da toolhead: Rename note_kinematic_activity() to note_mcu_movequeue_activity()
Rename this function to make it more clear why it is called.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-01-18 12:25:08 -05:00
Kevin O'Connor
7a74888b43 toolhead: Extend flushing slightly past required time
There is no harm in enabling flushing for a little longer than
necessary.  In contrast, a slight rounding issue causing a message to
not get flushed properly could result in an error.  So, extend the
flushing time slightly to avoid potential issues.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2024-01-17 11:28:42 -05:00
Kevin O'Connor
547bfbf818 pwm_tool: Fix error reporting
References to pins.error are not valid as the pins module is not
imported.  Reported by @Piezoid.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-12-19 14:57:39 -05:00
Kevin O'Connor
2defd7374a pwm_tool: Add support for maximum_mcu_duration
Implement the maximum_mcu_duration config parameter along with its
associated queue flushing.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-12-16 15:44:17 -05:00
Kevin O'Connor
99d7af87fd pwm_tool: Notify the toolhead that the move_queue needs to be flushed
Call toolhead.note_kinematic_activity() on each pin update to ensure
that those updates will be flushed properly.

This fixes "Timer too close" errors on SET_PIN commands that are
issued when the toolhead is idle.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-12-07 17:09:26 -05:00
Kevin O'Connor
29b7550ce5 pwm_tool: Add support for high-speed PWM pin updates
The output_pin module is only capable of updating an output pin at
most once every 100ms.  Add a new pwm_tool module that is capable of
queuing updates in the micro-controller and thus allowing for much
higher update rates.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2023-11-16 22:07:15 -05:00