]> git.earman.xyz Git - sensor-watch.git/log
sensor-watch.git
2 years agoBrought debounce time to 8ms rather than 15
David Volovskiy [Wed, 31 Jul 2024 11:33:25 +0000 (07:33 -0400)]
Brought debounce time to 8ms rather than 15

2 years agoMoved a few lines around to match main
David Volovskiy [Wed, 31 Jul 2024 11:25:09 +0000 (07:25 -0400)]
Moved a few lines around to match main

2 years agoUsing debounce that triggers when there's no change for Xms rather than just ignoring...
David Volovskiy [Wed, 31 Jul 2024 11:22:33 +0000 (07:22 -0400)]
Using debounce that triggers when there's no change for Xms rather than just ignoring new presses after Xms

2 years agoA little bit of clean-up
David Volovskiy [Tue, 30 Jul 2024 11:27:47 +0000 (07:27 -0400)]
A little bit of clean-up

2 years agoDelay for starting the debounce no loonger happens
David Volovskiy [Tue, 30 Jul 2024 03:53:25 +0000 (23:53 -0400)]
Delay for starting the debounce no loonger happens

2 years agoFixed stuck fast_tick
David Volovskiy [Tue, 30 Jul 2024 01:43:32 +0000 (21:43 -0400)]
Fixed stuck fast_tick

2 years agoCleaned up code
David Volovskiy [Tue, 30 Jul 2024 01:05:19 +0000 (21:05 -0400)]
Cleaned up code

2 years agousing cb_fast_tick again
David Volovskiy [Tue, 30 Jul 2024 00:48:17 +0000 (20:48 -0400)]
using cb_fast_tick again

2 years agoRevert "Leaving sleep with alarm button up doesn't trigger alarm button"
David Volovskiy [Tue, 30 Jul 2024 00:28:10 +0000 (20:28 -0400)]
Revert "Leaving sleep with alarm button up doesn't trigger alarm button"

This reverts commit 7d5aaf60caa943a248a7f635111ddfd50c230389.

2 years agoMade the debounce register rising edges rather than falling edges
David Volovskiy [Tue, 30 Jul 2024 00:13:54 +0000 (20:13 -0400)]
Made the debounce register rising edges rather than falling edges

2 years agoRemoved some dead code
David Volovskiy [Mon, 29 Jul 2024 22:24:58 +0000 (18:24 -0400)]
Removed some dead code

2 years agodebouince now uses cb_fast_tick and holding the button now also gets debounced
David Volovskiy [Mon, 29 Jul 2024 22:12:46 +0000 (18:12 -0400)]
debouince now uses cb_fast_tick and holding the button now also gets debounced

2 years agoLeaving sleep with alarm button up doesn't trigger alarm button
David Volovskiy [Mon, 29 Jul 2024 11:44:31 +0000 (07:44 -0400)]
Leaving sleep with alarm button up doesn't trigger alarm button

2 years agoAdded debouncing
David Volovskiy [Mon, 29 Jul 2024 11:39:51 +0000 (07:39 -0400)]
Added debouncing

2 years agoMerge pull request #408 from tahnok/sanity-check-color
Wesley Ellis [Wed, 26 Jun 2024 15:40:28 +0000 (11:40 -0400)]
Merge pull request #408 from tahnok/sanity-check-color

Check that color is valid

2 years agoCheck that color is valid
Wesley Ellis [Wed, 26 Jun 2024 15:30:31 +0000 (11:30 -0400)]
Check that color is valid

Instead of merely checking that COLOR is set, check that it is one of
RED, BLUE or GREEN

2 years agoMerge pull request #388 from TheOnePerson/fix-compile-errors
atax1a [Tue, 9 Apr 2024 22:24:19 +0000 (22:24 +0000)]
Merge pull request #388 from TheOnePerson/fix-compile-errors

Fix compile errors and warnings in movement.c and shell.c

2 years agoMerge pull request #389 from joeycastillo/theAlexes/add-openocd
atax1a [Tue, 9 Apr 2024 22:23:21 +0000 (22:23 +0000)]
Merge pull request #389 from joeycastillo/theAlexes/add-openocd

