Commit graph

1722 commits

Author SHA1 Message Date
Kevin O'Connor
e549cc4143 load_cell: Only launch a callback in the klippy:ready event handler
It is not valid to pause in the klippy:ready callback, so perform the
sensor startup process in a separate reactor task.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-18 12:28:06 -04:00
Kevin O'Connor
0d0d3917c9 motion_report: Simplify shutdown_clock tracking
Determine which mcu raised the shutdown from the shutdown details
report.  Also, pass shutdown_clock via that details report.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-18 12:18:18 -04:00
Kevin O'Connor
1bba59b7a0 motion_report: Move shutdown debugging to "klippy:analyze_shutdown" event
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-18 12:18:18 -04:00
Kevin O'Connor
c64c5e891c virtual_sdcard: Move shutdown debugging to "klippy:analyze_shutdown" event
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-18 12:18:17 -04:00
Kevin O'Connor
e672391dbc gcode_move: Move shutdown debugging to "klippy:analyze_shutdown" event
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-18 12:18:17 -04:00
Kevin O'Connor
38b286db4b error_mcu: Report reactor stats in error_mcu module
Move reactor debugging info from main klippy.py code to error_mcu code
for improved exception handling.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-18 12:18:17 -04:00
Kevin O'Connor
f147804d97 error_mcu: Rename "klippy:notify_mcu_shutdown" to "klippy:analyze_shutdown"
Rename the event to make it a little more clear what it is intended
for.  Also, check for an exception in each event handler.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-18 12:18:17 -04:00
Kevin O'Connor
3215e3a2aa motion_report: Improve "motion_report/dump_stepper" during homing
Step timing is reset when stepper.set_position() is called.  Detect
that case and ensure future steps after set_position start on a new
block.  This simplifies the timing for users of the data.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-18 12:12:45 -04:00
Kevin O'Connor
95b0ebf4c7 motion_report: Improve "motion_report/dump_trapq" during homing
Now that trapq_extract_old() can return upcoming moves, it's possible
for homing to cause confusing results (as these moves can end early).
Avoid this by delaying query responses until after homing completes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-18 12:12:45 -04:00
Kevin O'Connor
e3909fb205 manual_stepper: Remove some unused code
Some checks are pending
Build test / build (push) Waiting to run
klipper3d deploy / deploy (push) Waiting to run
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-12 14:38:07 -04:00
Kevin O'Connor
84e9a28141 virtual_sdcard: Reduce pause time on busy detection
If there are other users of the gcode mutex then pause for 50ms
(instead of 100ms).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-10 11:07:50 -04:00
Kevin O'Connor
e87de2ae49 motion_queuing: Don't disable step+dir+step filter in drip_update_time()
Allow the step compress code to perform regular step+dir+step
filtering even during probing and homing actions.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-08 20:11:40 -04:00
Kevin O'Connor
d55baaf265 bus: Additional devices require i2c_write_noack()
Some checks failed
Build test / build (push) Has been cancelled
Currently, the LEDHelper() and GCodeRequestQueue() helper classes
require that their callbacks do not block.  As a result, the pca9533,
pca9632, and sx1509 devices need to use non-blocking i2c write calls.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-06 21:19:01 -04:00
Dmitry Butyugin
ec82cee7fc resonance_tester: Support testing resonances over Z axis
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2025-10-04 19:50:34 -04:00
Dmitry Butyugin
caf7accf2d input_shaper: Z-axis input shaper
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2025-10-04 19:50:34 -04:00
Dmitry Butyugin
768b19e8be input_shaper: Limit maximum damping_ratio of the shapers
Some checks are pending
Build test / build (push) Waiting to run
klipper3d deploy / deploy (push) Waiting to run
Numerically optimized versions of *EI shapers have been tuned
for specific ranges of damping ratios and will show poor stability
outside of these designated ranges.

Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2025-10-04 13:07:49 -04:00
Kevin O'Connor
30a1f22e1d motion_queuing: Improve run to run stability of flushing when in debug mode
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-26 12:27:26 -04:00
Timofey Titovets
8c7693c048 uc1701: allow non blocking i2c writes
Some checks failed
Build test / build (push) Has been cancelled
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-24 19:33:37 -04:00
Kevin O'Connor
3ef4702e06 steppersync: Move step generation thread from stepcompress.c to steppersync.c
Implement step generation from 'struct syncemitter' instead of in the
stepcompress code.  This simplifies the stepcompress code and
simplifies the overall interface.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-24 15:07:25 -04:00
Kevin O'Connor
e78d11bc6f steppersync: Support sending messages directly from syncemitter
Move msg_queue allocation from stepcompress to syncemitter.  With this
change the pwm_tool module does not need to allocate a stepcompress
object.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-24 15:07:25 -04:00
Kevin O'Connor
d831d66c11 steppersync: Introduce new 'struct syncemitter'
Create a new 'struct syncemitter' for each object that can generate
messages for a 'struct steppersync' and store in a regular linked
list.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-24 15:07:25 -04:00
Kevin O'Connor
a29cfc1701 stepcompress: Pass oid in stepcompress_fill() instead of stepcompress_alloc()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-24 14:51:34 -04:00
Kevin O'Connor
f21cca049f steppersync: Add new steppersyncmgr_gen_steps() function
Generate and flush all the steppersync instances from a single
steppersyncmgr_gen_steps() call.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-24 14:51:34 -04:00
Kevin O'Connor
bd747872c3 steppersync: Add new 'struct steppersyncmgr'
Add a new C based mechanism for tracking all the 'struct steppersync'
instances.  This simplifies memory management.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-24 14:51:34 -04:00
Kevin O'Connor
13cfdf5711 motion_queuing: Reorganize code into sections
Only code movement - no code changes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-24 14:51:34 -04:00
Dmitry Butyugin
1c76ed1dc9 resonance_tester: Gracefully handle zero accelerations during the test
Some checks are pending
Build test / build (push) Waiting to run
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2025-09-23 14:57:00 -04:00
Dmitry Butyugin
599dcd176c resonance_tester: Correctly handle incorrect accelerometer chip names
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2025-09-23 14:57:00 -04:00
Dmitry Butyugin
5da026a337 input_shaper: Updated definitions of *EI input shapers
Some checks failed
Build test / build (push) Waiting to run
klipper3d deploy / deploy (push) Has been cancelled
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2025-09-22 15:18:01 -04:00
Kevin O'Connor
df29a38011 motion_queuing: Further tune flushing in batches
Avoid unnecessary reactor wakeups if a batch is close to being ready.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-15 14:30:27 -04:00
Kevin O'Connor
4c46b80f38 motion_queuing: Further improve step flushing in batches
Further encourage flushing steps in batches by delaying flushing if a
batch isn't needed yet.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-15 14:19:02 -04:00
Kevin O'Connor
f341031834 motion_queuing: Try harder to use next_batch_time when flushing
Use the next_batch_time even if it is slightly past or before the
ideal flushing window.  This should improve run to run reproducibility
of flush timing.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-15 13:46:35 -04:00
Kevin O'Connor
950aa103e4 motion_queuing: It is no longer necessary to loop in _advance_flush_time()
Some checks failed
Build test / build (push) Has been cancelled
Now that the host code does not flush far into the future, it is no
longer necessary to flush in waves.  Integrate _advance_flush_time()
into _flush_motion_queues().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-12 22:41:30 -04:00
Kevin O'Connor
42d149b40f motion_queuing: Avoid flushing far into the future
If a flush_all_steps() request is for a time far in the future, then
wait for that time to become close prior to flushing steps.  This
avoids committing to a step schedule that is far in the future.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-12 22:41:30 -04:00
Kevin O'Connor
7ea5f5d25e motion_queuing: Generate steps from timer instead of from lookahead
Don't tie the step generation logic to the toolhead lookahead logic.
Instead, use regular timers to generate steps with a goal of staying
500-750ms ahead of the micro-controllers.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-12 22:41:30 -04:00
Kevin O'Connor
32bd03703b motion_queuing: Don't use lazy_target in drip_update_time()
Using separate flush_time and step_gen_time is a minor optimization.
Using it in drip_update_time() complicates the code and may reduce the
time needed to schedule post homing/probing movements.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-12 22:41:30 -04:00
Kevin O'Connor
3bed65f10f motion_queuing: Move remaining steppersync logic from mcu module
Move the last parts of the steppersync logic into the motion_queuing
module.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-12 22:41:30 -04:00
Kevin O'Connor
22db9bb84e motion_queuing: Require explicit notification on a scan window change
Don't try to infer when the step generation scan window may change.
Instead, require the input_shaper and pressure_advance code call
motion_queuing.check_step_generation_scan_windows() any time a
scanning window may change.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-12 22:41:30 -04:00
Kevin O'Connor
a89694ac68 stepcompress: Generate steps in a per-stepper background thread
Some checks failed
Build test / build (push) Has been cancelled
Create a thread for each stepper and use it for step generation and
step compression.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-07 20:50:41 -04:00
Kevin O'Connor
68b67a16d6 display: Check for redraw_request_pending at end of screen_update_event()
Some checks are pending
Build test / build (push) Waiting to run
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-05 12:40:32 -04:00
Timofey Titovets
93ea9ddfa9 extruder_stepper: define missing public methods methods
Other modules could access the extruderN by
the printer lookup_object().
That would return this wrapper class.

