Commit graph

3090 commits

Author SHA1 Message Date
Kevin O'Connor
58cc059e31 sensor_ldc1612: Convert homing code to use trigger_analog system
Remove the homing code from sensor_ldc1612.c and utilize the generic
homing support found in trigger_analog.c .

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-01-25 12:49:01 -05:00
Kevin O'Connor
147022dee2 trigger_analog: Update to support generic trigger types
Rework the trigger_analog code to support different "trigger"
conditions.  This merges in features of ldc1612.c into
trigger_analog.c, such as error code reporting in the MCU.  This is in
preparation for using trigger_analog with ldc1612.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-01-25 12:49:01 -05:00
Kevin O'Connor
87c8b505a7 trigger_analog: Attach trigger_analog to sensor during initialization
Avoid setting up a "connect" callback - just register the association
using mcu.add_config_cmd() .

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-01-25 12:49:01 -05:00
Kevin O'Connor
5bd791d96e hx71x: Make sure to use the same cmd_queue for all commands
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-01-25 12:49:01 -05:00
Kevin O'Connor
f9b1b9c1b5 trigger_analog: Create trigger_dispatch within MCU_trigger_analog
Don't require callers of MCU_trigger_analog to create the
mcu.TriggerDispatch() instance - instead, create it within the
MCU_trigger_analog() class.

Also, make it easier to use MCU_trigger_analog without an
MCU_SosFilter - the MCU_trigger_analog can automatically create an
empty filter if needed.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-01-25 12:49:01 -05:00
Kevin O'Connor
402303aa22 trigger_analog: New trigger_analog.py file
Rename sos_filter.py to trigger_analog.py and copy MCU_trigger_analog
class from load_cell_probe.py to this new file.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-01-25 12:49:01 -05:00
Kevin O'Connor
165fe1730d load_cell_probe: Move phoming.probing_move() interface to MCU_trigger_analog
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-01-25 12:49:01 -05:00
Kevin O'Connor
067539e0a3 load_cell_probe: Move set_endstop_range() code to LoadCellProbingMove
Move this load cell specific code from MCU_trigger_analog class to
LoadCellProbingMove class.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-01-25 12:49:01 -05:00
Kevin O'Connor
7ec82baca3 sos_filter: Move offset/scale support from trigger_analog.c to sos_filter.c
Support offsetting and scaling the initial raw value prior to
processing in the sos_filter.

Remove that support from trigger_analog.c .

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-01-25 12:49:01 -05:00
Kevin O'Connor
109f13c797 sos_filter: Consistently use "frac_bits" instead of "int_bits"
Internally describe the Qx.y format using the number of fractional
bits.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-01-25 12:49:01 -05:00
Kevin O'Connor
3b5045ed9e sos_filter: Handle fixed point conversion within MCU_SosFilter
Merge the logic from the FixedPointSosFilter class into the
MCU_SosFilter class.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-01-25 12:49:01 -05:00
Kevin O'Connor
6413399784 sos_filter: No need to support "is_init" in MCU_SosFilter
Rename the SosFilter class to MCU_SosFilter.  Automatically reload the
filter coefficients on a reset_filter() call, so there is no need to
support loading of the filter at init time.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-01-25 12:49:01 -05:00
Kevin O'Connor
ec08ff5a1e trigger_analog: Rename load_cell_probe.c to trigger_analog.c
Rename the mcu based load_cell_probe code to trigger_analog.  This is
a rename of the C code files, struct names, and command names.  There
is no change in behavior (other than naming) with this change.

