Generate intermediate updates if a set_pwm() call schedules an update
far in the future.
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Allow the "tap_threshold" to be overriden during PROBE type commands.
This makes it easier to calibrate an initial tap_threshold.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Verify no gaps at start and end of requested capture range.
Raise an error if a gap is detected.
Raise an error if not enough data collected during "tap".
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Register an event handler to make sure measurements are stopped if a
gcode error occurs while using EddyScanningProbe. EddyTap and
EddyDescend use ProbeSessionHelper which already provides this
handling, but EddyScanningProbe doesn't use that wrapper so it must be
implemented manually.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Increase ADC report time from every 15ms to every 10ms and batch every
5 reports into a single message. This should improve the
responsiveness and reduce the communication overhead when using ADC
buttons.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Change the get_last_value() method to return time first then value
(instead of value, then time). This makes get_last_value() match the
order of parameters that is used in the adc update callback.
This also fixes ads1x1x to return the "print_time" instead of a system
time.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Replace the integer values of STOP_ON_ENDSTOP with string values and
deprecate the older format. The newer string values should make the
commands easier to understand and allow for more homing options in the
future.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This adds host and firmware support for the Bosch BMI160 IMU. It includes support for both SPI and I2C communication protocols.
The firmware implementation includes a specific SPI wake-up sequence (dummy read) required to switch the sensor interface mode reliably. Validated on Linux MCU (SPI) and RP2040 (I2C) with stable 1600Hz ODR.
Signed-off-by: FranciscoStephens <francisco.stephens.g@gmail.com>
Commit 2a1027ce changed the "probe:update_results" event to take a
list, but failed to update the callers to utilize that modified list
in its results.
Change axis_twist_compensation to update all members in the list and
change the callers to use the resulting list.
Reported by @ritzi26.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
If the bus is write only, with new i2c_transfer code
it is possible to at least provide some feedback on error
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
PROBE_CALIBRATE will try to adjust z_offset
Which will produce a confusing outcome and
will not do what it is supposed to do
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
There are some rare corner cases where reporting the peak time could
cause hard to debug issues (for example, the peak time could
theoretically be a significant time prior to the actual trigger time,
which could possibly cause unexpected clock rollover issues). Now
that the host code does not utilize the peak time for "tap" detection,
it can be removed from the mcu code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
To cancel out any lag, filter data on the host
Then to avoid derivatives lag,
compute central difference.
Assume that peak velocity is always the moment
right before collision happens.
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
To implement host-side analysis of tap data,
we need a way to apply the same filtering as on the mcu.
As bonus, it cancels the induced signal delay.
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Use SOS filters + derivative filter to generate dF/dT on mcu.
Feed that to the MCU's trigger_analog peak detection.
Interpret peak time as a tap event
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
Signed-off-by: Timofey Titovets <nefelim4ag@gmail.com>
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>
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>