3049 Commits

Author SHA1 Message Date
Kevin O'Connor
867d73f0b8 serialqueue: Make 31-bit clock overflow check a little more robust
Allow reqclock to be slightly less than the transmitted messages's
deadline.  That is, delay messages with a reqclock far in the future
to slightly past (1<<31) ticks from its deadline.  Use (3<<29)
instead, which gives an additional (1<<29) grace period to avoid clock
overflows.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-12-14 15:55:57 -05:00
Kevin O'Connor
8e6e467ebc mcu: Fix incorrect reqclock during endstop homing
For correct operation the trsync system must be programmed prior to
the start of endstop checking.  This means the desired "reqclock" for
the trsync configuration messages need to use the same "clock" that
the endstop start message uses - even though the actual deadline for
these messages is later.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-12-14 15:31:09 -05:00
Kevin O'Connor
f52a6f9491 output_pin: Rename "delay" flag to "repeat" in GCodeRequestQueue()
Rename the flag to make it more clear what it does.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-12-10 13:39:26 -05:00
Timofey Titovets
2b4c55ffd1 servo: sync pwm clock times
Arriving of SW PWM out of sync
can cause pulse width distortion - make them longer
Synchronize the update clock to avoid that

Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-12-10 13:39:26 -05:00
Timofey Titovets
f9108496a1 ldc1612: fix data rate calculation
There is no need to remove 4 from data rate.
Formula for conversion time is: (RCOUNT0×16)/ƒREF0

Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
2025-12-10 13:38:42 -05:00
Kevin O'Connor
2e5802370c serialqueue: Tune MIN_REQTIME_DELTA timing
The MIN_REQTIME_DELTA parameter controls when the host will flush
incomplete message blocks to the mcu.  If the message had a target
time less than 250ms it would result in a flush even if a message
block was not completely full.

In the situation where the host generates lots of queue_step commands
to the point that it fills the mcu move_queue, then it would be
possible for individual queue_step commands to become eligible for
transmit only microseconds apart.  It could also lead to a situation
where the target time was less than 250ms in the future.  The result
could lead to many small message blocks as each became flushed
individually.