This is in preparation for using the load_cell_probe functionality
with other sensors.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-01-25 12:49:01 -05:00
Kevin O'Connor
2956c1e223 probe: Support passing gcmd to probe.get_offsets()
Make it possible for the probe's get_offsets() code to depend on the
parameters of the probe request.  This is in preparation for eddy
"tap" support.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-01-25 12:47:29 -05:00
Kevin O'Connor
a353efa5b6 probe: Return to start XY position on each attempt in PROBE_ACCURACY
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-01-21 12:13:15 -05:00
Kevin O'Connor
32a5f2b042 probe: Deprecate last_z_result and add new last_probe_position
Deprecate the PROBE command's exported value
`{printer.probe.last_z_result}`.  This value effectively returns the
toolhead Z position when the probe triggers and user's then need to
adjust the result using the probe's configured z_offset.

Introduce a new `{printer.probe.last_probe_position}` as a
replacement.  This replacement has an easier to understand behavior -
it states that the probe hardware estimates that if the toolhead is
commanded to last_probe_position.x, last_probe_position.y and descends
then the tip of the toolhead should first make contact at a Z height
of last_probe_position.z .  That is, the new exported value already
takes into account the probe's configured xyz offsets.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-01-21 12:13:15 -05:00
Kevin O'Connor
2a1027ce41 probe: Convert pull_probed_results() to return ProbeResult
Change the low-level probe code to return ProbeResult tuples from
probe_session.pull_probed_results().  Also update callers to use the
calculated bed_xyz values found in the tuple instead of calculating
them from the probe's xyz offsets.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-01-21 12:13:15 -05:00
Kevin O'Connor
f33c76da22 load_cell_probe: Pass probe_offsets to TapSession()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-01-21 12:13:15 -05:00
Kevin O'Connor
8c2c90b8d6 probe_eddy_current: Pass probe_offsets class to EddyDescend
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-01-21 12:13:15 -05:00
Kevin O'Connor
252fc18c12 probe: Pass probe_offsets to HomingViaProbeHelper() class
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-01-21 12:13:15 -05:00
Kevin O'Connor
2e0c2262e7 probe: Convert ProbePointsHelper to use ProbeResult
Change the ProbePointsHelper class to return ProbeResult tuples.
Callers of this class are also updated so that they use the tuple's
bed_xyz parameters instead of manually calculating these values from
the probe xyz offsets.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-01-21 12:13:15 -05:00
Kevin O'Connor
9ccb4d96e9 manual_probe: Report final probe results in new ProbeResult named tuple
Return the manual probe results in a named tuple containing (bed_x,
bed_y, bed_z, test_x, test_y, and test_z) components.  For a manual
probe the test_xyz will always be equal to bed_xyz, but these
components may differ when using automated z probes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-01-21 12:13:15 -05:00
Kevin O'Connor
3c56eb7f6f load_cell_probe: Enhance regression test case
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-01-21 12:06:27 -05:00
Kevin O'Connor
8be004401e probe_eddy_current: Implement regression test case
Update the code to support simple regression test cases.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-01-20 11:34:21 -05:00
Kevin O'Connor
57b94520de mcu: Generate a dummy response to query commands when in debugging mode
Previously a querycmd.send() request would silently hang if the code
is run in "file output" mode (that is, it is not communicating with a
real micro-controller).  This behavior makes it hard to implement
regression tests and is generally confusing.

Change the code to respond with a dummy response (typically all zeros
and empty strings) instead.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-01-20 11:34:21 -05:00
Kevin O'Connor
1cde5e2018 mcu: Pass conn_helper to CommandWrapper and CommandQueryWrapper
Pass the low-level MCUConnectHelper class to these helper classes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-01-20 11:34:21 -05:00
Kevin O'Connor
48f0b3cad6 gcode_move: Export more than 4 components in gcode_position status
Some checks failed
Build test / build (push) Has been cancelled
Commit f04895f5 documented that "{printer.gcode_move.gcode_position}"
may contain more than 4 components, however the code was not actually
updated to export that additional information.  (Commit ac6cab91 only
made the change to "homing_origin" and "position".)

