From 8f040252fd6bfd5c95437a52a07634a19c487086 Mon Sep 17 00:00:00 2001 From: Matheus Afonso Martins Moreira Date: Sat, 24 Feb 2024 18:19:12 -0300 Subject: [PATCH] faces: rename simple_clock_face to clock_face It's not actually so simple and will only gain features from now on. Just "clock face" also feels more canonical. --- movement/make/Makefile | 2 +- movement/movement_config.h | 2 +- movement/movement_faces.h | 2 +- .../{simple_clock_face.c => clock_face.c} | 24 ++++++------- .../{simple_clock_face.h => clock_face.h} | 35 ++++++++++--------- 5 files changed, 33 insertions(+), 32 deletions(-) rename movement/watch_faces/clock/{simple_clock_face.c => clock_face.c} (88%) rename movement/watch_faces/clock/{simple_clock_face.h => clock_face.h} (63%) diff --git a/movement/make/Makefile b/movement/make/Makefile index 42dfc644..8573c585 100644 --- a/movement/make/Makefile +++ b/movement/make/Makefile @@ -49,7 +49,7 @@ SRCS += \ ../../littlefs/lfs_util.c \ ../movement.c \ ../filesystem.c \ - ../watch_faces/clock/simple_clock_face.c \ + ../watch_faces/clock/clock_face.c \ ../watch_faces/clock/world_clock_face.c \ ../watch_faces/clock/beats_face.c \ ../watch_faces/clock/weeknumber_clock_face.c \ diff --git a/movement/movement_config.h b/movement/movement_config.h index 067ca44b..d235e4a1 100644 --- a/movement/movement_config.h +++ b/movement/movement_config.h @@ -28,7 +28,7 @@ #include "movement_faces.h" const watch_face_t watch_faces[] = { - simple_clock_face, + clock_face, world_clock_face, sunrise_sunset_face, moon_phase_face, diff --git a/movement/movement_faces.h b/movement/movement_faces.h index 7feb0f40..949a071a 100644 --- a/movement/movement_faces.h +++ b/movement/movement_faces.h @@ -25,7 +25,7 @@ #ifndef MOVEMENT_FACES_H_ #define MOVEMENT_FACES_H_ -#include "simple_clock_face.h" +#include "clock_face.h" #include "world_clock_face.h" #include "preferences_face.h" #include "set_time_face.h" diff --git a/movement/watch_faces/clock/simple_clock_face.c b/movement/watch_faces/clock/clock_face.c similarity index 88% rename from movement/watch_faces/clock/simple_clock_face.c rename to movement/watch_faces/clock/clock_face.c index fbc2c4b3..a18bc3a1 100644 --- a/movement/watch_faces/clock/simple_clock_face.c +++ b/movement/watch_faces/clock/clock_face.c @@ -23,31 +23,31 @@ */ #include -#include "simple_clock_face.h" +#include "clock_face.h" #include "watch.h" #include "watch_utility.h" #include "watch_private_display.h" -static void _update_alarm_indicator(bool settings_alarm_enabled, simple_clock_state_t *state) { +static void _update_alarm_indicator(bool settings_alarm_enabled, 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 clock_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr) { (void) settings; (void) watch_face_index; if (*context_ptr == NULL) { - *context_ptr = malloc(sizeof(simple_clock_state_t)); - simple_clock_state_t *state = (simple_clock_state_t *)*context_ptr; + *context_ptr = malloc(sizeof(clock_state_t)); + clock_state_t *state = (clock_state_t *) *context_ptr; state->signal_enabled = false; state->watch_face_index = watch_face_index; } } -void simple_clock_face_activate(movement_settings_t *settings, void *context) { - simple_clock_state_t *state = (simple_clock_state_t *)context; +void clock_face_activate(movement_settings_t *settings, void *context) { + clock_state_t *state = (clock_state_t *) context; if (watch_tick_animation_is_running()) watch_stop_tick_animation(); @@ -66,8 +66,8 @@ void simple_clock_face_activate(movement_settings_t *settings, void *context) { state->previous_date_time = 0xFFFFFFFF; } -bool simple_clock_face_loop(movement_event_t event, movement_settings_t *settings, void *context) { - simple_clock_state_t *state = (simple_clock_state_t *)context; +bool clock_face_loop(movement_event_t event, movement_settings_t *settings, void *context) { + clock_state_t *state = (clock_state_t *) context; char buf[11]; uint8_t pos; @@ -145,14 +145,14 @@ bool simple_clock_face_loop(movement_event_t event, movement_settings_t *setting return true; } -void simple_clock_face_resign(movement_settings_t *settings, void *context) { +void clock_face_resign(movement_settings_t *settings, void *context) { (void) settings; (void) context; } -bool simple_clock_face_wants_background_task(movement_settings_t *settings, void *context) { +bool clock_face_wants_background_task(movement_settings_t *settings, void *context) { (void) settings; - simple_clock_state_t *state = (simple_clock_state_t *)context; + clock_state_t *state = (clock_state_t *) context; if (!state->signal_enabled) return false; watch_date_time date_time = watch_rtc_get_date_time(); diff --git a/movement/watch_faces/clock/simple_clock_face.h b/movement/watch_faces/clock/clock_face.h similarity index 63% rename from movement/watch_faces/clock/simple_clock_face.h rename to movement/watch_faces/clock/clock_face.h index e74a6e86..d2aa5ecb 100644 --- a/movement/watch_faces/clock/simple_clock_face.h +++ b/movement/watch_faces/clock/clock_face.h @@ -22,16 +22,17 @@ * SOFTWARE. */ -#ifndef SIMPLE_CLOCK_FACE_H_ -#define SIMPLE_CLOCK_FACE_H_ +#ifndef CLOCK_FACE_H_ +#define CLOCK_FACE_H_ /* - * SIMPLE CLOCK FACE + * CLOCK FACE * - * Displays the current time, matching the original operation of the watch. + * Displays the current local time, just like the original watch. * This is the default display mode in most watch configurations. * * Long-press ALARM to toggle the hourly chime. + * */ #include "movement.h" @@ -43,20 +44,20 @@ typedef struct { bool signal_enabled; bool battery_low; bool alarm_enabled; -} simple_clock_state_t; +} clock_state_t; -void simple_clock_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr); -void simple_clock_face_activate(movement_settings_t *settings, void *context); -bool simple_clock_face_loop(movement_event_t event, movement_settings_t *settings, void *context); -void simple_clock_face_resign(movement_settings_t *settings, void *context); -bool simple_clock_face_wants_background_task(movement_settings_t *settings, void *context); +void clock_face_setup(movement_settings_t *settings, uint8_t watch_face_index, void ** context_ptr); +void clock_face_activate(movement_settings_t *settings, void *context); +bool clock_face_loop(movement_event_t event, movement_settings_t *settings, void *context); +void clock_face_resign(movement_settings_t *settings, void *context); +bool clock_face_wants_background_task(movement_settings_t *settings, void *context); -#define simple_clock_face ((const watch_face_t){ \ - simple_clock_face_setup, \ - simple_clock_face_activate, \ - simple_clock_face_loop, \ - simple_clock_face_resign, \ - simple_clock_face_wants_background_task, \ +#define clock_face ((const watch_face_t) { \ + clock_face_setup, \ + clock_face_activate, \ + clock_face_loop, \ + clock_face_resign, \ + clock_face_wants_background_task, \ }) -#endif // SIMPLE_CLOCK_FACE_H_ +#endif // CLOCK_FACE_H_