Tune the MIN_REQTIME_DELTA to 100ms to reduce the chance of this.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-12-03 17:47:50 -05:00
hilbo86
9c84895a09 ads1x1x: Interface for "QUERY_ADC" (#7132)
"QUERY_ADC" command will fail without "get_last_value" function.

Signed-off-by: Timo Hilbig <timohilbig@t-online.de>
2025-11-30 16:52:22 -05:00
minicx
9ac90f8752 aht10: Add AHT10 as alias for AHT1X for backwards compatibility
Signed-off-by: Lev Voronov <minicx@disroot.org>
2025-11-30 16:50:11 -05:00
minicx
1f43be0b8b aht10: Add support for AHT2x/AHT3x families
Split into three classes with proper init commands:
- AHT1x: 0xE1 (AHT10, AHT15)
- AHT2x: 0xBE (AHT20, AHT21, AHT25)
- AHT3x: auto-cal (AHT30)

Signed-off-by: Lev Voronov <minicx@disroot.org>
2025-11-30 16:50:11 -05:00
minicx
355b6cee8c aht10: Fix status bit masks
Signed-off-by: Lev Voronov <minicx@disroot.org>
2025-11-30 16:50:11 -05:00
Timofey Titovets
a9cf02c412 sosfilter: handle high order butter filters
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
2025-11-26 14:11:20 -05:00
Timofey Titovets
900c908db8 sosfilter: fix case if no notch is defined
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
2025-11-26 14:11:20 -05:00
Dmitry Butyugin
79189203e2 generic_cartesian: Added option 'axis' for primary carriages
This also enables arbitrary using names for primary carriages
with generic_cartesian kinematics.

Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2025-11-25 18:12:43 -05:00
Dmitry Butyugin
0ba01beaa8 kinematic_stepper: Fixed reporting of parse errors
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2025-11-25 18:12:43 -05:00
Dmitry Butyugin
baf188bd62 shaper_calibrate: Fixed sending large objects via Pipe from bg process
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2025-11-21 17:48:56 -05:00
Dmitry Butyugin
c339bb0cdf shaper_calibrate: Reworked best shaper recommendations
* Do not recommend ZV shaper by default if possible
* Try to find more optimal shaper out of more aggressive ones

Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2025-11-21 17:48:56 -05:00
Dmitry Butyugin
2aff840f68 shaper_calibrate: Reworked multi-file shaper autocalibration
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2025-11-21 17:48:56 -05:00
Kevin O'Connor
90b7f8230d mcu: Rework formatting of MAX_SCHEDULE_TICKS error string
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-11-17 18:30:49 -05:00
Pascal
053342f642 MCU: Fail early if clock speed is too high to support max nominal duration (#7122)
This adds a dedicated check for that case to be able to
find the root cause of a misconfiguration earlier.

Also, replace occurrences of hardcoded max tick count.

Signed-off-by: Pascal Pieper <accounts@pascalpieper.de>
2025-11-17 18:28:43 -05:00
Timofey Titovets
edaa61471f bme680: fix infinite data wait
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
2025-11-14 18:47:27 -05:00
Kevin O'Connor
ecccd21f2a toolhead: Don't report dummy extruders in extra_axes status report
A "dummy extruder" that is created when no "[extruder]" config section
is defined does not have a "name".  Avoid reporting that empty name in
the `{printer.toolhead.extra_axes}" status report.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-11-11 11:26:57 -05:00
Kevin O'Connor
db7acaa34a motion_report: Fix off-by-one error in live_extruder_velocity calculation
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-11-09 18:57:16 -05:00
Kevin O'Connor
c3bf7b109e motion_report: Support reporting live_position of extra axes
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-11-06 10:19:00 -05:00
Kevin O'Connor
24a1116c7c motion_report: Support reporting of manual_stepper trapqs
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-11-06 10:19:00 -05:00
Kevin O'Connor
67db551be5 toolhead: Export "extra axes" coordinates in status
Update the "position" status to include extra axes.  Export a new
"extra_axes" value that describes the class associated with each
component of the coordinate.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-11-06 10:19:00 -05:00
Kevin O'Connor
ac6cab9168 gcode_move: Export extra axes in status reference
Change "homing_origin" and "position" to support more than 4
components.  Export a new "axis_map" value to describe the contents at
each component index.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-11-06 10:19:00 -05:00
Kevin O'Connor
d0b1b832dd gcode: Change Coord() class to initialize from a list or tuple
Instead of passing arguments as parameters, pass them as a list (or
tuple).  This simplifies the callers and makes it easier to pass
additional parameters.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-11-06 10:19:00 -05:00
Kevin O'Connor
01b3a6a8e4 gcode: Replace Coord named tuple with custom tuple class
Replace the existing Coord() class with one that supports more than 4
coordinates.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-11-06 10:19:00 -05:00
Kevin O'Connor
b6c1b5a6dd serialqueue: Minor simplification in serialqueue_extract_old()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-11-04 12:35:26 -05:00
Kevin O'Connor
35dffc1516 serialqueue: Rework check_wake_receive() to receive_append_wake()
Rename the function and perform list appending and locking in that
function.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-11-04 12:15:37 -05:00
Kevin O'Connor
459e77c4f9 serialqueue: Keep moving messages from pending queues to ready queues
Keep moving messages from the pending queues to the ready queues even
if it's not currently valid to transmit messages to the mcu.  This
improves the statistics when debugging.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-11-04 12:15:37 -05:00
Kevin O'Connor
804a9d11e8 serialqueue: Reduce time transmit_requests lock is held
Only hold the lock in the serialqueue thread when moving messages to
the ready queue and when setting the next need_kick_clock.

Only set the need_kick_clock just prior to sleeping.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-11-04 12:15:37 -05:00
Kevin O'Connor
bfb627c3d0 serialqueue: Cache min_release_clock in pending queues
Maintain the next needed wakeup time for entries in the pending
queues.  This avoids needing to walk the upcoming queues when it is
known that nothing is ready to be released.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-11-04 12:15:37 -05:00
Kevin O'Connor
cfb616664e serialqueue: Introduce new check_upcoming_queues() internal function
Move the upcoming queue movement logic to a new function.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-11-04 12:15:37 -05:00
Kevin O'Connor
d453ab3d19 serialqueue: Simplify command_event()
There's no reason to attempt to handle multiple buffer transmissions
in a single command_event() call.  Handle the transmit case outside of
the command building loop.

If data is transmitted, then get a new timestamp from the pollreactor
and retry before sleeping.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-11-04 12:15:37 -05:00
Kevin O'Connor
7634773cf1 serialqueue: Move definition of transmit_requests in serialqueue
Move the definition of the struct so that it is more clear that it has
its own locking.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-11-04 12:15:37 -05:00
Timofey Titovets
46af133613 serialqueue: decouple transmit requests
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
2025-11-04 12:15:37 -05:00
Timofey Titovets
4a00e4b0ec serialqueue: decouple serialhdl receive lock
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
2025-11-04 12:15:37 -05:00
Timofey Titovets
ba79d72fb4 serialqueue: decouple pending & ready queues
Simply describe how the cmdqueue is moved between states.

This is commit d7da45e1 resubmitted with a slighly different
implementation.  It is thought that the previous implementation was
causing a gcc compiliation issue on gcc v12.0-v12.4 compilers.  (It
may be related to gcc bug report 107467).

Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-10-30 20:16:25 -04:00
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