add an openocd.cfg for openocd 0.12.0

2 years agoMerge pull request #383 from theAlexes/theAlexes/fix-uf2conv
atax1a [Sun, 31 Mar 2024 00:40:05 +0000 (00:40 +0000)]
Merge pull request #383 from theAlexes/theAlexes/fix-uf2conv

uf2conv: argument to `re.split` should be a rawstring

2 years agoMerge pull request #385 from matheusmoreira/totp-hot-patch
atax1a [Sun, 31 Mar 2024 00:39:43 +0000 (00:39 +0000)]
Merge pull request #385 from matheusmoreira/totp-hot-patch

TOTP hotfix: reduce memory usage

2 years agoadd an openocd.cfg for openocd 0.12.0
Alex Maestas [Sun, 31 Mar 2024 00:37:35 +0000 (00:37 +0000)]
add an openocd.cfg for openocd 0.12.0

2 years agoFix compile errors and warnings in movement.c and shell.c
TheOnePerson [Fri, 29 Mar 2024 10:49:48 +0000 (11:49 +0100)]
Fix compile errors and warnings in movement.c and shell.c

2 years agofaces/totp: avoid displaying when key is invalid
Matheus Afonso Martins Moreira [Wed, 20 Mar 2024 14:35:58 +0000 (11:35 -0300)]
faces/totp: avoid displaying when key is invalid

Fixes a division by zero bug caused by calling getCodeFromTimestamp
without having initialized the TOTP library with a secret first.
This was happening because the face calls totp_display on activation,
meaning the validity of the secret was not checked since this is
done in the generate function.

Now the validity of the key is determined solely by the size
of the current decoded key. A general display function checks it
and decides whether to display the code or just the error message.

The size of the current decoded key is initialized to zero
on watch face activation, ensuring fail safe operation.

Tested-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Tested-on-hardware-by: madhogs <59648482+madhogs@users.noreply.github.com>
Signed-off-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/385

2 years agofaces/totp: fix error message not displayed bug
Matheus Afonso Martins Moreira [Wed, 20 Mar 2024 14:29:02 +0000 (11:29 -0300)]
faces/totp: fix error message not displayed bug

Forgot to call watch_display_string on the error message.
Of course the message isn't going to be displayed.

Also, increase the buffer size to 10 characters
and output a space to the last position.
This ensures the segments are cleared.

Tested-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Tested-on-hardware-by: madhogs <59648482+madhogs@users.noreply.github.com>
Signed-off-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/385

2 years agofaces/totp: remove dynamic memory allocation
Matheus Afonso Martins Moreira [Mon, 18 Mar 2024 13:41:06 +0000 (10:41 -0300)]
faces/totp: remove dynamic memory allocation

Allocate an unlimited extent 128 byte buffer once during setup
instead of allocating and deallocating repeatedly. A static buffer
was not used because it fails to be reentrant and prevents multiple
instances of the watch face to be compiled by the user.

The advantage is the complete prevention of memory management errors,
improving the reliability of the watch. It also eliminates the overhead
of the memory allocator itself since malloc is not free.
The disadvantage is a worst case default size of 128 bytes was required,
meaning about 90 bytes will be wasted in the common case since most keys
are not that big. This can be overridden by the user via preprocessor.

The key lengths are checked on TOTP watch face initialization
and if any key is found to be too large to fit the buffer
it is turned off and the label and ERROR is displayed instead.

The base32 encoded secrets are decoded dynamically to the buffer
at the following times:

 - Face enters the foreground
 - User switches TOTP code

Therefore, there is still some extra runtime overhead
that can still be eliminated by code generation.
This will be addressed in future commits.

Tested-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Tested-on-hardware-by: madhogs <59648482+madhogs@users.noreply.github.com>
Signed-off-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/385

2 years agofaces/totp: improve memory usage
Matheus Afonso Martins Moreira [Sun, 17 Mar 2024 22:32:27 +0000 (19:32 -0300)]
faces/totp: improve memory usage

