Commit graph

72 commits

Author SHA1 Message Date
Matheus Afonso Martins Moreira fe9a0a693d Revert PR #268 - add daylight savings time toggle
The DST code has not yet been fully tested, the upcoming movement
refactor is upon us and it will integrate with the micro timezone
library anyway. Revert it so that next can be merged into main.

This reverts commit 5a8a49a8c7, reversing
changes made to bfadb81e82.
2024-09-17 17:28:41 -03:00
Matheus Afonso Martins Moreira a9d503b807 Revert PR #470 - implement automatic DST toggling
The DST code has not yet been fully tested, the upcoming movement
refactor is upon us and it will integrate with the micro timezone
library anyway. Revert it so that next can be merged into main.

This reverts commit ac5bf8cfce, reversing
changes made to 5a8a49a8c7.
2024-09-17 17:28:32 -03:00
Matheus Afonso Martins Moreira c9cbb82163 Revert merge of PR #437 - debouncing logic
This reverts commit a715265af6, reversing
changes made to 9c093f9540.

Insidious issues were found in the course of long term testing
by the community, and further reviews of the code were not enough
to pinpoint the issue and fix it. So for now the appropriate action
is to revert these changes while development continues, and possibly
merge them back in once they have been stabilized.

Tested-on-hardware-by: David Volovskiy <devolov@gmail.com>
Tested-on-hardware-by: CarpeNoctem <cryptomax@pm.me>
Tested-on-hardware-by: Krzysztof Gałka <@kshysztof@Discord>
2024-09-15 21:00:22 -03:00
Matheus Afonso Martins Moreira be969c4deb Revert PR #387 - fixes LE state restoration
This commit caused state restored from backup registers
to be overwritten. It is thereby reverted until a better
solution is found or movement is refactored.

This reverts commit 524098b925.

Reviewed-by: Matheus Afonso Martins Moreira <matheus@matheusmoreira.com>
References: https://github.com/joeycastillo/Sensor-Watch/pull/474
2024-09-10 12:10:48 -03:00
Matheus Afonso Martins Moreira ac5bf8cfce Merge PR #470 - implement automatic DST toggling
Implements logic to automatically offset daylight saving time settings
when calculating timezone offsets. This should make the DST functions
work automatically with no need for user input in most cases.

Reviewed-by: Matheus Afonso Martins Moreira <matheus@matheusmoreira.com>
GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/470
2024-09-08 13:41:52 -03:00
Matheus Afonso Martins Moreira 5a8a49a8c7 Merge PR #268 - add daylight savings time toggle
Adds a toggle in the preferences face that allows the user
to enable or disable the daylight savings time.

Should help produce the correct results with the sunrise/sunset presets.

A proper solution would be to integrate the tzinfo database
but it's too big for the watch at the time of this writing.
Can't be done unless it can be shrunk down into a subset
the user would be interested. Even then it's a stopgap
since the database is likely to keep growing over time.

Reviewed-by: Matheus Afonso Martins Moreira <matheus@matheusmoreira.com>
GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/268
2024-09-08 11:09:10 -03:00
Matheus Afonso Martins Moreira 014ef32576 Merge PR #293 - add instant LED duration
Adds an instant LED duration preference that only keeps the LED lit
while the LIGHT button remains held down.

Matches the behavior of the original watch.

Reviewed-by: Matheus Afonso Martins Moreira <matheus@matheusmoreira.com>
Tested-on-hardware-by: Wesley Aptekar-Cassels <me@wesleyac.com>
Tested-on-hardware-by: 814d3 (GitHub)
GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/293
2024-09-03 19:06:40 -03:00
Matheus Afonso Martins Moreira 4d6a9345f2 Merge PR #299 - leading zero representation
Adds a movement-wide leading zero 024h representation mode
that's toggleable in the preferences watch face.
Also adds support for the new display mode to existing faces.

I modified the logic a bit to ensure the 24h indicator remains lit
in the simple clock face even when in 024h mode. I also added support
to the more advanced clock face. In the future I will add a compile time
toggle to it as well.

