diff options
author | TheOnePerson <a.nebinger@web.de> | 2022-10-26 04:57:53 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-25 21:57:53 -0500 |
commit | cb69a2c181a3126ade2044f223b74077f48e0c77 (patch) | |
tree | 0a1d98b5fbebc0ece884e39a1d9f5d7d26dc6c16 /movement/watch_faces/clock | |
parent | 894d3615e97ebfe22a0da24e0ae5e2d46b9b6e84 (diff) | |
download | Sensor-Watch-cb69a2c181a3126ade2044f223b74077f48e0c77.tar.gz Sensor-Watch-cb69a2c181a3126ade2044f223b74077f48e0c77.tar.bz2 Sensor-Watch-cb69a2c181a3126ade2044f223b74077f48e0c77.zip |
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>
Diffstat (limited to 'movement/watch_faces/clock')
-rw-r--r-- | movement/watch_faces/clock/simple_clock_face.c | 20 | ||||
-rw-r--r-- | movement/watch_faces/clock/simple_clock_face.h | 1 |
2 files changed, 18 insertions, 3 deletions
diff --git a/movement/watch_faces/clock/simple_clock_face.c b/movement/watch_faces/clock/simple_clock_face.c index 23f36672..7721b12a 100644 --- a/movement/watch_faces/clock/simple_clock_face.c +++ b/movement/watch_faces/clock/simple_clock_face.c @@ -27,6 +27,12 @@ #include "watch.h" #include "watch_utility.h" +static void _update_alarm_indicator(bool settings_alarm_enabled, simple_clock_state_t *state) { + state->alarm_enabled = settings_alarm_enabled; + if (state->alarm_enabled) watch_set_indicator(WATCH_INDICATOR_SIGNAL); + else watch_clear_indicator(WATCH_INDICATOR_SIGNAL); +} + void simple_clock_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) { (void) settings; (void) watch_face_index; @@ -45,7 +51,13 @@ void simple_clock_face_activate(movement_settings_t *settings, void *context) { if (watch_tick_animation_is_running()) watch_stop_tick_animation(); if (settings->bit.clock_mode_24h) watch_set_indicator(WATCH_INDICATOR_24H); - if (state->signal_enabled) watch_set_indicator(WATCH_INDICATOR_SIGNAL); + + // handle chime indicator + if (state->signal_enabled) watch_set_indicator(WATCH_INDICATOR_BELL); + else watch_clear_indicator(WATCH_INDICATOR_BELL); + + // show alarm indicator if there is an active alarm + _update_alarm_indicator(settings->bit.alarm_enabled, state); watch_set_colon(); @@ -111,6 +123,8 @@ bool simple_clock_face_loop(movement_event_t event, movement_settings_t *setting } } watch_display_string(buf, pos); + // handle alarm indicator + if (state->alarm_enabled != settings->bit.alarm_enabled) _update_alarm_indicator(settings->bit.alarm_enabled, state); break; case EVENT_MODE_BUTTON_UP: movement_move_to_next_face(); @@ -120,8 +134,8 @@ bool simple_clock_face_loop(movement_event_t event, movement_settings_t *setting break; case EVENT_ALARM_LONG_PRESS: state->signal_enabled = !state->signal_enabled; - if (state->signal_enabled) watch_set_indicator(WATCH_INDICATOR_SIGNAL); - else watch_clear_indicator(WATCH_INDICATOR_SIGNAL); + if (state->signal_enabled) watch_set_indicator(WATCH_INDICATOR_BELL); + else watch_clear_indicator(WATCH_INDICATOR_BELL); break; case EVENT_BACKGROUND_TASK: // uncomment this line to snap back to the clock face when the hour signal sounds: diff --git a/movement/watch_faces/clock/simple_clock_face.h b/movement/watch_faces/clock/simple_clock_face.h index aa625700..1e9babad 100644 --- a/movement/watch_faces/clock/simple_clock_face.h +++ b/movement/watch_faces/clock/simple_clock_face.h @@ -33,6 +33,7 @@ typedef struct { uint8_t watch_face_index; bool signal_enabled; bool battery_low; + bool alarm_enabled; } simple_clock_state_t; void simple_clock_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr); |