refactor: watch faces no longer need a pointer to settings!
This commit is contained in:
@@ -61,8 +61,7 @@ static void _update_alarm_indicator(bool settings_alarm_enabled, close_enough_cl
|
||||
};
|
||||
}
|
||||
|
||||
void close_enough_clock_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
|
||||
(void) settings;
|
||||
void close_enough_clock_face_setup(uint8_t watch_face_index, void ** context_ptr) {
|
||||
(void) watch_face_index;
|
||||
|
||||
if (*context_ptr == NULL) {
|
||||
@@ -70,7 +69,7 @@ void close_enough_clock_face_setup(movement_settings_t *settings, uint8_t watch_
|
||||
}
|
||||
}
|
||||
|
||||
void close_enough_clock_face_activate(movement_settings_t *settings, void *context) {
|
||||
void close_enough_clock_face_activate(void *context) {
|
||||
close_enough_clock_state_t *state = (close_enough_clock_state_t *)context;
|
||||
|
||||
if (watch_tick_animation_is_running()) {
|
||||
@@ -89,7 +88,7 @@ void close_enough_clock_face_activate(movement_settings_t *settings, void *conte
|
||||
state->prev_min_checked = -1;
|
||||
}
|
||||
|
||||
bool close_enough_clock_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
|
||||
bool close_enough_clock_face_loop(movement_event_t event, void *context) {
|
||||
close_enough_clock_state_t *state = (close_enough_clock_state_t *)context;
|
||||
|
||||
char buf[11];
|
||||
@@ -221,13 +220,12 @@ bool close_enough_clock_face_loop(movement_event_t event, movement_settings_t *s
|
||||
break;
|
||||
|
||||
default:
|
||||
return movement_default_loop_handler(event, settings);
|
||||
return movement_default_loop_handler(event);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void close_enough_clock_face_resign(movement_settings_t *settings, void *context) {
|
||||
(void) settings;
|
||||
void close_enough_clock_face_resign(void *context) {
|
||||
(void) context;
|
||||
}
|
||||
|
||||
@@ -46,10 +46,10 @@ typedef struct {
|
||||
bool alarm_enabled;
|
||||
} close_enough_clock_state_t;
|
||||
|
||||
void close_enough_clock_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
|
||||
void close_enough_clock_face_activate(movement_settings_t *settings, void *context);
|
||||
bool close_enough_clock_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
|
||||
void close_enough_clock_face_resign(movement_settings_t *settings, void *context);
|
||||
void close_enough_clock_face_setup(uint8_t watch_face_index, void ** context_ptr);
|
||||
void close_enough_clock_face_activate(void *context);
|
||||
bool close_enough_clock_face_loop(movement_event_t event, void *context);
|
||||
void close_enough_clock_face_resign(void *context);
|
||||
|
||||
#define close_enough_clock_face ((const watch_face_t){ \
|
||||
close_enough_clock_face_setup, \
|
||||
|
||||
@@ -55,8 +55,7 @@ static void recalculate(watch_date_time utc_now, day_night_percentage_state_t *s
|
||||
state->result = sun_rise_set(utc_now.unit.year + WATCH_RTC_REFERENCE_YEAR, utc_now.unit.month, utc_now.unit.day, lon, lat, &state->rise, &state->set);
|
||||
}
|
||||
|
||||
void day_night_percentage_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
|
||||
(void) settings;
|
||||
void day_night_percentage_face_setup(uint8_t watch_face_index, void ** context_ptr) {
|
||||
(void) watch_face_index;
|
||||
|
||||
if (*context_ptr == NULL) {
|
||||
@@ -67,12 +66,11 @@ void day_night_percentage_face_setup(movement_settings_t *settings, uint8_t watc
|
||||
}
|
||||
}
|
||||
|
||||
void day_night_percentage_face_activate(movement_settings_t *settings, void *context) {
|
||||
(void) settings;
|
||||
void day_night_percentage_face_activate(void *context) {
|
||||
(void) context;
|
||||
}
|
||||
|
||||
bool day_night_percentage_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
|
||||
bool day_night_percentage_face_loop(movement_event_t event, void *context) {
|
||||
day_night_percentage_state_t *state = (day_night_percentage_state_t *)context;
|
||||
|
||||
char buf[12];
|
||||
@@ -126,14 +124,13 @@ bool day_night_percentage_face_loop(movement_event_t event, movement_settings_t
|
||||
|
||||
break;
|
||||
default:
|
||||
return movement_default_loop_handler(event, settings);
|
||||
return movement_default_loop_handler(event);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void day_night_percentage_face_resign(movement_settings_t *settings, void *context) {
|
||||
(void) settings;
|
||||
void day_night_percentage_face_resign(void *context) {
|
||||
(void) context;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,10 +49,10 @@ typedef struct {
|
||||
double daylen;
|
||||
} day_night_percentage_state_t;
|
||||
|
||||
void day_night_percentage_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
|
||||
void day_night_percentage_face_activate(movement_settings_t *settings, void *context);
|
||||
bool day_night_percentage_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
|
||||
void day_night_percentage_face_resign(movement_settings_t *settings, void *context);
|
||||
void day_night_percentage_face_setup(uint8_t watch_face_index, void ** context_ptr);
|
||||
void day_night_percentage_face_activate(void *context);
|
||||
bool day_night_percentage_face_loop(movement_event_t event, void *context);
|
||||
void day_night_percentage_face_resign(void *context);
|
||||
|
||||
#define day_night_percentage_face ((const watch_face_t){ \
|
||||
day_night_percentage_face_setup, \
|
||||
|
||||
@@ -29,10 +29,9 @@
|
||||
|
||||
|
||||
|
||||
void decimal_time_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
|
||||
void decimal_time_face_setup(uint8_t watch_face_index, void ** context_ptr) {
|
||||
// These next two lines just silence the compiler warnings associated with unused parameters.
|
||||
// We have no use for the settings or the watch_face_index, so we make that explicit here.
|
||||
(void) settings;
|
||||
(void) watch_face_index;
|
||||
(void) context_ptr;
|
||||
// At boot, context_ptr will be NULL indicating that we don't have anyplace to store our context.
|
||||
@@ -48,10 +47,9 @@ void decimal_time_face_setup(movement_settings_t *settings, uint8_t watch_face_i
|
||||
}
|
||||
|
||||
|
||||
void decimal_time_face_activate(movement_settings_t *settings, void *context) {
|
||||
void decimal_time_face_activate(void *context) {
|
||||
|
||||
// same as above: silence the warning, we don't need to check the settings.
|
||||
(void) settings;
|
||||
|
||||
// we do however need to set some things in our context. Here we cast it to the correct type...
|
||||
decimal_time_face_state_t *state = (decimal_time_face_state_t *)context;
|
||||
@@ -68,9 +66,8 @@ void decimal_time_face_activate(movement_settings_t *settings, void *context) {
|
||||
|
||||
|
||||
|
||||
bool decimal_time_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
|
||||
bool decimal_time_face_loop(movement_event_t event, void *context) {
|
||||
|
||||
(void) settings;
|
||||
decimal_time_face_state_t *state = (decimal_time_face_state_t *)context;
|
||||
|
||||
char buf[16];
|
||||
@@ -147,7 +144,7 @@ bool decimal_time_face_loop(movement_event_t event, movement_settings_t *setting
|
||||
break;
|
||||
|
||||
default:
|
||||
movement_default_loop_handler(event, settings);
|
||||
movement_default_loop_handler(event);
|
||||
break;
|
||||
|
||||
}
|
||||
@@ -155,10 +152,9 @@ bool decimal_time_face_loop(movement_event_t event, movement_settings_t *setting
|
||||
return true;
|
||||
}
|
||||
|
||||
void decimal_time_face_resign(movement_settings_t *settings, void *context) {
|
||||
void decimal_time_face_resign(void *context) {
|
||||
// our watch face, like most watch faces, has nothing special to do when resigning.
|
||||
// there are no peripherals or sensors here to worry about turning off.
|
||||
(void) settings;
|
||||
(void) context;
|
||||
|
||||
}
|
||||
|
||||
@@ -53,10 +53,10 @@ typedef struct {
|
||||
uint8_t features_to_show : 2 ; // what features are to be displayed?
|
||||
} decimal_time_face_state_t;
|
||||
|
||||
void decimal_time_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
|
||||
void decimal_time_face_activate(movement_settings_t *settings, void *context);
|
||||
bool decimal_time_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
|
||||
void decimal_time_face_resign(movement_settings_t *settings, void *context);
|
||||
void decimal_time_face_setup(uint8_t watch_face_index, void ** context_ptr);
|
||||
void decimal_time_face_activate(void *context);
|
||||
bool decimal_time_face_loop(movement_event_t event, void *context);
|
||||
void decimal_time_face_resign(void *context);
|
||||
// void decimal_time_face_wants_background_task();
|
||||
|
||||
|
||||
|
||||
@@ -26,8 +26,7 @@
|
||||
#include <string.h>
|
||||
#include "french_revolutionary_face.h"
|
||||
|
||||
void french_revolutionary_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
|
||||
(void) settings;
|
||||
void french_revolutionary_face_setup(uint8_t watch_face_index, void ** context_ptr) {
|
||||
(void) watch_face_index;
|
||||
if (*context_ptr == NULL) {
|
||||
*context_ptr = malloc(sizeof(french_revolutionary_state_t));
|
||||
@@ -42,15 +41,14 @@ void french_revolutionary_face_setup(movement_settings_t *settings, uint8_t watc
|
||||
// Do any pin or peripheral setup here; this will be called whenever the watch wakes from deep sleep.
|
||||
}
|
||||
|
||||
void french_revolutionary_face_activate(movement_settings_t *settings, void *context) {
|
||||
(void) settings;
|
||||
void french_revolutionary_face_activate(void *context) {
|
||||
french_revolutionary_state_t *state = (french_revolutionary_state_t *)context;
|
||||
|
||||
// Handle any tasks related to your watch face coming on screen.
|
||||
state->colon_set_after_splash = false;
|
||||
}
|
||||
|
||||
bool french_revolutionary_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
|
||||
bool french_revolutionary_face_loop(movement_event_t event, void *context) {
|
||||
french_revolutionary_state_t *state = (french_revolutionary_state_t *)context;
|
||||
|
||||
char buf[11];
|
||||
@@ -122,7 +120,7 @@ bool french_revolutionary_face_loop(movement_event_t event, movement_settings_t
|
||||
// * EVENT_MODE_BUTTON_UP moves to the next watch face in the list
|
||||
// * EVENT_MODE_LONG_PRESS returns to the first watch face (or skips to the secondary watch face, if configured)
|
||||
// You can override any of these behaviors by adding a case for these events to this switch statement.
|
||||
return movement_default_loop_handler(event, settings);
|
||||
return movement_default_loop_handler(event);
|
||||
}
|
||||
|
||||
// return true if the watch can enter standby mode. Generally speaking, you should always return true.
|
||||
@@ -134,8 +132,7 @@ bool french_revolutionary_face_loop(movement_event_t event, movement_settings_t
|
||||
return true;
|
||||
}
|
||||
|
||||
void french_revolutionary_face_resign(movement_settings_t *settings, void *context) {
|
||||
(void) settings;
|
||||
void french_revolutionary_face_resign(void *context) {
|
||||
(void) context;
|
||||
|
||||
// handle any cleanup before your watch face goes off-screen.
|
||||
|
||||
@@ -63,10 +63,10 @@ typedef struct {
|
||||
uint8_t hour : 5; // 0-10
|
||||
} fr_decimal_time;
|
||||
|
||||
void french_revolutionary_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
|
||||
void french_revolutionary_face_activate(movement_settings_t *settings, void *context);
|
||||
bool french_revolutionary_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
|
||||
void french_revolutionary_face_resign(movement_settings_t *settings, void *context);
|
||||
void french_revolutionary_face_setup(uint8_t watch_face_index, void ** context_ptr);
|
||||
void french_revolutionary_face_activate(void *context);
|
||||
bool french_revolutionary_face_loop(movement_event_t event, void *context);
|
||||
void french_revolutionary_face_resign(void *context);
|
||||
char fix_character_one(char digit);
|
||||
fr_decimal_time get_decimal_time(watch_date_time *date_time);
|
||||
void set_display_buffer(char *buf, french_revolutionary_state_t *state, fr_decimal_time *decimal_time, watch_date_time *date_time);
|
||||
|
||||
@@ -67,7 +67,7 @@ static void _h_to_hms(mars_clock_hms_t *date_time, double h) {
|
||||
date_time->second = round(seconds % 60);
|
||||
}
|
||||
|
||||
static void _update(movement_settings_t *settings, mars_time_state_t *state) {
|
||||
static void _update(mars_time_state_t *state) {
|
||||
char buf[11];
|
||||
watch_date_time date_time = watch_rtc_get_date_time();
|
||||
uint32_t now = watch_utility_date_time_to_unix_time(date_time, movement_get_current_timezone_offset());
|
||||
@@ -106,8 +106,7 @@ static void _update(movement_settings_t *settings, mars_time_state_t *state) {
|
||||
watch_display_string(buf, 0);
|
||||
}
|
||||
|
||||
void mars_time_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
|
||||
(void) settings;
|
||||
void mars_time_face_setup(uint8_t watch_face_index, void ** context_ptr) {
|
||||
(void) watch_face_index;
|
||||
if (*context_ptr == NULL) {
|
||||
*context_ptr = malloc(sizeof(mars_time_state_t));
|
||||
@@ -115,30 +114,29 @@ void mars_time_face_setup(movement_settings_t *settings, uint8_t watch_face_inde
|
||||
}
|
||||
}
|
||||
|
||||
void mars_time_face_activate(movement_settings_t *settings, void *context) {
|
||||
(void) settings;
|
||||
void mars_time_face_activate(void *context) {
|
||||
mars_time_state_t *state = (mars_time_state_t *)context;
|
||||
(void) state;
|
||||
}
|
||||
|
||||
bool mars_time_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
|
||||
bool mars_time_face_loop(movement_event_t event, void *context) {
|
||||
mars_time_state_t *state = (mars_time_state_t *)context;
|
||||
|
||||
switch (event.event_type) {
|
||||
case EVENT_ACTIVATE:
|
||||
case EVENT_TICK:
|
||||
_update(settings, state);
|
||||
_update(state);
|
||||
break;
|
||||
case EVENT_LIGHT_BUTTON_UP:
|
||||
state->displaying_sol = !state->displaying_sol;
|
||||
_update(settings, state);
|
||||
_update(state);
|
||||
break;
|
||||
case EVENT_LIGHT_LONG_PRESS:
|
||||
movement_illuminate_led();
|
||||
break;
|
||||
case EVENT_ALARM_BUTTON_UP:
|
||||
state->current_site = (state->current_site + 1) % MARS_TIME_NUM_SITES;
|
||||
_update(settings, state);
|
||||
_update(state);
|
||||
break;
|
||||
case EVENT_TIMEOUT:
|
||||
// TODO: make this lower power so we can avoid timeout
|
||||
@@ -152,15 +150,14 @@ bool mars_time_face_loop(movement_event_t event, movement_settings_t *settings,
|
||||
// don't light up every time light is hit
|
||||
break;
|
||||
default:
|
||||
movement_default_loop_handler(event, settings);
|
||||
movement_default_loop_handler(event);
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void mars_time_face_resign(movement_settings_t *settings, void *context) {
|
||||
(void) settings;
|
||||
void mars_time_face_resign(void *context) {
|
||||
(void) context;
|
||||
}
|
||||
|
||||
|
||||
@@ -67,10 +67,10 @@ typedef struct {
|
||||
bool displaying_sol;
|
||||
} mars_time_state_t;
|
||||
|
||||
void mars_time_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
|
||||
void mars_time_face_activate(movement_settings_t *settings, void *context);
|
||||
bool mars_time_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
|
||||
void mars_time_face_resign(movement_settings_t *settings, void *context);
|
||||
void mars_time_face_setup(uint8_t watch_face_index, void ** context_ptr);
|
||||
void mars_time_face_activate(void *context);
|
||||
bool mars_time_face_loop(movement_event_t event, void *context);
|
||||
void mars_time_face_resign(void *context);
|
||||
|
||||
#define mars_time_face ((const watch_face_t){ \
|
||||
mars_time_face_setup, \
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <string.h>
|
||||
#include "minimal_clock_face.h"
|
||||
|
||||
static void _minimal_clock_face_update_display(movement_settings_t *settings) {
|
||||
static void _minimal_clock_face_update_display() {
|
||||
watch_date_time date_time = watch_rtc_get_date_time();
|
||||
char buffer[11];
|
||||
|
||||
@@ -40,8 +40,7 @@ static void _minimal_clock_face_update_display(movement_settings_t *settings) {
|
||||
watch_display_string(buffer, 4);
|
||||
}
|
||||
|
||||
void minimal_clock_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
|
||||
(void) settings;
|
||||
void minimal_clock_face_setup(uint8_t watch_face_index, void ** context_ptr) {
|
||||
(void) watch_face_index;
|
||||
if (*context_ptr == NULL) {
|
||||
*context_ptr = malloc(sizeof(minimal_clock_state_t));
|
||||
@@ -51,24 +50,23 @@ void minimal_clock_face_setup(movement_settings_t *settings, uint8_t watch_face_
|
||||
// Do any pin or peripheral setup here; this will be called whenever the watch wakes from deep sleep.
|
||||
}
|
||||
|
||||
void minimal_clock_face_activate(movement_settings_t *settings, void *context) {
|
||||
(void) settings;
|
||||
void minimal_clock_face_activate(void *context) {
|
||||
(void) context;
|
||||
// Handle any tasks related to your watch face coming on screen.
|
||||
watch_set_colon();
|
||||
}
|
||||
|
||||
bool minimal_clock_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
|
||||
bool minimal_clock_face_loop(movement_event_t event, void *context) {
|
||||
(void) context;
|
||||
|
||||
switch (event.event_type) {
|
||||
case EVENT_ACTIVATE:
|
||||
// Show your initial UI here.
|
||||
_minimal_clock_face_update_display(settings);
|
||||
_minimal_clock_face_update_display();
|
||||
break;
|
||||
case EVENT_TICK:
|
||||
// If needed, update your display here.
|
||||
_minimal_clock_face_update_display(settings);
|
||||
_minimal_clock_face_update_display();
|
||||
break;
|
||||
case EVENT_LIGHT_BUTTON_UP:
|
||||
// You can use the Light button for your own purposes. Note that by default, Movement will also
|
||||
@@ -88,7 +86,7 @@ bool minimal_clock_face_loop(movement_event_t event, movement_settings_t *settin
|
||||
// Avoid displaying fast-updating values like seconds, since the display won't update again for 60 seconds.
|
||||
// You should also consider starting the tick animation, to show the wearer that this is sleep mode:
|
||||
// watch_start_tick_animation(500);
|
||||
_minimal_clock_face_update_display(settings);
|
||||
_minimal_clock_face_update_display();
|
||||
break;
|
||||
default:
|
||||
// Movement's default loop handler will step in for any cases you don't handle above:
|
||||
@@ -96,7 +94,7 @@ bool minimal_clock_face_loop(movement_event_t event, movement_settings_t *settin
|
||||
// * EVENT_MODE_BUTTON_UP moves to the next watch face in the list
|
||||
// * EVENT_MODE_LONG_PRESS returns to the first watch face (or skips to the secondary watch face, if configured)
|
||||
// You can override any of these behaviors by adding a case for these events to this switch statement.
|
||||
return movement_default_loop_handler(event, settings);
|
||||
return movement_default_loop_handler(event);
|
||||
}
|
||||
|
||||
// return true if the watch can enter standby mode. Generally speaking, you should always return true.
|
||||
@@ -108,8 +106,7 @@ bool minimal_clock_face_loop(movement_event_t event, movement_settings_t *settin
|
||||
return true;
|
||||
}
|
||||
|
||||
void minimal_clock_face_resign(movement_settings_t *settings, void *context) {
|
||||
(void) settings;
|
||||
void minimal_clock_face_resign(void *context) {
|
||||
(void) context;
|
||||
|
||||
// handle any cleanup before your watch face goes off-screen.
|
||||
|
||||
@@ -40,10 +40,10 @@ typedef struct {
|
||||
uint8_t unused;
|
||||
} minimal_clock_state_t;
|
||||
|
||||
void minimal_clock_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
|
||||
void minimal_clock_face_activate(movement_settings_t *settings, void *context);
|
||||
bool minimal_clock_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
|
||||
void minimal_clock_face_resign(movement_settings_t *settings, void *context);
|
||||
void minimal_clock_face_setup(uint8_t watch_face_index, void ** context_ptr);
|
||||
void minimal_clock_face_activate(void *context);
|
||||
bool minimal_clock_face_loop(movement_event_t event, void *context);
|
||||
void minimal_clock_face_resign(void *context);
|
||||
|
||||
#define minimal_clock_face ((const watch_face_t){ \
|
||||
minimal_clock_face_setup, \
|
||||
|
||||
@@ -66,8 +66,7 @@ static void _update_alarm_indicator(bool settings_alarm_enabled, minute_repeater
|
||||
else watch_clear_indicator(WATCH_INDICATOR_SIGNAL);
|
||||
}
|
||||
|
||||
void minute_repeater_decimal_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
|
||||
(void) settings;
|
||||
void minute_repeater_decimal_face_setup(uint8_t watch_face_index, void ** context_ptr) {
|
||||
(void) watch_face_index;
|
||||
|
||||
if (*context_ptr == NULL) {
|
||||
@@ -78,7 +77,7 @@ void minute_repeater_decimal_face_setup(movement_settings_t *settings, uint8_t w
|
||||
}
|
||||
}
|
||||
|
||||
void minute_repeater_decimal_face_activate(movement_settings_t *settings, void *context) {
|
||||
void minute_repeater_decimal_face_activate(void *context) {
|
||||
minute_repeater_decimal_state_t *state = (minute_repeater_decimal_state_t *)context;
|
||||
|
||||
if (watch_tick_animation_is_running()) watch_stop_tick_animation();
|
||||
@@ -98,7 +97,7 @@ void minute_repeater_decimal_face_activate(movement_settings_t *settings, void *
|
||||
state->previous_date_time = 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
bool minute_repeater_decimal_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
|
||||
bool minute_repeater_decimal_face_loop(movement_event_t event, void *context) {
|
||||
minute_repeater_decimal_state_t *state = (minute_repeater_decimal_state_t *)context;
|
||||
char buf[11];
|
||||
uint8_t pos;
|
||||
@@ -216,19 +215,17 @@ bool minute_repeater_decimal_face_loop(movement_event_t event, movement_settings
|
||||
|
||||
break;
|
||||
default:
|
||||
return movement_default_loop_handler(event, settings);
|
||||
return movement_default_loop_handler(event);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void minute_repeater_decimal_face_resign(movement_settings_t *settings, void *context) {
|
||||
(void) settings;
|
||||
void minute_repeater_decimal_face_resign(void *context) {
|
||||
(void) context;
|
||||
}
|
||||
|
||||
bool minute_repeater_decimal_face_wants_background_task(movement_settings_t *settings, void *context) {
|
||||
(void) settings;
|
||||
bool minute_repeater_decimal_face_wants_background_task(void *context) {
|
||||
minute_repeater_decimal_state_t *state = (minute_repeater_decimal_state_t *)context;
|
||||
if (!state->signal_enabled) return false;
|
||||
|
||||
|
||||
@@ -67,11 +67,11 @@ typedef struct {
|
||||
void mrd_play_hour_chime(void);
|
||||
void mrd_play_tens_chime(void);
|
||||
void mrd_play_minute_chime(void);
|
||||
void minute_repeater_decimal_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
|
||||
void minute_repeater_decimal_face_activate(movement_settings_t *settings, void *context);
|
||||
bool minute_repeater_decimal_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
|
||||
void minute_repeater_decimal_face_resign(movement_settings_t *settings, void *context);
|
||||
bool minute_repeater_decimal_face_wants_background_task(movement_settings_t *settings, void *context);
|
||||
void minute_repeater_decimal_face_setup(uint8_t watch_face_index, void ** context_ptr);
|
||||
void minute_repeater_decimal_face_activate(void *context);
|
||||
bool minute_repeater_decimal_face_loop(movement_event_t event, void *context);
|
||||
void minute_repeater_decimal_face_resign(void *context);
|
||||
bool minute_repeater_decimal_face_wants_background_task(void *context);
|
||||
|
||||
#define minute_repeater_decimal_face ((const watch_face_t){ \
|
||||
minute_repeater_decimal_face_setup, \
|
||||
|
||||
@@ -51,8 +51,7 @@ static void _update_alarm_indicator(bool settings_alarm_enabled, repetition_minu
|
||||
else watch_clear_indicator(WATCH_INDICATOR_SIGNAL);
|
||||
}
|
||||
|
||||
void repetition_minute_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
|
||||
(void) settings;
|
||||
void repetition_minute_face_setup(uint8_t watch_face_index, void ** context_ptr) {
|
||||
(void) watch_face_index;
|
||||
|
||||
if (*context_ptr == NULL) {
|
||||
@@ -63,7 +62,7 @@ void repetition_minute_face_setup(movement_settings_t *settings, uint8_t watch_f
|
||||
}
|
||||
}
|
||||
|
||||
void repetition_minute_face_activate(movement_settings_t *settings, void *context) {
|
||||
void repetition_minute_face_activate(void *context) {
|
||||
repetition_minute_state_t *state = (repetition_minute_state_t *)context;
|
||||
|
||||
if (watch_tick_animation_is_running()) watch_stop_tick_animation();
|
||||
@@ -83,7 +82,7 @@ void repetition_minute_face_activate(movement_settings_t *settings, void *contex
|
||||
state->previous_date_time = 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
bool repetition_minute_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
|
||||
bool repetition_minute_face_loop(movement_event_t event, void *context) {
|
||||
repetition_minute_state_t *state = (repetition_minute_state_t *)context;
|
||||
char buf[11];
|
||||
uint8_t pos;
|
||||
@@ -199,19 +198,17 @@ bool repetition_minute_face_loop(movement_event_t event, movement_settings_t *se
|
||||
|
||||
break;
|
||||
default:
|
||||
return movement_default_loop_handler(event, settings);
|
||||
return movement_default_loop_handler(event);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void repetition_minute_face_resign(movement_settings_t *settings, void *context) {
|
||||
(void) settings;
|
||||
void repetition_minute_face_resign(void *context) {
|
||||
(void) context;
|
||||
}
|
||||
|
||||
bool repetition_minute_face_wants_background_task(movement_settings_t *settings, void *context) {
|
||||
(void) settings;
|
||||
bool repetition_minute_face_wants_background_task(void *context) {
|
||||
repetition_minute_state_t *state = (repetition_minute_state_t *)context;
|
||||
if (!state->signal_enabled) return false;
|
||||
|
||||
|
||||
@@ -66,11 +66,11 @@ typedef struct {
|
||||
void play_hour_chime(void);
|
||||
void play_quarter_chime(void);
|
||||
void play_minute_chime(void);
|
||||
void repetition_minute_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
|
||||
void repetition_minute_face_activate(movement_settings_t *settings, void *context);
|
||||
bool repetition_minute_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
|
||||
void repetition_minute_face_resign(movement_settings_t *settings, void *context);
|
||||
bool repetition_minute_face_wants_background_task(movement_settings_t *settings, void *context);
|
||||
void repetition_minute_face_setup(uint8_t watch_face_index, void ** context_ptr);
|
||||
void repetition_minute_face_activate(void *context);
|
||||
bool repetition_minute_face_loop(movement_event_t event, void *context);
|
||||
void repetition_minute_face_resign(void *context);
|
||||
bool repetition_minute_face_wants_background_task(void *context);
|
||||
|
||||
#define repetition_minute_face ((const watch_face_t){ \
|
||||
repetition_minute_face_setup, \
|
||||
|
||||
@@ -45,8 +45,7 @@ static void _display_left_aligned(uint8_t value) {
|
||||
}
|
||||
}
|
||||
|
||||
void simple_clock_bin_led_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
|
||||
(void) settings;
|
||||
void simple_clock_bin_led_face_setup(uint8_t watch_face_index, void ** context_ptr) {
|
||||
if (*context_ptr == NULL) {
|
||||
*context_ptr = malloc(sizeof(simple_clock_bin_led_state_t));
|
||||
memset(*context_ptr, 0, sizeof(simple_clock_bin_led_state_t));
|
||||
@@ -55,7 +54,7 @@ void simple_clock_bin_led_face_setup(movement_settings_t *settings, uint8_t watc
|
||||
}
|
||||
}
|
||||
|
||||
void simple_clock_bin_led_face_activate(movement_settings_t *settings, void *context) {
|
||||
void simple_clock_bin_led_face_activate(void *context) {
|
||||
simple_clock_bin_led_state_t *state = (simple_clock_bin_led_state_t *)context;
|
||||
|
||||
if (watch_tick_animation_is_running()) watch_stop_tick_animation();
|
||||
@@ -75,7 +74,7 @@ void simple_clock_bin_led_face_activate(movement_settings_t *settings, void *con
|
||||
state->previous_date_time = 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
bool simple_clock_bin_led_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
|
||||
bool simple_clock_bin_led_face_loop(movement_event_t event, void *context) {
|
||||
simple_clock_bin_led_state_t *state = (simple_clock_bin_led_state_t *)context;
|
||||
char buf[11];
|
||||
uint8_t pos;
|
||||
@@ -200,19 +199,17 @@ bool simple_clock_bin_led_face_loop(movement_event_t event, movement_settings_t
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return movement_default_loop_handler(event, settings);
|
||||
return movement_default_loop_handler(event);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void simple_clock_bin_led_face_resign(movement_settings_t *settings, void *context) {
|
||||
(void) settings;
|
||||
void simple_clock_bin_led_face_resign(void *context) {
|
||||
(void) context;
|
||||
}
|
||||
|
||||
bool simple_clock_bin_led_face_wants_background_task(movement_settings_t *settings, void *context) {
|
||||
(void) settings;
|
||||
bool simple_clock_bin_led_face_wants_background_task(void *context) {
|
||||
simple_clock_bin_led_state_t *state = (simple_clock_bin_led_state_t *)context;
|
||||
if (!state->signal_enabled) return false;
|
||||
|
||||
|
||||
@@ -64,11 +64,11 @@ typedef struct {
|
||||
uint8_t ticks;
|
||||
} simple_clock_bin_led_state_t;
|
||||
|
||||
void simple_clock_bin_led_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
|
||||
void simple_clock_bin_led_face_activate(movement_settings_t *settings, void *context);
|
||||
bool simple_clock_bin_led_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
|
||||
void simple_clock_bin_led_face_resign(movement_settings_t *settings, void *context);
|
||||
bool simple_clock_bin_led_face_wants_background_task(movement_settings_t *settings, void *context);
|
||||
void simple_clock_bin_led_face_setup(uint8_t watch_face_index, void ** context_ptr);
|
||||
void simple_clock_bin_led_face_activate(void *context);
|
||||
bool simple_clock_bin_led_face_loop(movement_event_t event, void *context);
|
||||
void simple_clock_bin_led_face_resign(void *context);
|
||||
bool simple_clock_bin_led_face_wants_background_task(void *context);
|
||||
|
||||
#define simple_clock_bin_led_face ((const watch_face_t){ \
|
||||
simple_clock_bin_led_face_setup, \
|
||||
|
||||
@@ -33,8 +33,7 @@ static void _update_alarm_indicator(bool settings_alarm_enabled, weeknumber_cloc
|
||||
else watch_clear_indicator(WATCH_INDICATOR_SIGNAL);
|
||||
}
|
||||
|
||||
void weeknumber_clock_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
|
||||
(void) settings;
|
||||
void weeknumber_clock_face_setup(uint8_t watch_face_index, void ** context_ptr) {
|
||||
(void) watch_face_index;
|
||||
|
||||
if (*context_ptr == NULL) {
|
||||
@@ -45,7 +44,7 @@ void weeknumber_clock_face_setup(movement_settings_t *settings, uint8_t watch_fa
|
||||
}
|
||||
}
|
||||
|
||||
void weeknumber_clock_face_activate(movement_settings_t *settings, void *context) {
|
||||
void weeknumber_clock_face_activate(void *context) {
|
||||
weeknumber_clock_state_t *state = (weeknumber_clock_state_t *)context;
|
||||
|
||||
if (watch_tick_animation_is_running()) watch_stop_tick_animation();
|
||||
@@ -65,7 +64,7 @@ void weeknumber_clock_face_activate(movement_settings_t *settings, void *context
|
||||
state->previous_date_time = 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
bool weeknumber_clock_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
|
||||
bool weeknumber_clock_face_loop(movement_event_t event, void *context) {
|
||||
weeknumber_clock_state_t *state = (weeknumber_clock_state_t *)context;
|
||||
char buf[11];
|
||||
uint8_t pos;
|
||||
@@ -133,20 +132,18 @@ bool weeknumber_clock_face_loop(movement_event_t event, movement_settings_t *set
|
||||
movement_play_signal();
|
||||
break;
|
||||
default:
|
||||
movement_default_loop_handler(event, settings);
|
||||
movement_default_loop_handler(event);
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void weeknumber_clock_face_resign(movement_settings_t *settings, void *context) {
|
||||
(void) settings;
|
||||
void weeknumber_clock_face_resign(void *context) {
|
||||
(void) context;
|
||||
}
|
||||
|
||||
bool weeknumber_clock_face_wants_background_task(movement_settings_t *settings, void *context) {
|
||||
(void) settings;
|
||||
bool weeknumber_clock_face_wants_background_task(void *context) {
|
||||
weeknumber_clock_state_t *state = (weeknumber_clock_state_t *)context;
|
||||
if (!state->signal_enabled) return false;
|
||||
|
||||
|
||||
@@ -44,11 +44,11 @@ typedef struct {
|
||||
bool alarm_enabled;
|
||||
} weeknumber_clock_state_t;
|
||||
|
||||
void weeknumber_clock_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
|
||||
void weeknumber_clock_face_activate(movement_settings_t *settings, void *context);
|
||||
bool weeknumber_clock_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
|
||||
void weeknumber_clock_face_resign(movement_settings_t *settings, void *context);
|
||||
bool weeknumber_clock_face_wants_background_task(movement_settings_t *settings, void *context);
|
||||
void weeknumber_clock_face_setup(uint8_t watch_face_index, void ** context_ptr);
|
||||
void weeknumber_clock_face_activate(void *context);
|
||||
bool weeknumber_clock_face_loop(movement_event_t event, void *context);
|
||||
void weeknumber_clock_face_resign(void *context);
|
||||
bool weeknumber_clock_face_wants_background_task(void *context);
|
||||
|
||||
#define weeknumber_clock_face ((const watch_face_t){ \
|
||||
weeknumber_clock_face_setup, \
|
||||
|
||||
@@ -121,9 +121,8 @@ static void beep_disable() {
|
||||
watch_buzzer_play_note(BUZZER_NOTE_G7, 75);
|
||||
}
|
||||
|
||||
void world_clock2_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void **context_ptr)
|
||||
void world_clock2_face_setup(uint8_t watch_face_index, void **context_ptr)
|
||||
{
|
||||
(void) settings;
|
||||
(void) watch_face_index;
|
||||
|
||||
if (*context_ptr == NULL) {
|
||||
@@ -136,9 +135,8 @@ void world_clock2_face_setup(movement_settings_t *settings, uint8_t watch_face_i
|
||||
}
|
||||
}
|
||||
|
||||
void world_clock2_face_activate(movement_settings_t *settings, void *context)
|
||||
void world_clock2_face_activate(void *context)
|
||||
{
|
||||
(void) settings;
|
||||
world_clock2_state_t *state = (world_clock2_state_t *) context;
|
||||
|
||||
if (watch_tick_animation_is_running())
|
||||
@@ -157,7 +155,7 @@ void world_clock2_face_activate(movement_settings_t *settings, void *context)
|
||||
refresh_face = true;
|
||||
}
|
||||
|
||||
static bool mode_display(movement_event_t event, movement_settings_t *settings, world_clock2_state_t *state)
|
||||
static bool mode_display(movement_event_t event, world_clock2_state_t *state)
|
||||
{
|
||||
char buf[11];
|
||||
uint8_t pos;
|
||||
@@ -260,13 +258,13 @@ static bool mode_display(movement_event_t event, movement_settings_t *settings,
|
||||
movement_move_to_next_face();
|
||||
break;
|
||||
default:
|
||||
return movement_default_loop_handler(event, settings);
|
||||
return movement_default_loop_handler(event);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool mode_settings(movement_event_t event, movement_settings_t *settings, world_clock2_state_t *state)
|
||||
static bool mode_settings(movement_event_t event, world_clock2_state_t *state)
|
||||
{
|
||||
char buf[11];
|
||||
int8_t hours, minutes;
|
||||
@@ -352,26 +350,25 @@ static bool mode_settings(movement_event_t event, movement_settings_t *settings,
|
||||
movement_move_to_next_face();
|
||||
break;
|
||||
default:
|
||||
return movement_default_loop_handler(event, settings);
|
||||
return movement_default_loop_handler(event);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool world_clock2_face_loop(movement_event_t event, movement_settings_t *settings, void *context)
|
||||
bool world_clock2_face_loop(movement_event_t event, void *context)
|
||||
{
|
||||
world_clock2_state_t *state = (world_clock2_state_t *) context;
|
||||
switch (state->current_mode) {
|
||||
case WORLD_CLOCK2_MODE_DISPLAY:
|
||||
return mode_display(event, settings, state);
|
||||
return mode_display(event, state);
|
||||
case WORLD_CLOCK2_MODE_SETTINGS:
|
||||
return mode_settings(event, settings, state);
|
||||
return mode_settings(event, state);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void world_clock2_face_resign(movement_settings_t *settings, void *context)
|
||||
void world_clock2_face_resign(void *context)
|
||||
{
|
||||
(void) settings;
|
||||
(void) context;
|
||||
}
|
||||
|
||||
@@ -106,10 +106,10 @@ typedef struct {
|
||||
uint32_t previous_date_time;
|
||||
} world_clock2_state_t;
|
||||
|
||||
void world_clock2_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void **context_ptr);
|
||||
void world_clock2_face_activate(movement_settings_t *settings, void *context);
|
||||
bool world_clock2_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
|
||||
void world_clock2_face_resign(movement_settings_t *settings, void *context);
|
||||
void world_clock2_face_setup(uint8_t watch_face_index, void **context_ptr);
|
||||
void world_clock2_face_activate(void *context);
|
||||
bool world_clock2_face_loop(movement_event_t event, void *context);
|
||||
void world_clock2_face_resign(void *context);
|
||||
|
||||
#define world_clock2_face ((const watch_face_t){ \
|
||||
world_clock2_face_setup, \
|
||||
|
||||
@@ -90,8 +90,7 @@ static const int32_t clock_mapping[6][7][2] = {
|
||||
{{2,4}, {2,5}, {1,6}, {0,6}, {0,5}, {1,4}, {1,5}},
|
||||
};
|
||||
|
||||
void wyoscan_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) {
|
||||
(void) settings;
|
||||
void wyoscan_face_setup(uint8_t watch_face_index, void ** context_ptr) {
|
||||
(void) watch_face_index;
|
||||
if (*context_ptr == NULL) {
|
||||
*context_ptr = malloc(sizeof(wyoscan_state_t));
|
||||
@@ -101,14 +100,13 @@ void wyoscan_face_setup(movement_settings_t *settings, uint8_t watch_face_index,
|
||||
// Do any pin or peripheral setup here; this will be called whenever the watch wakes from deep sleep.
|
||||
}
|
||||
|
||||
void wyoscan_face_activate(movement_settings_t *settings, void *context) {
|
||||
(void) settings;
|
||||
void wyoscan_face_activate(void *context) {
|
||||
wyoscan_state_t *state = (wyoscan_state_t *)context;
|
||||
movement_request_tick_frequency(32);
|
||||
state->total_frames = 64;
|
||||
}
|
||||
|
||||
bool wyoscan_face_loop(movement_event_t event, movement_settings_t *settings, void *context) {
|
||||
bool wyoscan_face_loop(movement_event_t event, void *context) {
|
||||
wyoscan_state_t *state = (wyoscan_state_t *)context;
|
||||
|
||||
watch_date_time date_time;
|
||||
@@ -195,14 +193,13 @@ bool wyoscan_face_loop(movement_event_t event, movement_settings_t *settings, vo
|
||||
case EVENT_BACKGROUND_TASK:
|
||||
break;
|
||||
default:
|
||||
return movement_default_loop_handler(event, settings);
|
||||
return movement_default_loop_handler(event);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void wyoscan_face_resign(movement_settings_t *settings, void *context) {
|
||||
(void) settings;
|
||||
void wyoscan_face_resign(void *context) {
|
||||
(void) context;
|
||||
|
||||
// handle any cleanup before your watch face goes off-screen.
|
||||
|
||||
@@ -73,11 +73,11 @@ typedef struct {
|
||||
uint32_t illuminated_segments[MAX_ILLUMINATED_SEGMENTS][2];
|
||||
} wyoscan_state_t;
|
||||
|
||||
void wyoscan_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr);
|
||||
void wyoscan_face_activate(movement_settings_t *settings, void *context);
|
||||
bool wyoscan_face_loop(movement_event_t event, movement_settings_t *settings, void *context);
|
||||
void wyoscan_face_resign(movement_settings_t *settings, void *context);
|
||||
bool wyoscan_face_wants_background_task(movement_settings_t *settings, void *context);
|
||||
void wyoscan_face_setup(uint8_t watch_face_index, void ** context_ptr);
|
||||
void wyoscan_face_activate(void *context);
|
||||
bool wyoscan_face_loop(movement_event_t event, void *context);
|
||||
void wyoscan_face_resign(void *context);
|
||||
bool wyoscan_face_wants_background_task(void *context);
|
||||
|
||||
#define wyoscan_face ((const watch_face_t){ \
|
||||
wyoscan_face_setup, \
|
||||
|
||||
Reference in New Issue
Block a user