I've added an optional median filter using the RunningMedian library (https://github.com/RobTillaart/RunningMedian), which can help filtering noisy sensors like bend/flex sensors or hall sensors. Default disabled, and the library only needs to be installed if enabled.
I've also added clamps to the values produced by mapping the analogRead() output against the 0 .. ANALOG_MAX range, which helps when constant calibration is disabled to prevent under or overflow. Defaults enabled.
Additionally I've added clamps to the possible flexion min and max values, which helps with my bend and hall sensor gloves which can occasionally produce spurious output that reach past the normal min/max values. This lets you tune the possible range of calibration values and prevents the min/max used in the map from going out of control. Defaults disabled.
Finally, I've replaced the math being done to calibrate across the 0 .. ANALOG_MAX range with the arduino map() function, for simplicity. I've verified that the values produced by the original equation and those produced by the map() function are identical, so this should not produce a functional change.
I've added an optional median filter using the RunningMedian library (https://github.com/RobTillaart/RunningMedian), which can help filtering noisy sensors like bend/flex sensors or hall sensors. Default disabled, and the library only needs to be installed if enabled.
I've also added clamps to the values produced by mapping the analogRead() output against the 0 .. ANALOG_MAX range, which helps when constant calibration is disabled to prevent under or overflow. Defaults enabled.
Additionally I've added clamps to the possible flexion min and max values, which helps with my bend and hall sensor gloves which can occasionally produce spurious output that reach past the normal min/max values. This lets you tune the possible range of calibration values and prevents the min/max used in the map from going out of control. Defaults disabled.
Finally, I've replaced the math being done to calibrate across the 0 .. ANALOG_MAX range with the arduino map() function, for simplicity. I've verified that the values produced by the original equation and those produced by the map() function are identical, so this should not produce a functional change.