Reviewed-by: Matheus Afonso Martins Moreira <matheus@matheusmoreira.com>
GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/299
2024-09-03 18:49:13 -03:00
Matheus Afonso Martins Moreira a715265af6 Merge PR #437 - debouncing logic
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
2024-08-30 16:44:38 -03:00
David Volovskiy 598e876186 check_and_act_on_daylight_savings now only occurs in one spot 2024-08-04 10:11:33 -04:00
David Volovskiy 2824a62908 Bugfix on not registering the top of an hour 2024-08-04 09:53:04 -04:00
David Volovskiy e50390b673 DST roll is now a global variable in watch_rtc 2024-08-03 10:07:57 -04:00
David Volovskiy fa2907e098 Some more cleanup 2024-08-03 09:38:00 -04:00
David Volovskiy 4c546b14dc The timezone now auto-corrects with DST (but still displays the same offset in the settings screen to the user) 2024-08-02 01:25:01 -04:00
David Volovskiy 149911e4ad Time now auto-updates with DST 2024-08-02 01:23:21 -04:00
David Volovskiy f7d1b8f9f3 Delay for starting the debounce no loonger happens 2024-07-29 23:53:25 -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 7d5aaf60ca.
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 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
R. Alex Barbieri e3d67af604 Merge remote-tracking branch 'origin/main' into manual_dst_toggle
* origin/main: (119 commits)
  add an openocd.cfg for openocd 0.12.0
  Fix compile errors and warnings in movement.c and shell.c
  faces/totp: avoid displaying when key is invalid
  faces/totp: fix error message not displayed bug
  faces/totp: remove dynamic memory allocation
  faces/totp: improve memory usage
  faces: restore simple_clock_face
  uf2conv: argument to `re.split` should be a rawstring
  movement: fix unintended timeout short circuiting
  movement: convert can_sleep an automatic variable
  faces/pulsometer: remember pulsometer measurement
  faces/pulsometer: remember pulsometer calibration
  faces/totp: update copyrights
  faces/totp: allow moving backwards through codes
  faces/clock: add 24h only feature
  faces/clock: update copyrights and credits
  faces/totp: delete leading underscores
  faces/totp: rename initializer macro to credential
  faces/totp: improve TOTP initializer labeling
  faces/totp: decode secrets when setting up
  ...
2024-04-27 13:23:53 -05:00
madhogs 524098b925 add the ability to set location and birthdate in movement config 2024-03-31 13:27:54 +01:00
Wesley Aptekar-Cassels d7369cd00d
Merge branch 'main' into theAlexes/cleanup 2024-01-21 01:31:58 -05:00
Wesley Aptekar-Cassels 6f4917a0d5 Revert "Merge pull request #283 from neutralinsomniac/fix_hourly_chime_background"
This reverts commit 5c94111ea2, reversing
changes made to bc9b4ce700.
2024-01-09 16:22:21 -05:00
Alex Maestas 06d546f179 make it clear that the movement_state contains indexes 2023-12-16 22:08:10 +00:00
Jonathan Glines f633b7634b Support leading zero representation for 24h clock
Toggle between default behavior and leading zero with long-press of alarm
button on page with 24h setting.
2023-10-29 11:15:50 -04:00
Wesley Aptekar-Cassels 30195a2619 movement: Add "instant" led_duration option.
This illuminates the LED only for the time that the button is pressed,
and turns it off as soon as it's released, which is the behaviour of the
original watch.