The TOTP face is working in the simulator but fails on the real hardware
when loaded with lots of codes, just like the LFS version.
This is likely caused by the recent refactoring of the TOTP face
which introduced a declarative credential interface for ease of use.
That's accomplished by decoding the secrets at runtime which increases
the RAM requirements. Users are likely hitting memory limits.

In order to mitigate this, the algorithm is changed from decoding
all of the secrets only once during initialization to on the fly
decoding of the secret for the current TOTP credential only.
This converts this face's dynamic memory usage from O(N) to O(1)
at the cost of memory management when switching faces and credentials
which could impact power consumption. Issue is confirmed fixed by
author of issue who has tested it on real hardware. Fixes #384.

Due to variable key sizes, the memory cannot be statically allocated.
Perhaps there's a maximum key size that can serve as worst case?

Also took this opportunity to restructure the code a bit.
Also added code to check for memory allocation failure.

Reported-by: madhogs <59648482+madhogs@users.noreply.github.com>
Fixed-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Tested-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Tested-on-hardware-by: madhogs <59648482+madhogs@users.noreply.github.com>
Signed-off-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
GitHub-Issue: https://github.com/joeycastillo/Sensor-Watch/issues/384

2 years agofaces: restore simple_clock_face
Matheus Afonso Martins Moreira [Sat, 16 Mar 2024 22:58:55 +0000 (19:58 -0300)]
faces: restore simple_clock_face

Restore the original simple clock face as requested.

2 years agouf2conv: argument to `re.split` should be a rawstring
Alex Maestas [Sat, 16 Mar 2024 16:50:55 +0000 (16:50 +0000)]
uf2conv: argument to `re.split` should be a rawstring

2 years agoMerge branch 'timeout-event-and-sleep-logic'
Matheus Afonso Martins Moreira [Wed, 6 Mar 2024 01:03:54 +0000 (22:03 -0300)]
Merge branch 'timeout-event-and-sleep-logic'

Currently, movement drops timeout events in case the previous loop
indicates that sleep is not possible. This is due to unintended
short circuiting behavior of && and is fixed with a temporary variable.

The static qualifier of can_sleep is also removed.

Helped-by: Alex Maestas <git@se30.xyz>
Tested-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Tested-on-hardware-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Signed-off-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/376

2 years agoMerge branch 'structured-totp+maxz' into advanced
Matheus Afonso Martins Moreira [Tue, 5 Mar 2024 06:07:43 +0000 (03:07 -0300)]
Merge branch 'structured-totp+maxz' into advanced

Aggregates the TOTP credentials into a data structure,
making it easier to define and use the credentials.
Also incorporate backwards movement code from another branch.

Co-authored-by: Max Zettlmeißl <max@zettlmeissl.de>
Tested-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Tested-on-hardware-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Signed-off-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/369
GitHub-Related-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/356

2 years agoMerge branch 'advanced-pulsometer' into advanced
Matheus Afonso Martins Moreira [Tue, 5 Mar 2024 03:53:12 +0000 (00:53 -0300)]
Merge branch 'advanced-pulsometer' into advanced

Implements an advanced pulsometer that can be calibrated by the user.
Also features a streamlined and responsive user interface,
new documentation and generally improved code.

Tested-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Tested-on-hardware-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Signed-off-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/371

2 years agoMerge branch 'advanced-clock+24h' into advanced
Matheus Afonso Martins Moreira [Tue, 5 Mar 2024 03:49:57 +0000 (00:49 -0300)]
Merge branch 'advanced-clock+24h' into advanced

Completely refactors the simple clock face
and lays the foundations for new features.

Also adds a compile time 24 hour mode only feature.

Tested-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Tested-on-hardware-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Signed-off-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/373

2 years agoMerge branch 'moon-phase-face-long-press-reset'
Matheus Afonso Martins Moreira [Tue, 5 Mar 2024 04:51:18 +0000 (01:51 -0300)]
Merge branch 'moon-phase-face-long-press-reset'

Makes a long press of the ALARM button reset the face to current day.

Reviewed-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Tested-by: Wesley Aptekar-Cassels <me@wesleyac.com>
Tested-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Tested-on-hardware-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Signed-off-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/316

