Commit graph

946 commits

Author SHA1 Message Date
Matheus Afonso Martins Moreira 1d79930ab7 faces/clock: refactor low power tick function
Simplifies the code by defining dedicated functions
and separating the case from the main ones.

Also use the snprintf function since the buffer size is known.
2024-02-25 15:24:14 -03:00
Matheus Afonso Martins Moreira e7052fe4e2 faces/clock: simplify LAP indication function
Simplifies the code by adding a dedicated function for this.
Also documents the meaning of the LAP indicator: Low Available Power.
2024-02-25 15:24:14 -03:00
Matheus Afonso Martins Moreira 0773439a49 faces/clock: refactor daily battery check
Move the code in question to a dedicated function. Better organized.
Add overridable preprocessor definition for the low battery threshold.
2024-02-25 15:24:14 -03:00
Matheus Afonso Martins Moreira 91713392a5 faces/clock: simplify PM indication function
Simplifies the code by adding dedicated functions for this.
2024-02-25 15:24:14 -03:00
Matheus Afonso Martins Moreira 113b4bba9c faces/clock: simplify 24h indication function
Simplifies the code by adding a dedicated function for this.
2024-02-25 15:24:14 -03:00
Matheus Afonso Martins Moreira 2132320d5c faces/clock: simplify signal indication function
Simplifies the code and makes it use the correct indicator.
For some reason it had been switched with the alarm indicator.

    WATCH_INDICATOR_BELL
        The small bell indicating that an alarm is set.

    WATCH_INDICATOR_SIGNAL
        The hourly signal indicator.
        Also useful for indicating that sensors are on.
2024-02-25 15:24:14 -03:00
Matheus Afonso Martins Moreira e2cba9f2f2 faces/clock: simplify alarm indication function
Deduplicates state in the clock state and movement settings.
Makes the code simpler.

Also makes it use the correct indicator.
For some reason it had been switched
with the hourly chime indicator.

    WATCH_INDICATOR_BELL
        The small bell indicating that an alarm is set.

    WATCH_INDICATOR_SIGNAL
        The hourly signal indicator.
        Also useful for indicating that sensors are on.
2024-02-25 15:24:14 -03:00
Matheus Afonso Martins Moreira e6d8b6aaff faces/clock: define general indication function
Sets or clears the specified indicator based on some boolean value.
2024-02-25 15:24:14 -03:00
Matheus Afonso Martins Moreira 01312c2deb faces/clock: move structure definition
Instances of the clock state structure
are only passed to the clock face itself
and only via the opaque context pointer.
No other code uses it.

Thus there is no need to expose it in a header file.
So make it an implementation detail of the watch face
by localizing it inside the translation unit.
2024-02-25 15:24:14 -03:00
Matheus Afonso Martins Moreira 8f040252fd faces: rename simple_clock_face to clock_face
It's not actually so simple and will only gain features from now on.
Just "clock face" also feels more canonical.
2024-02-24 18:53:07 -03:00
Matheus Afonso Martins Moreira 30ebf4743e faces/pulsometer: move structure definition
Instances of the pulsometer state structure are only passed
to the pulsometer itself and only via the opaque context pointer.
No other code uses it. There is no need to expose it in a header file
so make it an implementation detail of the watch face.
2024-02-24 05:17:56 -03:00
Matheus Afonso Martins Moreira 4d77273238 faces/pulsometer: update copyrights and credits
Update the copyrights to include full name attribution to all
who contributed to the pulsometer watch face, including myself.

Also add an SPDX license identifier header comment to the files.
2024-02-24 05:17:43 -03:00
Matheus Afonso Martins Moreira 4b67ef56c6 faces/pulsometer: document the advanced pulsometer
Thoroughly document the new advanced pulsometer watch face
by describing what it is and how it works.
2024-02-24 05:17:43 -03:00
Matheus Afonso Martins Moreira ea47bf9f22 faces/pulsometer: implement advanced pulsometer
Implements an advanced pulsometer that can be recalibrated by the user.
The main clock face now displays the measured pulses per minute.
The day of month digits now display the pulsometer calibration.
The light button now cycles through integer graduations
which now range from 1 to 39 pulses per minute.
Long presses of the light button cycle by 10 instead of 1.

