3189 Commits

Author SHA1 Message Date
Neelix
373f200ca6 polar: add velocity scaling (#7172)
Print near the origin lead in to fast motor movements, therefore the
movement needs to be scaled down. The start of the scaling is done via
a rotation velocity limit from the config.

Signed-off-by: Nils Hensch <nils.hensch@gmx.de>
2026-04-16 10:52:33 -04:00
Kevin O'Connor
6b4aeb4c44 probe_eddy_current: Scale intermediate values within the "tap" sos filter
Scale the internal mcu values to units of milli-hz to reduce the
chance of roundoff error in the internal calculations.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-04-15 10:39:39 -04:00
Kevin O'Connor
9c3ba2e3a5 trigger_analog: Automatically determine frac_bits in MCU_SosFilter
The coeff_frac_bits and scale_frac_bits can be automatically
calculated, so there's no need for the callers to specify this
information.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-04-15 10:15:24 -04:00
Kevin O'Connor
b1bbd6dabe trigger_analog: Implement rounding in to_fixed_32()
Round the SOS filter coefficients to the nearest integer (instead of
truncating).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-04-15 10:13:18 -04:00
Kevin O'Connor
2a5c2fe35c trigger_analog: Require trigger_value to be an integer
Have the callers convert convert the trigger_value from a float to an
integer (if necessary).  This is in preparation for implementing
rounding in to_fixed_32().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-04-15 10:13:18 -04:00
Kevin O'Connor
aea1bcf56e probe_eddy_current: Allow "tap" depress of as little as 30um
There have been some reports of the sanity check throwing an error
when the bed is depressed just under 50um.  For now, increase the
valid depress range to avoid unnecessary errors.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-04-12 19:56:33 -04:00
Kevin O'Connor
db78babf91 probe_eddy_contact: Add sanity checks to "tap" analysis
Implement some basic checks on the tap results and report an error if
the results look obviously incorrect.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-04-12 12:30:05 -04:00
Kevin O'Connor
ec4b88db7b probe_eddy_current: Allow other timers to run while processing tap data
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-04-12 12:16:11 -04:00
Kevin O'Connor
55d7ed1aa9 probe_eddy_current: Increase "tap" calculation precision to 50nm
Continue to run least squares evaluations until the uncertainty range
is within 50 nanometers (reduced from 250nm).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-04-12 12:16:11 -04:00
Kevin O'Connor
5680b74b1d probe_eddy_current: Cache data between each "tap" least squares calculation
Directly calculate the evaluated matrices instead of using
mat_mat_mult() and mat_transp().

Cache the intermediate summations to improve processing when using
similar z guesses.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-04-12 12:15:55 -04:00
Kevin O'Connor
c1ed295db2 probe_eddy_current: Remove dependency on numpy
Use the least squares solution code in the local mathutil.py module
instead of using the numpy package.  This allows users to utilize the
"tap" functionality without requiring additional package installation.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-04-12 12:05:39 -04:00
Kevin O'Connor
3ef23b37a3 probe_eddy_current: Rework internal formulas for "tap" analysis
Use a different base frequency and base z value for the internal "tap"
least squares analysis to improve the numerical stability of the
calculations.

Rework the formulas being solved so that only the depressed slope
calculation is relative to the estimated z contact point.  This
results in less variables that are dependent on the z contact.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-04-12 12:05:39 -04:00
Kevin O'Connor
22dbdf1029 trigger_analog: Store pre-generated 25hz lowpass filter (at 250sps)
Store the 12 constants needed for the common probe_eddy_current "tap"
filter in trigger_analog.py code.  This avoids requiring "tap" users
to have the scipy python package installed.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-04-12 12:05:39 -04:00
Kevin O'Connor
c8b2ef0c21 probe_eddy_current: Allocate just enough SOS entries for filter
Support exporting the current SOS filter size from the DigitalFilter()
class.  Pass that value to the MCU_SosFilter() class to avoid
allocating unneccessary MCU memory (previously 5 entries were
allocated while only 3 are currently needed).

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-04-12 12:05:39 -04:00
Kevin O'Connor
28c236df46 trigger_analog: Merge DerivativeFilter into DigitalFilter
Replace the DerivativeFilter() class with a new add_derivative()
method in DigitalFilter() class.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-04-12 12:05:39 -04:00
Kevin O'Connor
f05c66cb9e trigger_analog: Add filters individually in DigitalFilter
Add new add_lowpass(), add_highpass(), add_notch(), and
setup_initial_state() methods to DigitalFilter.  Use these instead of
creating the filters from the constructor.

Also remove the unused filtfilt() method.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-04-12 12:05:39 -04:00
Dmitry Butyugin
12097eb4a9 mathutil: Added generic matrix pseudo-inverse with Gaussian elimination
Signed-off-by: Dmitry Butyugin <dmbutyugin@google.com>
2026-04-12 12:05:39 -04:00
Timofey Titovets
b8c936f7b8 gcode_button: ignore empty templates
A bouncing button can generate a lot of pending G-code
Each G-Code command will lock on the G-Code mutex

Decrease pressure by ignoring empty G-Code requests

Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
2026-04-09 12:12:10 -04:00
Maksim Bolgov
41b77b66df adxl345: Improve error messages for accelerometer config conflicts
Signed-off-by: Maksim Bolgov <maksim8024@gmail.com>
2026-04-08 15:00:44 -04:00
Maksim Bolgov
d487925b24 adxl345: Fix possible double registration of default gcode mux commands
Allow specifying only one unnamed accelerometer in the configuration file, which becomes the default.

Signed-off-by: Maksim Bolgov <maksim8024@gmail.com>
2026-04-08 15:00:44 -04:00
Maksim Bolgov
f2b36b71ff icm20948: Fix accelerometer type name in error message
Signed-off-by: Maksim Bolgov <maksim8024@gmail.com>
2026-04-08 15:00:44 -04:00
Maksim Bolgov
cb805f638f lis2dw: Fix accelerometer type name in logging
Signed-off-by: Maksim Bolgov <maksim8024@gmail.com>
2026-04-08 15:00:44 -04:00
Ben Lye
109aab9dc0 hall_filament_width_sensor: Avoid race conditions
Race conditions exist when `M221 S100` commands are sent outside the
timer, while the sensor is active. This intermittently prevents the flow
multiplier resetting to 100% when either flow compensation or the width
sensor are changed to disabled.

We can avoid this by moving the diable actions, including the `M221 S100`
commands, inside the timer loop and only using `M221` outside the timer
while the sensor is disabled.

Signed-off-by: Ben Lye ben@lye.co.nz
2026-04-08 14:57:04 -04:00
Ben Lye
3a0b834f3a hall_filament_width_sensor: Sync runout and width sensor states
Keeps the width sensor state in sync with the associated runout sensor and
normalizes the output when the width sensor is disabled.

When the width sensor was disabled the associated filament sensor remained
enabled but was no longer updated so would be 'stuck' in the last state it
was in before the width sensor was disabled.

The toggle switch and readings in the web interface could also be out of sync
with the actual sensor and filament states, misleading the user.

Now, when the width sensor is disabled:
- The filament sensor is disabled
- The reported filament state is 'present'
- The reported filament diameter is the nominal diameter

When the width sensor is enabled:
- The filament sensor is enabled
- The reported filament state is the derived state
- The reported filament diameter is the measured value

Finally, `min_diameter` is now used to determine the runout state rather than
a fixed value of `0.5`.

Signed-off-by: Ben Lye ben@lye.co.nz
2026-04-08 14:57:04 -04:00
Ben Lye
48446a5448 hall_filament_width_sensor: Add config validation
Adds two checks to prevent config settings which could lead to div-by-zero errors in specific circumstances:

- `raw_dia1` and `raw_dia2` must be different to prevent a possible exception in `adc2_callback`

- `max_difference` must be less than `default_nominal_filament_diameter` to prevent a possible exception in `extrude_factor_update_event`

Doc is also updated.

Signed-off-by: Ben Lye ben@lye.co.nz
2026-04-08 14:57:04 -04:00
Ben Lye
e75c281f52 hall_filament_width_sensor: Add command descriptions
Signed-off-by: Ben Lye ben@lye.co.nz
2026-04-08 14:57:04 -04:00
Ben Lye
4fba8e4829 hall_filament_width_sensor: Toggle for flow compensation
Adds a toggle to enable or disable flow compensation based on the
filament width sensor readings without disabling the sensor entirely.

Useful on printers where the hall effect sensor is too inaccurate to
helpfully adjust the extrusion multiplier, but is good enough to act as
a filament runout sensor.

The new setting defaults to true to preserve the existing sensor
behavior.

Existing width sensor G-Code commands are updated to optionally enable
and disable flow compensation and to show the state of the sensor and
command outputs are normalized.

Also includes updates to the relevant doc pages.

Signed-off-by: Ben Lye ben@lye.co.nz
2026-04-08 14:57:04 -04:00
iamthecage
0d1445a723 shaper_defs: Fix missing comma in 3-HUMP EI shaper matrix (#7235)
Signed-off-by: Asheley Willet <asheley.willet@gmail.com>
2026-03-31 11:00:00 -04:00
Kevin O'Connor
4db1bf8ac6 probe_eddy_current: Calculate "tap" position from lift movement
Don't calculate the nozzle/bed contact position from the descent
movement.  Instead, obtain the data during the lifting movement and
determine the contact point by analyzing where the nozzle separates
from the bed.

This improves the precision and repeatability of the "tap" results.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-03-24 13:13:37 -04:00
Kevin O'Connor
de280e237b probe_eddy_current: Retract at end of each "tap" probe
Perform lifting at the end of EddyTap.run_probe().  This is in
preparation for performing tap analysis during retraction.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-03-24 13:13:37 -04:00
Kevin O'Connor
e5c3dfe7a8 probe_eddy_current: Use different defaults for "scan", "rapid_scan" and "tap"
Add a new EddyParameterHelper to override ProbeParameterHelper.

Only use the printer.cfg lift_speed, samples, sample_retract_dist,
samples_result, samples_tolerance, and samples_tolerance_retries
settings for normal probe operations.  Don't use these defaults when
using a "METHOD" set to "scan", "rapid_scan", or "tap".  Each of these
probing mechanisms is distinct and it's unlikely a user could
meaningfully set a default for all of them.

Don't set sample_retract_dist when using "scan" and "rapid_scan"
modes.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-03-24 13:13:37 -04:00
Kevin O'Connor
6c8c8d24d7 probe_eddy_current: Support new tap_z_offset config parameter
Theoretically a "tap" probe should detect the exact point that the
nozzle contacts the bed.  In practice, however, there can be a
systemic bias that one may wish to account for.  This bias may be due
to backlash, thermal expansion, a detection bias, or similar issues.

Add a new tap_z_offset config parameter to allow users to specify an
offset.

Also, update the Z_OFFSET_APPLY_PROBE command to support modifying
this value.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-03-24 13:07:19 -04:00
Kevin O'Connor
20df766e21 probe_eddy_current: Rename config option z_offset to descend_z
The config option 'z_offset' name is confusing as its behavior is
notably different from how other probe hardware uses 'z_offset'.
Rename to 'descend_z' to make its behavior more clear.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-03-24 13:07:19 -04:00
Kevin O'Connor
7f5e918331 manual_probe: Introduce new create_probe_result() helper function
Add a new create_probe_result() helper function that can generate a
ProbeResult using a toolhead position and a set of probe offsets.

Use this helper in other modules.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-03-24 13:07:19 -04:00
Kevin O'Connor
6416d3e2ca reactor: Improve comments in _end_greenlet()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-03-20 14:22:24 -04:00
Kevin O'Connor
dcadac19b7 reactor: Move garbage collection logic from _check_timers() to new _check_gc()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-03-20 14:10:24 -04:00
Maksim Bolgov
01f089e710 heaters: Fix no heating on small max_power values (#7227)
If the config parameter "max_power" is less than 0.05, the heaters will never start heating. Added PWM threshold scaling with "max_power" value.

Signed-off-by: Maksim Bolgov <maksim8024@gmail.com>
2026-03-20 12:19:45 -04:00
Kevin O'Connor
0021798795 reactor: Move _g_dispatch updating from _dispatch_loop() to run()
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-03-19 18:27:27 -04:00
Kevin O'Connor
51ceda9ede reactor: Always create new greenlets from main process
If a greenlet is created from a greenlet then it seems the Python
interpreter will increment its call depth counter and that can
eventually lead to a RecursionError exception being raised.

To avoid this issue, switch back to the main run() instance if a new
greenlet needs to be created.

Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-03-19 18:27:27 -04:00
Kevin O'Connor
1370cf5c18 reactor: Simplify pause() call
Check for need to call _sys_pause() at start of pause().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-03-19 18:27:27 -04:00
Timofey Titovets
644cda5eca sht3x: fix exception type
Since 0bdee6b query commands return printer.command_error

Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
2026-03-09 22:19:27 -04:00
Timofey Titovets
88a71c3ce5 tmc: support tmc2240 sg4 homing
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-03-04 19:56:26 -05:00
Timofey Titovets
0c32f3bd99 tmc2240: allow enable SG4 threshold
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
2026-03-04 19:56:26 -05:00
Timofey Titovets
4f4a9a27a8 tmc: simplify homing start/end
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-03-04 19:56:26 -05:00
Kevin O'Connor
94604293e8 mcu: Improve unknown message response warnings in AsyncResponseWrapper
When delaying response registration, don't warn about any of these
messages that arrive prior to the aactual response registration.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-03-04 19:50:53 -05:00
Kevin O'Connor
c89393cdaf mcu: Rework mcu.register_response() to mcu.register_serial_response()
Rename mcu.register_response() to mcu.register_serial_response and
validate the message response format.

Only register the callbacks after the mcu has been initialized.  This
avoids invoking callbacks with data from a previous sessions, which
could lead to internal errors.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-03-04 19:50:53 -05:00
Kevin O'Connor
55577808cf mcu: Track if the mcu config phase has completed
Raise an error if mcu configuration commands are issued after the
config has been completed.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-03-04 19:50:53 -05:00
Kevin O'Connor
960813ac50 mcu: Minor code reorg in MCUConfigHelper
Split _send_config() into _finalize_config() and _send_cfg_init_commands().

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-03-04 19:50:53 -05:00
Kevin O'Connor
e234f2415d hx71x: Remove dead self.bulk_queue code
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-03-04 19:50:53 -05:00
Kevin O'Connor
f33292aacc ads1220: Remove dead self.bulk_queue code
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2026-03-04 19:50:53 -05:00