2 years agoMerge branch 'compile-time-preferences'
Matheus Afonso Martins Moreira [Tue, 5 Mar 2024 05:03:26 +0000 (02:03 -0300)]
Merge branch 'compile-time-preferences'

Adds overridable C preprocessor definitions for every user preference.
Enables the user to set defaults and omit the preferences face.

The default behavior of the watch is preserved.

Suggested-by: Wesley Aptekar-Cassels <me@wesleyac.com>
Implemented-by: madhogs <x3dh4vhf@duck.com>
Reviewed-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Tested-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Tested-on-hardware-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Signed-off-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/295
GitHub-Related-Issue: https://github.com/joeycastillo/Sensor-Watch/issues/291

2 years agoMerge branch 'usb-improvements' into advanced
Matheus Afonso Martins Moreira [Tue, 5 Mar 2024 04:05:31 +0000 (01:05 -0300)]
Merge branch 'usb-improvements' into advanced

 - Change newline prints to also send carriage return
 - Introduce shell module for serial shell with argument parsing
 - Introduce shell command list for compile time command registration
 - Refactor file system commands for shell subsystem
 - Introduce new shell commands:
   - 'help' command
   - 'flash' command to reset into bootloader
   - 'stress' tests CDC serial writes of various lengths
     - optional delay parameter
 - Harden USB handling
   - Hangs less
   - Drops fewer inputs
 - Circular buffers for both reads and writes

Reported-by: Edward Shin <contact@edwardsh.in>
Tested-by: Edward Shin <contact@edwardsh.in>
Tested-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Tested-on-hardware-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Reviewed-by: James Haggerty <james@gruemail.com>
Reviewed-by: Wesley Aptekar-Cassels <me@wesleyac.com>
Reviewed-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Signed-off-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/344

2 years agoMerge branch 'silicon-errata' into advanced
Matheus Afonso Martins Moreira [Tue, 5 Mar 2024 04:28:12 +0000 (01:28 -0300)]
Merge branch 'silicon-errata' into advanced

Implements the recommended workarounds for numerous silicon errata,
reducing power consumption and preventing freezes and hard faults.

Tested-by: Alex Maestas <git@se30.xyz>
Tested-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Tested-on-hardware-by: Alex Maestas <git@se30.xyz>
Tested-on-hardware-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Reviewed-by: Wesley Aptekar-Cassels <me@wesleyac.com>
Reviewed-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Signed-off-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/340
GitHub-Related-Issue: https://github.com/joeycastillo/Sensor-Watch/issues/361
GitHub-Related-Issue: https://github.com/joeycastillo/Sensor-Watch/issues/359
Reference: https://ww1.microchip.com/downloads/aemDocuments/documents/MCU32/ProductDocuments/Errata/SAM-L22-Family-Silicon-Errata-and-Data-Sheet-Clarification-DS80000782.pdf

2 years agoMerge 'fix-sunrise-sunset-uninitialized'
Matheus Afonso Martins Moreira [Tue, 5 Mar 2024 04:40:15 +0000 (01:40 -0300)]
Merge 'fix-sunrise-sunset-uninitialized'

Fixes a crash due to use of uninitialized buffer when setting location.

Reported-by: eshrh <esrh@gatech.edu>
Fixed-by: Wesley Aptekar-Cassels <me@wesleyac.com>
Reviewed-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Tested-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Tested-on-hardware-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
Signed-off-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/329
GitHub-Issue: https://github.com/joeycastillo/Sensor-Watch/issues/198
Fixes: https://github.com/joeycastillo/Sensor-Watch/issues/198
2 years agomovement: fix unintended timeout short circuiting
Matheus Afonso Martins Moreira [Wed, 6 Mar 2024 00:49:32 +0000 (21:49 -0300)]
movement: fix unintended timeout short circuiting

Currently, movement drops time out events in case the previous loop
indicates that sleep is not possible due to short circuiting behavior
of logical and in C: if the left-hand side is false, the right hand
side is not evaluated at all, which means the loop is not called.
This was not intended to happen.

Fix it by storing the result in a second boolean variable
and working out the logic after the fact.

