Commit Graph

5973 Commits

Author SHA1 Message Date
Kevin O'Connor
6465921a5a gcode_macro: Verify nothing attempts to pause in a get_status() callback
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-23 12:47:55 -04:00
Kevin O'Connor
ff667075cf statistics: Verify nothing attempts to pause in a stats() callback
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-23 12:47:55 -04:00
Kevin O'Connor
7a723bdc1c serialqueue: Revert recent serialqueue locking changes
This reverts commit aea8d8e0a1.
This reverts commit 493271697f.
This reverts commit d7da45e152.

There are reports of a regression since making this change.  Revert
for now until the root cause can be found.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-18 19:47:53 -04:00
Timofey Titovets
bb04546e6e pca9533: do write on connect like pca9632 does
This is the only user of the i2c_write inside the init
compatibility layer, so remove it as well.

Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
2025-10-18 13:46:58 -04:00
Timofey Titovets
6a8b823a45 led: run update function as reactor callback
Update functions could be called within the flush/lookahead context
If the update function internally does pause()
That would lead to the unpredictable execution of time-critical functions

Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
2025-10-18 13:46:58 -04:00
Timofey Titovets
aea8d8e0a1 serialqueue: decouple transmit requests
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
2025-10-18 13:20:58 -04:00
Timofey Titovets
493271697f serialqueue: decouple serialhdl receive lock
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
2025-10-18 13:20:58 -04:00
Timofey Titovets
d7da45e152 serialqueue: decouple pending & ready queues
Simply describe how the cmdqueue is moved between states.

Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
2025-10-18 13:20:58 -04:00
Kevin O'Connor
7a036a6ba7 toolhead: Verify nothing attempts to pause in lookahead callbacks
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-18 12:28:06 -04:00
Kevin O'Connor
6557050968 motion_queuing: Verify nothing attempts to pause in flush callbacks
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-18 12:28:06 -04:00
Kevin O'Connor
302df255db klippy: Verify nothing attempts to pause in the klippy:ready event
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-18 12:28:06 -04:00
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
0e7e908af4 klippy: Verify nothing attempts to pause in the klippy:shutdown event
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-18 12:28:02 -04:00
Kevin O'Connor
d1c0cbd63a reactor: Add support for temporarily disabling reactor pauses
Add a new reactor.assert_no_pause() helper that can temporarily
disable reactor pause requests.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-18 12:26:37 -04:00
Kevin O'Connor
e96a944f33 mcu: It is not necessary to export an is_shutdown() method
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-18 12:18:18 -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
bc27bd9a13 mcu: 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
54d2716bdd webhooks: 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
6f5ab8d0e8 gcode: 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
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
3fe594ef20 sensor_lis2dw: Read 8 samples at a time from sensor fifo
Batch reading of 8 samples (48 bytes) at a time from the sensor.  This
reduces the number of transactions - which can notably improve
performance on i2c.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-13 20:36:11 -04:00
JamesH1978
b1dd6a73f7 docs: Update FAQ.md - Typo (#7089)
Kliper is not Klipper!

Signed-off-by: James Hartley <james@hartleyns.com>
2025-10-13 13:53:13 -04:00
Kevin O'Connor
e3909fb205 manual_stepper: Remove some unused code
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-12 14:38:07 -04:00
Pedro Lamas
a5c764bbe9 docs: Command parameter fix
Signed-off-by: Pedro Lamas <pedrolamas@gmail.com>
2025-10-12 14:37:35 -04:00
Kevin O'Connor
9117c09037 graphstats: Set MAXBUFFER=1
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-10 11:07:50 -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
8de426d244 toolhead: Reduce target buffer time to 1 second from 2 seconds
During normal printing the host software would attempt to stay ahead
of the micro-controller by 2 full seconds.  Change that time to 1
second.  This should make the software more responsive to user
requests (such as pause requests).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-10 11:07:50 -04:00
Kevin O'Connor
16fc46fe5f toolhead: Reduce LOOKAHEAD_FLUSH_TIME to 0.150 seconds
The current code is likely to perform a lazy flush of the lookahead
queue around 4 times a second.  Increase that to around 6-7 times a
second.  This change may slightly improve the responsiveness to user
requests mid-print (eg, changing extrusion ratio) and may make a
"print stall" less likely in some corner cases.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-10 11:07:50 -04:00
Kevin O'Connor
50cb362234 toolhead: Make sure to periodically yield to other tasks when buffering moves
Normally the toolhead code will flush the lookahead buffer every
~250ms and will briefly pause to avoid buffering too much data.  That
pause allows other tasks to run.  Make sure to periodically yield to
other tasks on each lookahead buffer flush even if a delay isn't
needed.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-10 11:07:50 -04:00
Kevin O'Connor
4415b988c1 toolhead: Clarify priming timer scheduling
Make sure each command gets an additional 100ms before flushing via
the priming timer.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-10 11:07:50 -04:00
Kevin O'Connor
6269dda56b sensor_lis2dw: Fix fifo_empty check on lis2dw chips
Fix inverted check for fifo empty.  The fifo is empty when the number
of entries in the fifo is zero.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-09 19:06:44 -04:00
Kevin O'Connor
cba7a285e4 trapq: Extend trapq_extract_old() to also check active moves
Support extracting moves from both the "live" trapq->moves as well as
the "history" from trapq->history storage.  Now that moves are flushed
separately from the lookahead queue, there is a good chance that the
current move being processed on the mcus will still be in the active
trapq list.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-09 13:22:32 -04:00
Kevin O'Connor
b85b92fdfb toolhead: Don't enter "Priming" state on a dwell()
After a toolhead dwell, there is no reason to enter the priming state
and to create the priming exiration timer.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-08 23:08:36 -04:00
Kevin O'Connor
7f177aad1a toolhead: Minor code movement
Move flushing and priming code together.  No code changes - only code
movement.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-08 23:08:36 -04:00
Kevin O'Connor
3f9733d04d toolhead: Move priming logic from _check_pause() to new _check_priming_state()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-08 23:08:36 -04:00
Kevin O'Connor
8fd263ca69 toolhead: Add a lookahead.is_empty() helper function
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-08 23:08:36 -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()
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
b7602ff969 input_shaper: Fixed initialization for dual_carriage
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2025-10-06 15:41:22 -04:00
Dmitry Butyugin
470803853e docs: Documentation for Z axis input shaper and resonance measurements
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2025-10-04 19:50:34 -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
Kevin O'Connor
c49dbb5a87 trapq: Fix bug that broke numerical stability workaround for initial movement
Commit b60804bb changed the trapq head sentinel to store
print_time=-1.  However, it failed to update trapq_add_move() that
relied on that value to detect the head sentinel.  As a result,
numerical stability issues could lead to stepcompress errors.

Fix by changing trapq_add_move() to detect the head sentinel even with
a negative print_time.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-04 19:35:41 -04:00
Dmitry Butyugin
768b19e8be input_shaper: Limit maximum damping_ratio of the shapers
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