refactor: watch faces no longer need a pointer to settings!

This commit is contained in:
joeycastillo
2024-09-29 09:59:49 -04:00
parent 3bd8f8d51f
commit e88359d1d5
201 changed files with 1180 additions and 1553 deletions

View File

@@ -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;
}