Avoid potential underflow when evaluating x - y with y > x.
Evaluate it only when y <= x instead.
Avoid clearing indicators in background task
since another watch face is likely active.
Reviewed-by: Matheus Afonso Martins Moreira <matheus@matheusmoreira.com>
GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/440
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 <matheus@matheusmoreira.com>
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
Adds the ability to configure at compilation time
the movement's default birth date and location.
Tested-by: madhogs <madhogs@protonmail.com>
Tested-by: Niehztog <niehztog@gmail.com>
Tested-on-hardware-by: madhogs <madhogs@protonmail.com>
Tested-on-hardware-by: Niehztog <niehztog@gmail.com>
Reviewed-by: Matheus Afonso Martins Moreira <matheus@matheusmoreira.com>
GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/387
The movement was checking for scheduled tasks
by comparing for equality their scheduled times to
the current time. However, it is possible that the time
has moved past the scheduled time by the time the
function executes, leading to scheduled tasks not
being executed and therefore to missed deadlines.
Changing it to `<=` fixes the problem by taking that
possibility into account.
Helped-by: Wesley Ellis <tahnok@gmail.com>
Reviewed-by: Matheus Afonso Martins Moreira <matheus@matheusmoreira.com>
GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/439
The TOTP watch face has gained a new declarative API
for defining secrets directly in the source code but the
documentation still describes the old interfaces.
This pull request brings the documentation up to date
with currect practice.
Reviewed-by: Matheus Afonso Martins Moreira <matheus@matheusmoreira.com>
GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/441
The t and y characters were not being displayed optimally
in certain positions. This commit improves it substantially
by internally remapping those characters to better looking
characters when displaying on those positions.
Tested-by: David Volovskiy <devolov@gmail.com>
Reviewed-by: Matheus Afonso Martins Moreira <matheus@matheusmoreira.com>
GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/443
References: https://hchargois.github.io/sensor-watch-playground/
The devcontainer image stopped working
because the requested Ubuntu image
was too outdated. This pull request
brings it up to date and it should remain
functional until 2029. It also enables
use of the emulator by installing the
needed dependencies.
Reviewed-by: Matheus Afonso Martins Moreira <matheus@matheusmoreira.com>
GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/442
This PR updates the .devcontainer Dockerfile which was no longer
working. Attempting to build an image from the Dockerfile would result
in an error:
```
E: The repository 'http://archive.ubuntu.com/ubuntu kinetic Release' does not have a Release file.
```
AFAIU, this is because the 22.04 release is no longer supported. I
changed the base image to the current LTS release, which should remain
supported until 2029.
In addition, the Dockerfile is also modified to install `emscripten` APT
package. While this is not the recommented installation method from the
Emscripten docs, it is much more convenient and works enough to build
the simulator using the resulting Docker image.
The TOTP face header file documentation contained outdated instructions
for configuring the complication with TOTP credentials. This PR updates
the documentation to match what is expected in `totp_face.c`.
To allow a valid date to be set the `set_time_face` cycles through the
valid days for a given month. July was incorrectly encoded as having 30
days (it has 31!)