2 years agomovement: convert can_sleep an automatic variable
Matheus Afonso Martins Moreira [Wed, 6 Mar 2024 00:08:10 +0000 (21:08 -0300)]
movement: convert can_sleep an automatic variable

It is a simple boolean value and its scope is limited to the function.
There is no reason that I can think of for it to be a static variable.

2 years agofaces/pulsometer: remember pulsometer measurement
Matheus Afonso Martins Moreira [Tue, 5 Mar 2024 07:29:52 +0000 (04:29 -0300)]
faces/pulsometer: remember pulsometer measurement

Avoid resetting it to zero when the face is activated.
Initialize the variables once when the face is first set up.

This makes it remember the last measurement taken by the user.
It will no longer be overwritten when the watch face activates.

2 years agofaces/pulsometer: remember pulsometer calibration
Matheus Afonso Martins Moreira [Tue, 5 Mar 2024 07:10:41 +0000 (04:10 -0300)]
faces/pulsometer: remember pulsometer calibration

Avoid resetting it to default when the face is activated.
Set the default pulsometer calibration once,
only when the face is first set up.

This makes it remember the calibration set by the user.
It will no longer overwrite it.

2 years agofaces/totp: update copyrights
Matheus Afonso Martins Moreira [Tue, 5 Mar 2024 06:03:25 +0000 (03:03 -0300)]
faces/totp: update copyrights

Update the copyrights to include full name attribution
to Max Zettlmeißl whose code I've incorporated and who
has explicitly licensed it as MIT.

Max Zettlmeißl (@maxz) commented on 2024-01-20:

> I provide all my changes under the MIT license

GitHub-Comment: https://github.com/joeycastillo/Sensor-Watch/pull/356#issuecomment-1902114306

2 years agofaces/totp: allow moving backwards through codes
Max Zettlmeißl [Sat, 20 Jan 2024 23:15:01 +0000 (00:15 +0100)]
faces/totp: allow moving backwards through codes

Adds the ability to cycle back to the previous credential with LIGHT.
Long pressing LIGHT activates the LED.

Co-authored-by: Matheus Afonso Martins Moreira <matheus.a.m.moreira@gmail.com>
2 years agofaces/clock: add 24h only feature
Matheus Afonso Martins Moreira [Sun, 25 Feb 2024 18:18:45 +0000 (15:18 -0300)]
faces/clock: add 24h only feature

The clock watch face can now be configured at build time
to only display the time in 24h mode. Also enabled in forced 24h mode.

This should result in smaller code size due to dead code elimination.

2 years agofaces/clock: update copyrights and credits
Matheus Afonso Martins Moreira [Sat, 24 Feb 2024 21:27:40 +0000 (18:27 -0300)]
faces/clock: update copyrights and credits

Update the copyrights to include full name attribution to all
who contributed to the clock watch face, including myself.

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

2 years agofaces/totp: delete leading underscores
Matheus Afonso Martins Moreira [Mon, 26 Feb 2024 01:55:55 +0000 (22:55 -0300)]
faces/totp: delete leading underscores

Makes for cleaner symbols.

2 years agofaces/totp: rename initializer macro to credential
Matheus Afonso Martins Moreira [Mon, 26 Feb 2024 01:46:45 +0000 (22:46 -0300)]
faces/totp: rename initializer macro to credential

Shorter and far more expressive.

2 years agofaces/totp: improve TOTP initializer labeling
Matheus Afonso Martins Moreira [Mon, 26 Feb 2024 01:40:32 +0000 (22:40 -0300)]
faces/totp: improve TOTP initializer labeling

It now generates the string literal from the preprocessor token.
Even warns the user if the string is too long!

2 years agofaces/totp: decode secrets when setting up
Matheus Afonso Martins Moreira [Mon, 26 Feb 2024 01:23:38 +0000 (22:23 -0300)]
faces/totp: decode secrets when setting up

This allows the user to easily copy the base32 encoded secrets
into the TOTP record initializers. They will be decoded once
at runtime when the face is being set up by the movement framework.

Also rename the array of TOTP records to credentials. Much better.