Specifically, filament_motion_sensor will.
They can try to access missing methods
and klippy would crash.

Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
2025-09-04 14:20:25 -04:00
Kevin O'Connor
8a833175a5 motion_queuing: Introduce flush_all_steps() helper
Some checks failed
Build test / build (push) Has been cancelled
Move the "full flush" code from advance_flush_time() to a new
flush_all_steps() method.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-03 12:07:24 -04:00
Kevin O'Connor
5426943501 motion_queuing: Automatically detect changes to kin_flush_delay
Remove the toolhead note_step_generation_scan_time() code and
automatically detect the itersolve scan windows that are in use.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-03 12:00:31 -04:00
Kevin O'Connor
d1974c0d3d motion_queuing: Move flushing logic from toolhead to motion_queuing module
Move low-level step generation timing code to the motion_queing
module.  This helps simplify the toolhead module.  It also helps
centralize the step generation code into the motion_queing module.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-03 12:00:31 -04:00
Kevin O'Connor
db5cbe56d3 toolhead: Do not modify print_time in drip_update_time()
Implement drip_update_time() using _advance_flush_time() instead of
_advance_move_time().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-03 12:00:31 -04:00
Kevin O'Connor
a5218619b7 motion_queuing: Track kin_flush_delay locally
Track the kin_flush_delay in both toolhead.py and motion_queuing.py .

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-03 12:00:31 -04:00
Kevin O'Connor
5056e1031c stepper_enable: Improve timing of manual stepper enable/disable commands
Invoke flush_step_generation() prior to checking motor enable state as
this is the best way to ensure all stepper active callbacks have been
invoked (which could change the enable line state).