The watch face's responsiveness to input has been carefully optimized.
The code has been reorganized and generally improved.
2024-02-24 05:17:43 -03:00
Matheus Afonso Martins Moreira 1c0050c97b faces/totp: update copyright and license data
Update the copyrights to include full name attribution
to all who contributed to this watch face, including myself.

Also add an SPDX license identifier header comment to the files.

https://spdx.org/licenses/MIT.html
2024-02-21 03:25:29 -03:00
Matheus Afonso Martins Moreira 0ebd94c4e1 faces/totp: delete unused structure field
The TOTP watch face now keeps track of each key separately.
There is no need to compute offsets at runtime.
2024-02-20 23:24:01 -03:00
Matheus Afonso Martins Moreira 79cfe315ff faces/totp: update watch face logic for new struct
Using the new structured TOTP record data structure
allows the TOTP watch face to statically and implicitly
compute the total number of defined TOTP records.

Users can now simply add new keys and records in the designated area
and the watch face will compile and automatically use them with no need
to maintain a separate array size variable. Less chance of mistakes.
2024-02-20 23:20:21 -03:00
Matheus Afonso Martins Moreira bbb920a5d8 faces/totp: define current TOTP data function
Selects the appropriate TOTP data structure
given the TOTP watch face state.
2024-02-20 23:18:00 -03:00
Matheus Afonso Martins Moreira 48e7fb1a7c faces/totp: define TOTP data array size function
Computes the size of the array of TOTP records.
The compiler will likely evaluate it at compile time.
2024-02-20 23:16:41 -03:00
Matheus Afonso Martins Moreira a99f6a716f faces/totp: update example data to new structure
The data definitions are much shorter and easier to read now.
2024-02-20 23:15:15 -03:00
Matheus Afonso Martins Moreira 8a7d9326cf faces/totp: define TOTP struct initializer macro
Generates a compound initializer for the given TOTP parameters.
Lessens repetition and allows functional definitions of TOTP records.
2024-02-20 23:12:53 -03:00
Matheus Afonso Martins Moreira 67907e4e5c faces/totp: define TOTP data structure
Aggregates all the data necessary for TOTP generation.
2024-02-20 23:10:13 -03:00
madhogs 3c6affb419
Merge branch 'main' into preferences_in_config 2024-02-14 17:17:10 +00:00
Max Zettlmeißl af18673e1a
Change inactivity deadlines: add 10 minutes and remove 2 days. (#365)
I like to use the ten minute timeout on my watch and there are other
people who have similar interests in a lower deadline. The two day
deadline had to go to still accommodate the change within the three
bit index.

The default setting is still the one hour timeout.
2024-02-07 14:02:41 -05:00
Wesley Ellis 11de5936c5
Merge pull request #362 from Kistelini/fix
Revert "make the watch-face a global in movement.c, actually"
2024-01-22 12:09:05 -05:00
Alex Maestas a2a60eb31a annotate SLEEPCFG-register detail 2024-01-22 00:39:20 +00:00
Alex Maestas af49d3cfcb annotate voltage regulation erratum 2024-01-22 00:39:20 +00:00
Alex Maestas 2ae8f9863b annotate SysTick erratum 2024-01-22 00:39:20 +00:00
Alex Maestas 83a0e4e992 annotate TRNG erratum, address review comment 2024-01-22 00:39:18 +00:00
Christian Buschau 898b159a90
Revert "make the watch-face a global in movement.c, actually"
This reverts commit 0e801ed505.
2024-01-21 20:31:37 +01:00
Wesley Aptekar-Cassels 3703d565ed
Merge pull request #337 from theAlexes/theAlexes/wyoscan-zero
make the zero in wyoscan a little more visually appealing
2024-01-21 02:35:32 -05:00
Wesley Aptekar-Cassels 3f58ce7693
Merge pull request #322 from WesleyAC/watch-face-save-load
Add save_load_face
2024-01-21 02:10:16 -05:00
Wesley Aptekar-Cassels 501ed8f9d2
Merge branch 'main' into watch-face-save-load 2024-01-21 02:08:28 -05:00
Wesley Aptekar-Cassels 45ede8f256
Merge pull request #319 from WesleyAC/watch-face-day-night-percentage
Add day_night_percentage_face.
2024-01-21 02:06:14 -05:00
Wesley Aptekar-Cassels fe48776dae
Merge branch 'main' into watch-face-day-night-percentage 2024-01-21 02:04:20 -05:00
Wesley Aptekar-Cassels 332728b511
Merge pull request #318 from WesleyAC/watch-face-simple-coin-flip
Add simple_coin_flip_face
2024-01-21 02:03:41 -05:00
Wesley Aptekar-Cassels f16ce6a767
Merge branch 'main' into watch-face-simple-coin-flip 2024-01-21 02:01:27 -05:00
Wesley Aptekar-Cassels 233036ff59
Merge pull request #315 from WesleyAC/watch-face-solstice
Add solstice_face
2024-01-21 02:00:51 -05:00
Wesley Aptekar-Cassels 29784983b5
Merge branch 'main' into watch-face-solstice 2024-01-21 01:58:20 -05:00
Wesley Aptekar-Cassels e49a75b8ef
Merge pull request #339 from theAlexes/theAlexes/cleanup
did a tiny bit of code cleanup, encountered a bug that might fix some sleep-mode issues
2024-01-21 01:44:19 -05:00
Wesley Aptekar-Cassels d7369cd00d
Merge branch 'main' into theAlexes/cleanup 2024-01-21 01:31:58 -05:00
Wesley Aptekar-Cassels 9e41ac8e49
Merge pull request #360 from CarpeNoctem/compiler_warning_watch_face_index
template: fix compiler warning on watch_face_index as mentioned in PR269
2024-01-21 01:21:32 -05:00
CarpeNoctem 6985ca54f3 template: fix compiler warning on watch_face_index as mentioned in PR 269 2024-01-17 23:08:54 +11:00
Wesley Aptekar-Cassels 07e45acba7
Merge pull request #325 from WesleyAC/fix-le-buzzer-default-tune
Fix buzzer in LE mode.
2024-01-11 19:53:51 -05:00
joeycastillo cd44cb74a2 fix alternate firmware script 2024-01-10 09:38:33 -05:00
Wesley Aptekar-Cassels bf8c1b5dae
Merge pull request #342 from theAlexes/theAlexes/nanosec-profile-bug
delete stray line of code that messed with correction profile
2024-01-09 17:46:48 -05:00
Alex Maestas aa3a1eeeef movement: Use LE mode code to keep buzzer awake, instead of sleeping. 2024-01-09 16:24:11 -05:00
Wesley Aptekar-Cassels 50dccd07d3 buzzer: fix simulator build, refactor sequence_length. 2024-01-09 16:22:21 -05:00
Wesley Aptekar-Cassels e9fe4aeefe Enable custom signal tones in LE mode.
This makes movement_play_signal synchronous when in LE mode, despite
using the underlying asynchronous API. It's a bit of a hack, but it
should work well enough for now.

This also moves the enabling/disabling of the buzzer into the
movement_play_signal function, so that watch faces no longer have to do
it.
2024-01-09 16:22:21 -05:00
Wesley Aptekar-Cassels 3ee32c6e57 Use legacy buzzer functions when playing default tune.
This allows the default tune to be played in LE mode.

Fixes: #275
2024-01-09 16:22:21 -05:00