I chose a led_duration of zero to represent "instant" and all bits set
to represent "no LED", which is arbitrary but seemed more sensible to
me.
2023-09-29 22:10:14 -04:00
Jeremy O'Brien 45f402b4ec move buzzer enabled detection logic into movement for movement_play_signal/tune
this way watch faces don't have to disable/enable the buzzer themselves
before calling movement_play_signal() and movement_play_tune()
2023-09-23 10:56:12 -04:00
Jeremy O'Brien bfde84f01d fix signal tunes not firing in background, and split out foreground/background chime functions 2023-09-22 07:29:04 -04:00
R. Alex Barbieri f3c28ede96 add a manual dst toggle
Uses a simplistic set of jump tables to toggle daylight savings on and off.
2023-09-02 14:52:37 -05:00
joeycastillo 0ef80b62da add movement_default_loop_handler, test with default watch faces 2023-01-14 14:21:04 -05:00
TheOnePerson d0a3fd2377
Add stock stopwatch face (#140)
* buzzer sequences: first draft, does not work on hardware yet (but in simulator)

* buzzer sequences: add changes to movement.c

* buzzer sequences: add demo face to Makefile

* buzzer sequences: fix problem of interrupted sounds. Add logic for repeating sub sequences. Tidy up (move logic to watch_buzzer files, remove buzzer_demo_face)

* buzzer sequences: tidy up even more

* buzzer sequences: disable registering a 32 Hz tick callback for watch faces, so it will be used exclusively by the buzzer sequences functionality

* buzzer sequences: add callback slot functionality to watch_rtc and make watch_buzzer use it. Switch internal buzzer sequences tick frequency to 64 Hz. Revert changes to movement.c

* buzzer sequences: fix parameter sanity check in watch_rtc code

* stock stopwatch: first fully functional implementation

* stock stopwatch: fix typo in comment

* stock stopwatch: handle resuming from deep sleep mode properly

* buzzer sequences/watch_rtc: optimize calling tick callbacks in RTC_Handler

* buzzer sequences/watch_rtc: fix error in calling callback functions

* stock stopwatch: implement workaround for sleep mode

* stock stopwatch: merge current main into stock-stopwatch

* stock stopwatch: use TC counters as source for callbacks

* stock-stopwatch: revert unnecessary changes to watch_buzzer

Co-authored-by: joeycastillo <joeycastillo@utexas.edu>
2023-01-10 16:31:32 -05:00
TheOnePerson cb678d735a
Merge branch 'main' into auto-fire-long-press 2022-10-26 06:43:47 +02:00
TheOnePerson cb69a2c181
Add an Alarm face to movement (#96)
* Add movement_play_alarm_beeps() to movement.c and make alarm sounds customizable. Add alarm indicator to simple watch face.

* Add alarm face

* alarm_face: fix problem with disabling alarms for 00:00.

* Fix typos in comments and get rid of of unused variable warning

* remove unnecessary constant

* simple_clock_face: fix disappearing chime indicator after face switch, enable alarm indicator updates in app loop (for one-time alarms).
movement: handle situations where watch is in sleep mode and chimes fire off at the same time as alarms properly.

* alarm_face: tweak process of displaying things on the lcd. Add extra long and extra short alarms. Increase number of alarm slots to 16.

* alarm face: fix alarms playing one beeping round more than set.

* alarm face: add proper quick cycling of hour and minute setting

* alarm-face: correct am/pm indication and some minor tweaks. Reset movement_config.h to current main branch. simple-watch-face: Remove unnecessary check and swap indicators (alarm / hourly chime)

* alarm-face: reverse commit parts from another branch (accidentially commited logic depending on movement firmware auto firing the long press event)

Co-authored-by: joeycastillo <joeycastillo@utexas.edu>
2022-10-25 21:57:53 -05:00
TheOnePerson 17cd90e72f movement: update comments regarding button events 2022-10-25 21:42:29 +02:00
TheOnePerson 1a80003775 Movement: implement auto firing of long press events and introduce long up event. (Also re-implement alarm_enabled and alarm_note) 2022-10-23 13:07:32 +02:00
joeycastillo b56c60868e allow watch faces to schedule tasks from background 2022-10-22 13:16:46 -05:00
joeycastillo f89cecc56a document return value of watch_face_loop 2022-10-11 23:53:02 -05:00
Jack Bond-Preston b07b548681 movement: fix movement_request_wake() prototype
This function has `void` args, currently it can throw a compiler warning
2022-07-25 15:17:02 +01:00
Joey Castillo b234db74fe movement: wake programmatically from background and play alarm 2022-07-17 00:23:38 -05:00
Joey Castillo 96017d6ec1 movement: add mechanism for watch faces to use backup registers 2022-02-13 11:25:28 -05:00
Joey Castillo b8cb6f3bcf movement: prevent invalid tick frequency from breaking scheduled tasks 2022-02-12 22:19:01 -05:00
Joey Castillo 99c518e421 movement: long press on MODE always dismisses the active face 2022-01-19 14:32:33 -05:00
Joey Castillo 5fccc24c98 Merge branch 'main' of github.com:joeycastillo/Sensor-Watch into main 2022-01-15 19:27:24 -05:00
Joey Castillo 41eaa9c1c0 add MIT license text to movement files 2022-01-15 14:53:56 -05:00
Wesley Ellis 37ff7b9c26 Add movement_cancel_background_task
Provide a way for a scheduled background task to be cancelled
2022-01-01 14:13:04 -05:00
Joey Castillo 1a4612f259 add documentation for watch face index 2021-12-21 08:20:08 -06:00
Joey Castillo 60fe969191 Movement: give watch faces their index at setup time 2021-12-20 17:02:17 -06:00