2 years agofaces/clock: indicate low power only when needed
Matheus Afonso Martins Moreira [Sun, 25 Feb 2024 17:14:26 +0000 (14:14 -0300)]
faces/clock: indicate low power only when needed

There is no need to set the indicator on every clock tick.
Indicate only when the battery is checked.

2 years agofaces/clock: indicate alarm only when necessary
Matheus Afonso Martins Moreira [Sun, 25 Feb 2024 17:11:07 +0000 (14:11 -0300)]
faces/clock: indicate alarm only when necessary

The alarm state is not modified within the clock face.
Therefore, it only needs to be set when the face is activated.

2 years agofaces/clock: refactor time signal toggling code
Matheus Afonso Martins Moreira [Sun, 25 Feb 2024 17:10:04 +0000 (14:10 -0300)]
faces/clock: refactor time signal toggling code

Simplifies the code by defining dedicated functions for this.

2 years agofaces/clock: refactor clock display code
Matheus Afonso Martins Moreira [Sun, 25 Feb 2024 17:06:19 +0000 (14:06 -0300)]
faces/clock: refactor clock display code

Simplifies the code by defining dedicated functions for this.

2 years agofaces/clock: reorder periodic battery check
Matheus Afonso Martins Moreira [Sun, 25 Feb 2024 16:31:28 +0000 (13:31 -0300)]
faces/clock: reorder periodic battery check

Check the battery after the time has been updated.
Place all the indication code next to each other.

2 years agofaces/clock: refactor partial time display code
Matheus Afonso Martins Moreira [Sun, 25 Feb 2024 16:31:17 +0000 (13:31 -0300)]
faces/clock: refactor partial time display code

Simplifies the code by defining dedicated functions for this.

2 years agofaces/clock: refactor full time display code
Matheus Afonso Martins Moreira [Sun, 25 Feb 2024 16:00:50 +0000 (13:00 -0300)]
faces/clock: refactor full time display code

Simplifies the code by defining dedicated functions for this.

2 years agofaces/clock: refactor tick tock animation code
Matheus Afonso Martins Moreira [Sun, 25 Feb 2024 15:40:00 +0000 (12:40 -0300)]
faces/clock: refactor tick tock animation code

Simplifies the code by defining dedicated functions for this.

2 years agofaces/clock: refactor low power tick function
Matheus Afonso Martins Moreira [Sun, 25 Feb 2024 15:32:31 +0000 (12:32 -0300)]
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.

2 years agofaces/clock: simplify LAP indication function
Matheus Afonso Martins Moreira [Sun, 25 Feb 2024 01:38:28 +0000 (22:38 -0300)]
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.

2 years agofaces/clock: refactor daily battery check
Matheus Afonso Martins Moreira [Sun, 25 Feb 2024 01:31:12 +0000 (22:31 -0300)]
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.

2 years agofaces/clock: simplify PM indication function
Matheus Afonso Martins Moreira [Sat, 24 Feb 2024 23:13:07 +0000 (20:13 -0300)]
faces/clock: simplify PM indication function

Simplifies the code by adding dedicated functions for this.

2 years agofaces/clock: simplify 24h indication function
Matheus Afonso Martins Moreira [Sat, 24 Feb 2024 22:52:51 +0000 (19:52 -0300)]
faces/clock: simplify 24h indication function

Simplifies the code by adding a dedicated function for this.

2 years agofaces/clock: simplify signal indication function
Matheus Afonso Martins Moreira [Sat, 24 Feb 2024 22:44:52 +0000 (19:44 -0300)]
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.

2 years agofaces/clock: simplify alarm indication function
Matheus Afonso Martins Moreira [Sat, 24 Feb 2024 22:36:34 +0000 (19:36 -0300)]
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.

2 years agofaces/clock: define general indication function
Matheus Afonso Martins Moreira [Sat, 24 Feb 2024 22:16:06 +0000 (19:16 -0300)]
faces/clock: define general indication function

Sets or clears the specified indicator based on some boolean value.

2 years agofaces/clock: move structure definition
Matheus Afonso Martins Moreira [Sat, 24 Feb 2024 21:40:21 +0000 (18:40 -0300)]
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.

