Create the class at the start of PrinterEddyProbe and call it as
needed. This makes the class life-cycle similar to EddyDescend.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Rework the internal EddyGatherSamples() class with a goal of making it
easier to add tap analysis in the future.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Commit 2e0c2262e incorrectly changed the internal fpt variable from a
list to a tuple.
Reported by @nefelim4ag.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add a setting that will enable the mcu sos_filter code to
automatically set an offset using the first read measurement.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Add a new set_start_state() method to MCU_SosFilter that can arrange
for the filter to better handle a non-zero initial starting state.
Also, this removes the previous 1.0 gram initial start state for load
cells as it tares the initial value.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>
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>
Check if the trigger_analog struct has been allocated in
trigger_analog_update() itself. This makes the code easier to use in
the sensor code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>
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>
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>
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>
It's reasonable to deactivate the filter by setting n_sections=0, and
this makes the code a little easier to use when the host doesn't
actually need any filtering.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>
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>
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>
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>
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>
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>
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>
Avoid using mcu.CommandQueryWrapper() and mcu.CommandWrapper()
classes. Instead, implement local variants of these classes. This
will make it easier to modify the mcu classes without fear of breaking
the spi_flash code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
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>
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>
If the sensor coil is disconnected, the frequency is equal to the reference.
If the sensor is misconfigured or damaged, the coil frequency is
greater than 1/4 of the reference frequency.
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
Amplitude errors are useful but often too aggressive.
On some sensors, it is not possible to avoid them completely.
Make them non-critical for homing.
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
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>