Merge branch 'main' into auto-fire-long-press
This commit is contained in:
commit
cb678d735a
1
movement/make/Makefile
Executable file → Normal file
1
movement/make/Makefile
Executable file → Normal file
@ -68,6 +68,7 @@ SRCS += \
|
||||
../watch_faces/complication/probability_face.c \
|
||||
../watch_faces/complication/wake_face.c \
|
||||
../watch_faces/demo/frequency_correction_face.c \
|
||||
../watch_faces/complication/alarm_face.c \
|
||||
../watch_faces/complication/ratemeter_face.c \
|
||||
# New watch faces go above this line.
|
||||
|
||||
|
@ -52,6 +52,11 @@
|
||||
#include "alt_fw/deep_space_now.h"
|
||||
#endif
|
||||
|
||||
// Default to no secondary face behaviour.
|
||||
#ifndef MOVEMENT_SECONDARY_FACE_INDEX
|
||||
#define MOVEMENT_SECONDARY_FACE_INDEX 0
|
||||
#endif
|
||||
|
||||
#if __EMSCRIPTEN__
|
||||
#include <emscripten.h>
|
||||
#endif
|
||||
@ -209,7 +214,13 @@ void movement_move_to_face(uint8_t watch_face_index) {
|
||||
}
|
||||
|
||||
void movement_move_to_next_face(void) {
|
||||
movement_move_to_face((movement_state.current_watch_face + 1) % MOVEMENT_NUM_FACES);
|
||||
uint16_t face_max;
|
||||
if (MOVEMENT_SECONDARY_FACE_INDEX) {
|
||||
face_max = (movement_state.current_watch_face < (int16_t)MOVEMENT_SECONDARY_FACE_INDEX) ? MOVEMENT_SECONDARY_FACE_INDEX : MOVEMENT_NUM_FACES;
|
||||
} else {
|
||||
face_max = MOVEMENT_NUM_FACES;
|
||||
}
|
||||
movement_move_to_face((movement_state.current_watch_face + 1) % face_max);
|
||||
}
|
||||
|
||||
void movement_schedule_background_task(watch_date_time date_time) {
|
||||
@ -428,14 +439,18 @@ bool app_loop(void) {
|
||||
can_sleep = watch_faces[movement_state.current_watch_face].loop(event, &movement_state.settings, watch_face_contexts[movement_state.current_watch_face]);
|
||||
|
||||
// Long-pressing MODE brings one back to the first face, provided that the watch face hasn't decided to send them elsewhere
|
||||
// (and we're not currently on the first face).
|
||||
// (and we're not currently on the first face). If we're currently on the first face, a long press
|
||||
// of MODE sends us to the secondary faces (if defined).
|
||||
// Note that it's the face's responsibility to provide some way to get to the next face, so if EVENT_MODE_BUTTON_* is
|
||||
// used for face functionality EVENT_MODE_LONG_PRESS should probably be handled and next_face() triggered in the face
|
||||
// (which would effectively disable the normal 'long press to face 0' behaviour).
|
||||
if (event.event_type == EVENT_MODE_LONG_PRESS
|
||||
&& movement_state.current_watch_face > 0
|
||||
&& !movement_state.watch_face_changed) {
|
||||
movement_move_to_face(0);
|
||||
if (movement_state.current_watch_face != 0) {
|
||||
movement_move_to_face(0);
|
||||
} else if (MOVEMENT_SECONDARY_FACE_INDEX) {
|
||||
movement_move_to_face(MOVEMENT_SECONDARY_FACE_INDEX);
|
||||
}
|
||||
}
|
||||
event.event_type = EVENT_NONE;
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ typedef union {
|
||||
// altimeter to display feet or meters as easily as it tells a thermometer to display degrees in F or C.
|
||||
bool clock_mode_24h : 1; // indicates whether clock should use 12 or 24 hour mode.
|
||||
bool use_imperial_units : 1; // indicates whether to use metric units (the default) or imperial.
|
||||
bool alarm_enabled : 1; // indicates whether there is at least one alarm enabled.
|
||||
bool alarm_enabled : 1; // indicates wheter there is at least one alarm enabled.
|
||||
uint8_t reserved : 6; // room for more preferences if needed.
|
||||
} bit;
|
||||
uint32_t reg;
|
||||
|
@ -39,4 +39,11 @@ const watch_face_t watch_faces[] = {
|
||||
|
||||
#define MOVEMENT_NUM_FACES (sizeof(watch_faces) / sizeof(watch_face_t))
|
||||
|
||||
/* Determines what face to go to from the first face if you've already set
|
||||
* a mode long press to go to the first face in preferences, and
|
||||
* excludes these faces from the normal rotation.
|
||||
* Usually it makes sense to set this to the preferences face.
|
||||
*/
|
||||
#define MOVEMENT_SECONDARY_FACE_INDEX 0 // or (MOVEMENT_NUM_FACES - 2)
|
||||
|
||||
#endif // MOVEMENT_CONFIG_H_
|
||||
|
@ -55,6 +55,7 @@
|
||||
#include "probability_face.h"
|
||||
#include "wake_face.h"
|
||||
#include "frequency_correction_face.h"
|
||||
#include "alarm_face.h"
|
||||
#include "ratemeter_face.h"
|
||||
// New includes go above this line.
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user