Creates a macro that returns the size of the presets array,
converting it into a compile time constant value that occupies
no memory and that compilers can constant fold into other expressions
potentially leading to dead code elimination.
This merge adds numerous individually small fixes and improvements
which amount to a sizeable set of features.
- New hourly chime tunes added
- Old hourly chime tunes improved
- Display of characters on the stock LCD improved
- Documentation improved
- Simulator improved
- Leap year handling improved
- Months and their days sanity checked and fixed
- More compile time configurable defaults added
- Excessively exact time checks relaxed
- Clock face indicators matched to original watch
- Hardware interface issue fixed
The most significant new feature however is software debouncing.
The sensor watch now properly handles hardware switch bouncing,
making the button inputs much more precise at the cost of a small amount
of latency, greatly improving usability. Any watch faces which require
holding down buttons as part of their user interface, the pulsometer
for example, should see huge improvements in their usability.
* 9c093f9 Merge PR #387 - configurable default birthdate/location
* 879c48c Merge PR #417 - improve 24h only mode
* db4097b Merge PR #426 - add temperature input to simulator
* dea0566 Merge PR #428 - fix issues in sunrise/sunset
* c8ca0d3 Merge PR #431 - fix wrong number of days in month
* 95ca374 Merge PR #433 - fix clock face indicators
* 663cd72 Merge PR #434 - fix leap years
* a715265 Merge PR #437 - debouncing logic
* c741332 Merge PR #439 - fix scheduled task misses
* 657ff72 Merge PR #440 - fix countdown face issues
* c8a87d3 Merge PR #441 - update documentation
* dd04443 Merge PR #443 - improved t and y character display
* 42dc151 Merge PR #447 - improve kim possible chime
* fa0cdef Merge PR #450 - sync after enabling RTC
* a67076f Merge PR #458 - add layla tune
* 23c422b Merge PR #459 - add power rangers tune
* a2e5417 Merge PR #461 - improve t/y special case docs
Tested-on-hardware-by: Alex Maestas <git@se30.xyz>
Tested-on-hardware-by: Matheus Afonso Martins Moreira <matheus@matheusmoreira.com>
Tested-on-hardware-by: Wesley Ellis <tahnok@gmail.com>
GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/460
According to the data sheet, writing to a Control A register's ENABLE
bit will trigger write synchronization and set SYNCBUSY's ENABLE bit
which will be automatically cleared by the hardware once the write
operation is complete.
It is necessary to wait until SYNCBUSY's ENABLE bit is clear.
Reading synchronized registers before that returns previous values.
Writing synchronized registers before that drops the write and generates
an error value in another register.
The data sheet recommends polling the ENABLE bit in this situation.
Reviewed-by: Matheus Afonso Martins Moreira <matheus@matheusmoreira.com>
GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/450
References: SAM L22 Family Data Sheet §§ 14.3.2, 14.3.3, 14.3.4, 14.3.5
Enhances 24 hour only mode by setting defaults properly
and skipping past the 12/24 hour settings page in the
preferences watch face.
Reviewed-by: Matheus Afonso Martins Moreira <matheus@matheusmoreira.com>
GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/417
This patch enhances the Sensor Watch simulator with a temperature input
allowing users to simulate and test the temperature sensor.
Reviewed-by: Matheus Afonso Martins Moreira <matheus@matheusmoreira.com>
GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/426
Takes zero into account, allowing the sunrise/sunset watch face
to work with no presets defined.
Also resolves a warning during compilation of the sunrise/sunset face.
Reviewed-by: Matheus Afonso Martins Moreira <matheus@matheusmoreira.com>
GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/428
Improves handling of months in the Sensor Watch
by computing whether the given year is a leap year.
Reviewed-by: Matheus Afonso Martins Moreira <matheus@matheusmoreira.com>
GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/434
July has 31 days and but was set to 30 days in the Sensor Watch.
This patch fixes the discrepancy.
Reviewed-by: Matheus Afonso Martins Moreira <matheus@matheusmoreira.com>
GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/431
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`.