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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Allow specifying only one unnamed accelerometer in the configuration file, which becomes the default.
Signed-off-by: Maksim Bolgov <maksim8024@gmail.com>
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
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
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
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
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>