2 years agofaces: rename simple_clock_face to clock_face
Matheus Afonso Martins Moreira [Sat, 24 Feb 2024 21:19:12 +0000 (18:19 -0300)]
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.

2 years agofaces/pulsometer: move structure definition
Matheus Afonso Martins Moreira [Sat, 24 Feb 2024 08:17:56 +0000 (05:17 -0300)]
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.

2 years agofaces/pulsometer: update copyrights and credits
Matheus Afonso Martins Moreira [Wed, 21 Feb 2024 09:11:21 +0000 (06:11 -0300)]
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.

2 years agofaces/pulsometer: document the advanced pulsometer
Matheus Afonso Martins Moreira [Wed, 21 Feb 2024 09:05:00 +0000 (06:05 -0300)]
faces/pulsometer: document the advanced pulsometer

Thoroughly document the new advanced pulsometer watch face
by describing what it is and how it works.

2 years agofaces/pulsometer: implement advanced pulsometer
Matheus Afonso Martins Moreira [Wed, 21 Feb 2024 09:00:18 +0000 (06:00 -0300)]
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.

2 years agofaces/totp: update copyright and license data
Matheus Afonso Martins Moreira [Wed, 21 Feb 2024 04:52:31 +0000 (01:52 -0300)]
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

2 years agofaces/totp: delete unused structure field
Matheus Afonso Martins Moreira [Wed, 21 Feb 2024 02:24:01 +0000 (23:24 -0300)]
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.

2 years agofaces/totp: update watch face logic for new struct
Matheus Afonso Martins Moreira [Wed, 21 Feb 2024 02:20:21 +0000 (23:20 -0300)]
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.

2 years agofaces/totp: define current TOTP data function
Matheus Afonso Martins Moreira [Wed, 21 Feb 2024 02:18:00 +0000 (23:18 -0300)]
faces/totp: define current TOTP data function

Selects the appropriate TOTP data structure
given the TOTP watch face state.

2 years agofaces/totp: define TOTP data array size function
Matheus Afonso Martins Moreira [Wed, 21 Feb 2024 02:16:41 +0000 (23:16 -0300)]
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.

2 years agofaces/totp: update example data to new structure
Matheus Afonso Martins Moreira [Wed, 21 Feb 2024 02:15:15 +0000 (23:15 -0300)]
faces/totp: update example data to new structure

The data definitions are much shorter and easier to read now.

2 years agofaces/totp: define TOTP struct initializer macro
Matheus Afonso Martins Moreira [Wed, 21 Feb 2024 02:12:53 +0000 (23:12 -0300)]
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.

2 years agofaces/totp: define TOTP data structure
Matheus Afonso Martins Moreira [Wed, 21 Feb 2024 02:10:13 +0000 (23:10 -0300)]
faces/totp: define TOTP data structure

Aggregates all the data necessary for TOTP generation.

2 years agoMerge branch 'main' into preferences_in_config
madhogs [Wed, 14 Feb 2024 17:17:10 +0000 (17:17 +0000)]
Merge branch 'main' into preferences_in_config

