BitBoxSwiss / bitbox02-firmware

Firmware code of the BitBox02 hardware wallet
https://bitbox.swiss/bitbox02
Apache License 2.0
217 stars 81 forks source link

Subtract min sensor value per slider #1042

Closed douglasbakkum closed 1 year ago

douglasbakkum commented 1 year ago

This improves touch position accuracy in noisy setups.

Touch position is calculated with a weighted average of the sensor readings. If properly calibrated, sensors on the opposite end of a finger touch would be zero and thus make no contribution to the weighted average. If the baseline sensor readings are elevated, the sensors on the opposite edge do contribute to the weighted average, making a positional artifact (i.e. the position is more central than it should be in reality). This artifact is higher when the finger is a bit distant while approaching and lower/negligible when the finger is fully touching the device. This can cause the position to move enough to enter "slide" mode and disable "tap" events being emitted.

benma commented 1 year ago

@douglasbakkum to format the code (fix the CI issue), run ./scripts/docker_exec.sh ./scripts/format outside dockerdev or ./scripts/format inside dockerdev.

benma commented 1 year ago

@douglasbakkum please add an entry to CHANGELOG.md :smile:

douglasbakkum commented 1 year ago

@benma 👍 added

douglasbakkum commented 1 year ago

ack. happy for the nit and explanation. now squashed and pushed