From: Matheus Afonso Martins Moreira Date: Wed, 28 Aug 2024 13:30:44 +0000 (-0300) Subject: Merge PR #437 - debouncing logic X-Git-Url: https://git.earman.xyz/?a=commitdiff_plain;h=a715265;p=sensor-watch.git Merge PR #437 - debouncing logic Mechanical switches exhibit temporary voltage fluctuations when electrical contact is made, which manifest as "bouncing" between the logical high and low states. Sampling the switch's state during this period of stability produces invalid results. The switch must be debounced by ignoring the generated interrupts until the switch's state has stabilized. This is implemented by delaying the input events until an empirically determined time has elapsed. As such this pull request introduces customizable high resolution timers for debouncing button down and up events. This software debouncing unfortunately increases the sensor watch's input latency. This is an acceptable tradeoff due to better usability: watch faces which require holding down buttons such as the pulsometer should work much more reliably after this patch. Reviewed-by: Matheus Afonso Martins Moreira Tested-on-hardware-by: Krzysztof Gałka <@kshysztof@Discord> GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/437 References: https://en.wikipedia.org/wiki/Switch#Contact_bounce --- a715265af61ecab41eaefe0c5a7e7c806d0db41b