2 years agoChange inactivity deadlines: add 10 minutes and remove 2 days. (#365)
Max Zettlmeißl [Wed, 7 Feb 2024 19:02:41 +0000 (20:02 +0100)]
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.

2 years agoMerge pull request #362 from Kistelini/fix
Wesley Ellis [Mon, 22 Jan 2024 17:09:05 +0000 (12:09 -0500)]
Merge pull request #362 from Kistelini/fix

Revert "make the watch-face a global in movement.c, actually"

2 years agoannotate SLEEPCFG-register detail
Alex Maestas [Mon, 22 Jan 2024 00:37:25 +0000 (00:37 +0000)]
annotate SLEEPCFG-register detail

2 years agoannotate voltage regulation erratum
Alex Maestas [Mon, 22 Jan 2024 00:31:27 +0000 (00:31 +0000)]
annotate voltage regulation erratum

2 years agoannotate SysTick erratum
Alex Maestas [Mon, 22 Jan 2024 00:31:04 +0000 (00:31 +0000)]
annotate SysTick erratum

2 years agoannotate TRNG erratum, address review comment
Alex Maestas [Mon, 22 Jan 2024 00:30:25 +0000 (00:30 +0000)]
annotate TRNG erratum, address review comment

2 years agoRevert "make the watch-face a global in movement.c, actually"
Christian Buschau [Sun, 21 Jan 2024 16:32:36 +0000 (17:32 +0100)]
Revert "make the watch-face a global in movement.c, actually"

This reverts commit 0e801ed505cb0c368bf1eb0473058efb6c275a3e.

2 years agoMerge pull request #337 from theAlexes/theAlexes/wyoscan-zero
Wesley Aptekar-Cassels [Sun, 21 Jan 2024 07:35:32 +0000 (02:35 -0500)]
Merge pull request #337 from theAlexes/theAlexes/wyoscan-zero

make the zero in wyoscan a little more visually appealing

2 years agoMerge pull request #322 from WesleyAC/watch-face-save-load
Wesley Aptekar-Cassels [Sun, 21 Jan 2024 07:10:16 +0000 (02:10 -0500)]
Merge pull request #322 from WesleyAC/watch-face-save-load

Add save_load_face

2 years agoMerge branch 'main' into watch-face-save-load
Wesley Aptekar-Cassels [Sun, 21 Jan 2024 07:08:28 +0000 (02:08 -0500)]
Merge branch 'main' into watch-face-save-load

2 years agoMerge pull request #319 from WesleyAC/watch-face-day-night-percentage
Wesley Aptekar-Cassels [Sun, 21 Jan 2024 07:06:14 +0000 (02:06 -0500)]
Merge pull request #319 from WesleyAC/watch-face-day-night-percentage

Add day_night_percentage_face.

2 years agoMerge branch 'main' into watch-face-day-night-percentage
Wesley Aptekar-Cassels [Sun, 21 Jan 2024 07:04:20 +0000 (02:04 -0500)]
Merge branch 'main' into watch-face-day-night-percentage

2 years agoMerge pull request #318 from WesleyAC/watch-face-simple-coin-flip
Wesley Aptekar-Cassels [Sun, 21 Jan 2024 07:03:41 +0000 (02:03 -0500)]
Merge pull request #318 from WesleyAC/watch-face-simple-coin-flip

Add simple_coin_flip_face

2 years agoMerge branch 'main' into watch-face-simple-coin-flip
Wesley Aptekar-Cassels [Sun, 21 Jan 2024 07:01:27 +0000 (02:01 -0500)]
Merge branch 'main' into watch-face-simple-coin-flip

2 years agoMerge pull request #315 from WesleyAC/watch-face-solstice
Wesley Aptekar-Cassels [Sun, 21 Jan 2024 07:00:51 +0000 (02:00 -0500)]
Merge pull request #315 from WesleyAC/watch-face-solstice

Add solstice_face

2 years agoMerge branch 'main' into watch-face-solstice
Wesley Aptekar-Cassels [Sun, 21 Jan 2024 06:58:20 +0000 (01:58 -0500)]
Merge branch 'main' into watch-face-solstice

2 years agoMerge pull request #339 from theAlexes/theAlexes/cleanup
Wesley Aptekar-Cassels [Sun, 21 Jan 2024 06:44:19 +0000 (01:44 -0500)]
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

2 years agoMerge branch 'main' into theAlexes/cleanup
Wesley Aptekar-Cassels [Sun, 21 Jan 2024 06:31:58 +0000 (01:31 -0500)]
Merge branch 'main' into theAlexes/cleanup

2 years agoMerge pull request #360 from CarpeNoctem/compiler_warning_watch_face_index
Wesley Aptekar-Cassels [Sun, 21 Jan 2024 06:21:32 +0000 (01:21 -0500)]
Merge pull request #360 from CarpeNoctem/compiler_warning_watch_face_index

template: fix compiler warning on watch_face_index as mentioned in PR269

2 years agotemplate: fix compiler warning on watch_face_index as mentioned in PR 269
CarpeNoctem [Wed, 17 Jan 2024 12:08:54 +0000 (23:08 +1100)]
template: fix compiler warning on watch_face_index as mentioned in PR 269