674 Commits

Author SHA1 Message Date
EGS
278520bfaf Allow setting July 31st as today's date
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!)
2024-07-31 18:17:04 +01:00
David Volovskiy
7bbac4cd80 Brought debounce time to 8ms rather than 15 2024-07-31 07:33:25 -04:00
David Volovskiy
027e42dc58 Moved a few lines around to match main 2024-07-31 07:25:09 -04:00
David Volovskiy
e297b3013e Using debounce that triggers when there's no change for Xms rather than just ignoring new presses after Xms 2024-07-31 07:22:33 -04:00
David Volovskiy
607946ed2e A little bit of clean-up 2024-07-30 07:27:47 -04:00
David Volovskiy
f7d1b8f9f3 Delay for starting the debounce no loonger happens 2024-07-29 23:53:25 -04:00
David Volovskiy
7f2ac61375 Fixed stuck fast_tick 2024-07-29 21:43:32 -04:00
David Volovskiy
73c3ba3ae7 Cleaned up code 2024-07-29 21:05:19 -04:00
David Volovskiy
36117ca207 using cb_fast_tick again 2024-07-29 20:48:17 -04:00
David Volovskiy
9727dac3c3 Revert "Leaving sleep with alarm button up doesn't trigger alarm button"
This reverts commit 7d5aaf60caa943a248a7f635111ddfd50c230389.
2024-07-29 20:28:10 -04:00
David Volovskiy
947e299494 Made the debounce register rising edges rather than falling edges 2024-07-29 20:13:54 -04:00
David Volovskiy
4a4fce428e Removed some dead code 2024-07-29 18:24:58 -04:00
David Volovskiy
df2dac5a07 debouince now uses cb_fast_tick and holding the button now also gets debounced 2024-07-29 18:12:46 -04:00
David Volovskiy
7d5aaf60ca Leaving sleep with alarm button up doesn't trigger alarm button 2024-07-29 07:44:31 -04:00
David Volovskiy
4375ca37e0 Added debouncing 2024-07-29 07:39:51 -04:00
PrimmR
a9e6b82f00 Update timeout & low energy behaviour 2024-07-25 15:31:25 +01:00
voloved
6e26c01de0
Holding light button on a non-element screen will turn on the light (#2)
* Holding light button on a non-element screen will turn on the light.

* The alarm and led button press moves back to the currently-selected element symbol page rather than the next and previous one

* Usage update
2024-07-25 14:18:56 +01:00
PrimmR
cb90a1980f Added LED button combo 2024-07-24 11:18:24 +01:00
atax1a
42c14c2e5b
Merge pull request #420 from voloved/sunrise_sunset_presets
Added ability to add presets to the sunrise and sunset face
2024-07-24 04:49:03 +00:00
voloved
c8702d346e
Added subscreens to periodic table face; added title and faster scrolling (#1)
* Added subscreens to periodic table face; added title and faster scrolling

* Resized buf for element display

* Fixed scrolling to work on actual hardware

* Added delay before _loop_text at title and bugfix on elements shorter than 6 char

* Title screen displays when le_mode starts

* Added documentation on usage and removed unneeded variable
2024-07-23 10:35:38 +01:00
James Haggerty
222c60b072 Fix TOTP LFS printf string 2024-07-21 09:10:28 +10:00
James Haggerty
5f1a651732 Keep light on if interacting
This makes it possible to do a bunch of things without
having to keep touching the light button.

I don't really see any downside with this. If you want
the light to go off, just stop touching buttons.
2024-07-21 08:25:54 +10:00
David Volovskiy
a13c8c35b8 Code review commit 2024-07-20 15:59:42 -04:00
David Volovskiy
9ee319c888 Typo in comment 2024-07-20 14:48:32 -04:00
David Volovskiy
a3d23ab45e Long press of Alarm goes back to default 2024-07-20 14:46:42 -04:00
David Volovskiy
a7c0fb7dfd Added ability to add presets to the sunrise and sunset face 2024-07-20 14:35:37 -04:00
David Volovskiy
2afc2c6721 isolating this bit of complexity in movement function; Add ifdefs in clock faces for DCE 2024-07-10 07:22:55 -04:00
David Volovskiy
7f6a9e5c9b Typo fix on PREFERENCES_FACE_NUM_PREFERENCES 2024-07-08 18:33:17 -04:00
David Volovskiy
b923d50652 CLOCK_FACE_24H_ONLY hides the preference to change the setting and defaults the mode to 24Hr mode 2024-07-08 18:32:41 -04:00
atax1a
5f5d86353f
Merge pull request #397 from madhogs/wyrun-totp-lfs-fix
Reduce totp_face_lfs memory usage
2024-07-08 21:10:46 +00:00
voloved
3eaf807590
Added Timeout; Ability to turn off LED and Sound; Added doublespeed mode. (#1)
* Check that color is valid

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

* Added ability to turn off sound and timer with modes

* Added enum for mode

---------

Co-authored-by: Wesley Ellis <tahnok@gmail.com>
2024-07-07 19:23:31 -04:00
joeycastillo
89a2af92ef silence warnings 2024-07-06 08:52:41 -04:00
Ruben Nic
7a2ecad334 Custom setting of switch from past to to index 2024-05-25 18:16:50 -04:00
Ruben Nic
af0f8d2732 If the alarm is enabled show bell not signal 2024-05-18 10:44:43 -04:00
Ruben Nic
53f11cbd1e have close enough to update less and clean up code 2024-05-15 12:30:00 -04:00
Ruben Nic
fa35b8bb77 Add close enough clock face 2024-05-06 20:32:59 -04:00
Matt Greer
9794f86430 simon_face: Simon game complication 2024-05-05 13:43:33 -04:00
James Haggerty
77ea1b8965 Reduce totp_face_lfs memory usage 2024-04-26 16:05:35 +01:00
atax1a
439843f56b
Merge pull request #388 from TheOnePerson/fix-compile-errors
Fix compile errors and warnings in movement.c and shell.c
2024-04-09 22:24:19 +00:00
madhogs
524098b925 add the ability to set location and birthdate in movement config 2024-03-31 13:27:54 +01:00
TheOnePerson
c22123961f Fix compile errors and warnings in movement.c and shell.c 2024-03-29 11:49:48 +01:00
Wesley Black
69f25f1016
Add files via upload 2024-03-20 17:54:23 -03:00
Wesley Black
0e70adf4d4
Update movement_faces.h 2024-03-20 17:53:45 -03:00
Matheus Afonso Martins Moreira
10701f3d50 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
2024-03-20 12:54:20 -03:00
Matheus Afonso Martins Moreira
7e5c34773a 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
2024-03-20 12:54:10 -03:00
Matheus Afonso Martins Moreira
3f850d79c8 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
2024-03-18 11:40:55 -03:00
Matheus Afonso Martins Moreira
df38c262b8 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
2024-03-17 20:48:54 -03:00
Matheus Afonso Martins Moreira
955ac94de3 faces: restore simple_clock_face
Restore the original simple clock face as requested.
2024-03-16 20:04:08 -03: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