Alex Maestas
40b71400c5
uf2conv: argument to re.split should be a rawstring
2024-03-16 16:50:55 +00:00
Matheus Afonso Martins Moreira
8bf652f213
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
2024-03-08 06:56:55 -03:00
Matheus Afonso Martins Moreira
ca40d101d3
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
2024-03-08 06:56:31 -03:00
Matheus Afonso Martins Moreira
66796805ac
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
2024-03-08 06:54:50 -03:00
Matheus Afonso Martins Moreira
4b269c5063
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
2024-03-08 06:54:22 -03:00
Matheus Afonso Martins Moreira
7208df1dfb
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
2024-03-08 06:52:49 -03:00
Matheus Afonso Martins Moreira
f35cb849de
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
2024-03-08 06:52:22 -03:00
Matheus Afonso Martins Moreira
35c0a4be87
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
2024-03-08 06:51:34 -03:00
Matheus Afonso Martins Moreira
592e18bf0e
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
2024-03-08 06:50:16 -03:00
Matheus Afonso Martins Moreira
a4ee7dd7fc
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
2024-03-08 06:49:18 -03:00
Matheus Afonso Martins Moreira
b1adbd548e
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.
2024-03-05 21:49:32 -03:00
Matheus Afonso Martins Moreira
6ca553e648
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.
2024-03-05 21:08:10 -03:00
Matheus Afonso Martins Moreira
fb3b96c8b7
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.
2024-03-05 04:41:58 -03:00
Matheus Afonso Martins Moreira
e1b1493894
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.
2024-03-05 04:14:10 -03:00
Matheus Afonso Martins Moreira
92baa2200f
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
2024-03-05 03:58:09 -03:00
Max Zettlmeißl
26e1b7bdc4
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 >
2024-03-05 03:58:09 -03:00
Matheus Afonso Martins Moreira
4a66035f77
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.
2024-03-05 00:46:27 -03:00
Matheus Afonso Martins Moreira
4cca3a0fac
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.
2024-03-05 00:46:27 -03:00
Matheus Afonso Martins Moreira
4633be0845
faces/totp: delete leading underscores
...
Makes for cleaner symbols.
2024-02-25 22:57:47 -03:00
Matheus Afonso Martins Moreira
238709e1d9
faces/totp: rename initializer macro to credential
...
Shorter and far more expressive.
2024-02-25 22:53:15 -03:00
Matheus Afonso Martins Moreira
46a4076f9e
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!
2024-02-25 22:52:31 -03:00
Matheus Afonso Martins Moreira
d70511515e
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.
2024-02-25 22:50:47 -03:00
Matheus Afonso Martins Moreira
69639a5736
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.
2024-02-25 15:24:15 -03:00
Matheus Afonso Martins Moreira
5c376d9b9a
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.
2024-02-25 15:24:15 -03:00
Matheus Afonso Martins Moreira
2df6b2879a
faces/clock: refactor time signal toggling code
...
Simplifies the code by defining dedicated functions for this.
2024-02-25 15:24:15 -03:00
Matheus Afonso Martins Moreira
1e2c23cf13
faces/clock: refactor clock display code
...
Simplifies the code by defining dedicated functions for this.
2024-02-25 15:24:15 -03:00
Matheus Afonso Martins Moreira
830200f9c3
faces/clock: reorder periodic battery check
...
Check the battery after the time has been updated.
Place all the indication code next to each other.
2024-02-25 15:24:14 -03:00
Matheus Afonso Martins Moreira
bf4d7a3f2b
faces/clock: refactor partial time display code
...
Simplifies the code by defining dedicated functions for this.
2024-02-25 15:24:14 -03:00
Matheus Afonso Martins Moreira
8f07192053
faces/clock: refactor full time display code
...
Simplifies the code by defining dedicated functions for this.
2024-02-25 15:24:14 -03:00
Matheus Afonso Martins Moreira
76add5a2da
faces/clock: refactor tick tock animation code
...
Simplifies the code by defining dedicated functions for this.
2024-02-25 15:24:14 -03:00
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