Export the information in gcode_position as intended.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-01-11 17:30:28 -05:00
Dmitry Butyugin
2bd0acb6ca exclude_object: Fixed object exclusion with changing GCode axes
Some checks failed
Build test / build (push) Has been cancelled
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2026-01-09 20:37:06 -05:00
Timofey Titovets
f1bd17d83d ldc1612: decode error flags
Most errors, aside from amplitude, should never happen.
Output them to the log to simplify later debugging.
Count them to aggregate error metrics.

Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
2026-01-08 12:00:45 -05:00
Timofey Titovets
f7ddb40037 ldc1612: handle i2c errors
I2C error means we don't know the sensor status.
Force data output to the host and cancel homing.

Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-01-08 12:00:45 -05:00
Kevin O'Connor
8bca4cbcd9 static_pwm_clock: Don't rely on custom stm32_timer_output mcu code
Use the regular hardware pwm interface instead of relying on a custom
interface.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-01-06 21:53:29 -05:00
Timofey Titovets
abda66d6ef ldc1612: enable frequency div to reduce noise
Some checks failed
Build test / build (push) Has been cancelled
BTT Eddy uses 12MHz clock in frequency.
Coil is oscillating at 3+MHz.
Which is out of spec for LDC1612 sensors.
Division of coil frequency seems to reduce output noise.

Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
2026-01-04 15:56:21 -05:00
MRX8024
8dd798ebb8 tmc: Fix stepper:set_dir_inverted event handler name
Some checks failed
Build test / build (push) Has been cancelled
The event handler is registered with an incorrect event name, causing the handler to never be called.

Signed-off-by: Maksim Bolgov maksim8024@gmail.com
2025-12-31 19:33:50 -05:00
Timofey Titovets
51dcb09d12 probe_eddy_current: reload z_offset probe helper
Some checks failed
Build test / build (push) Waiting to run
klipper3d deploy / deploy (push) Has been cancelled
Currently, there is no way to adjust the calibration curve.
The existing z_offset infrastructure is not applicable
or disabled here.

To make it possible to fine tune calibration curve.
Reload Z_OFFSET helper for probe_eddy_current.

Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
2025-12-30 19:40:47 -05:00
Kevin O'Connor
8ea7be5dd7 tmc: Hold a mutex during enable/disable checking
It's possible for a motor disable request to occur while processing a
previous motor enable.  Use a reactor mutex to ensure the two events
are processed serially.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-12-30 18:34:55 -05:00
Kevin O'Connor
d5ef924751 tmc: Simplify TMCCommandHelper() error checking
Move shutdown checking from _do_enable() and _dos_disable() to new
enable_disable_cb().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-12-30 18:34:55 -05:00
Kevin O'Connor
db35e99ea1 tmc: Group code startup functions together in TMCCommandHelper()
Code movement only; no code changes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-12-30 18:34:55 -05:00
Timofey Titovets
1fdf0ebaf4 static_pwm_clock: define module for stm32
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
2025-12-30 18:14:37 -05:00
Timofey Titovets
8b58aa1302 probe_eddy_current: show noise at distinct calibration points
Some checks failed
Build test / build (push) Has been cancelled
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
2025-12-21 12:28:07 -05:00
Timofey Titovets
a40beb7b1b probe_eddy_current: filter noisy calibration points
A misplaced sensor or a misconfigured one
can return unreliable results.
Assist with this by refusing to use the too noisy points.
Filter noisy points by the frequency difference to noise ratio.

Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
2025-12-21 12:28:07 -05:00
Kevin O'Connor
a8cbc93552 bus: Verify that software i2c pins are all on the same mcu
Some checks failed
Build test / build (push) Has been cancelled
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2025-12-17 10:48:04 -05:00
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()
Some checks failed
Build test / build (push) Has been cancelled
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
Some checks failed
Build test / build (push) Has been cancelled
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)
Some checks failed
Build test / build (push) Has been cancelled
klipper3d deploy / deploy (push) Has been cancelled
"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