Also, there is no longer a reason to add additional toolhead dwells
when enabling a stepper motor.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-03 11:58:35 -04:00
Kevin O'Connor
1f14e950e7 stepper_enable: Unify explicit stepper enable/disable code
There were several slightly different implementations of explicit
stepper motor enabling/disabling in the force_move, stepper_enable,
and manual_stepper modules.  Introduce a new set_motors_enable()
method and use this in all implementations.  This simplifies the code
and reduces the chance of obscure timing issues.

This fixes a manual_stepper error introduced in commit 9399e738.  That
commit changed the manual_stepper class to no longer explicitly flush
and clear all steps after each move, which broke the expectations of
manual_stepper's custom enable code.  Using the more robust
implementation in stepper_enable fixes that issue.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-09-03 11:57:58 -04:00
Kevin O'Connor
e4c66452dc temperature_probe: Fix python2 incompatibility
Some checks are pending
Build test / build (push) Waiting to run
It seems python2 string.split() method does not accept a "maxsplit"
parameter.  Use a format compatible with both python2 and python3.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-08-31 16:02:44 -04:00
Kevin O'Connor
179a56ce92 gcode_move: Fix M114 when extra axes are defined
Commit d40fd219 added support for defining extra axes, however that
change could break the M114 command.  Update the code to fix M114.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-08-31 12:19:43 -04:00
Kevin O'Connor
3aadda6fb3 mcu: Disable waiting in send_wait_ack() if in debugging mode
Some checks failed
Build test / build (push) Has been cancelled
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-08-22 16:53:34 -04:00