From 0603319d285ee44312f555b2c14c19d6804fddb9 Mon Sep 17 00:00:00 2001 From: Joey Castillo Date: Sat, 15 Mar 2025 18:41:07 -0400 Subject: [PATCH] move stopwatch face into Second Movement --- movement_config.h | 1 + movement_faces.h | 1 + watch-faces.mk | 1 + .../complication/stopwatch_face.c | 19 +++++++++++-------- .../complication/stopwatch_face.h | 0 5 files changed, 14 insertions(+), 8 deletions(-) rename {legacy/watch_faces => watch-faces}/complication/stopwatch_face.c (90%) rename {legacy/watch_faces => watch-faces}/complication/stopwatch_face.h (100%) diff --git a/movement_config.h b/movement_config.h index fd01eac5..cd972ab9 100644 --- a/movement_config.h +++ b/movement_config.h @@ -31,6 +31,7 @@ const watch_face_t watch_faces[] = { clock_face, world_clock_face, sunrise_sunset_face, + stopwatch_face, countdown_face, beats_face, voltage_face, diff --git a/movement_faces.h b/movement_faces.h index cda7e147..35e4f00d 100644 --- a/movement_faces.h +++ b/movement_faces.h @@ -29,6 +29,7 @@ #include "world_clock_face.h" #include "advanced_alarm_face.h" #include "countdown_face.h" +#include "stopwatch_face.h" #include "fast_stopwatch_face.h" #include "sunrise_sunset_face.h" #include "character_set_face.h" diff --git a/watch-faces.mk b/watch-faces.mk index 1813a18b..5be1c78c 100644 --- a/watch-faces.mk +++ b/watch-faces.mk @@ -4,6 +4,7 @@ SRCS += \ ./watch-faces/clock/world_clock_face.c \ ./watch-faces/complication/advanced_alarm_face.c \ ./watch-faces/complication/countdown_face.c \ + ./watch-faces/complication/stopwatch_face.c \ ./watch-faces/complication/fast_stopwatch_face.c \ ./watch-faces/complication/sunrise_sunset_face.c \ ./watch-faces/demo/accel_interrupt_count_face.c \ diff --git a/legacy/watch_faces/complication/stopwatch_face.c b/watch-faces/complication/stopwatch_face.c similarity index 90% rename from legacy/watch_faces/complication/stopwatch_face.c rename to watch-faces/complication/stopwatch_face.c index c2ef8997..83293efd 100644 --- a/legacy/watch_faces/complication/stopwatch_face.c +++ b/watch-faces/complication/stopwatch_face.c @@ -55,24 +55,25 @@ static void _stopwatch_face_update_display(stopwatch_state_t *stopwatch_state, b // display maxes out just shy of 40 days, thanks to the limit on the day digits (0-39) stopwatch_state->running = false; movement_cancel_background_task(); - watch_display_string("st39235959", 0); + watch_display_text(WATCH_POSITION_TOP_RIGHT, "39"); + watch_display_text(WATCH_POSITION_BOTTOM, "235959"); return; } watch_duration_t duration = watch_utility_seconds_to_duration(stopwatch_state->seconds_counted); char buf[14]; - sprintf(buf, "st %02d%02d ", duration.hours, duration.minutes); - watch_display_string(buf, 0); + sprintf(buf, "%02d%02d ", duration.hours, duration.minutes); + watch_display_text(WATCH_POSITION_BOTTOM, buf); if (duration.days != 0) { sprintf(buf, "%2d", (uint8_t)duration.days); - watch_display_string(buf, 2); + watch_display_text(WATCH_POSITION_TOP_RIGHT, buf); } if (show_seconds) { sprintf(buf, "%02d", duration.seconds); - watch_display_string(buf, 8); + watch_display_text(WATCH_POSITION_SECONDS, buf); } } @@ -97,10 +98,12 @@ bool stopwatch_face_loop(movement_event_t event, void *context) { switch (event.event_type) { case EVENT_ACTIVATE: watch_set_colon(); + watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "STW", "ST"); // fall through case EVENT_TICK: if (stopwatch_state->start_time.reg == 0) { - watch_display_string("st 000000", 0); + watch_display_text(WATCH_POSITION_TOP_RIGHT, " "); + watch_display_text(WATCH_POSITION_BOTTOM, "000000"); } else { _stopwatch_face_update_display(stopwatch_state, true); } @@ -110,7 +113,7 @@ bool stopwatch_face_loop(movement_event_t event, void *context) { if (!stopwatch_state->running) { stopwatch_state->start_time.reg = 0; stopwatch_state->seconds_counted = 0; - watch_display_string("st 000000", 0); + watch_display_text(WATCH_POSITION_BOTTOM, "000000"); } break; case EVENT_ALARM_BUTTON_DOWN: @@ -148,7 +151,7 @@ bool stopwatch_face_loop(movement_event_t event, void *context) { // since the tick animation is running, displaying the stopped time could be misleading, // as it could imply that the stopwatch is running. instead, show a blank display to // indicate that we are in sleep mode. - watch_display_string("st ---- ", 0); + watch_display_text(WATCH_POSITION_BOTTOM, "---- "); } else { // this OTOH shouldn't happen anymore; if we're running, we shouldn't enter low energy mode _stopwatch_face_update_display(stopwatch_state, false); diff --git a/legacy/watch_faces/complication/stopwatch_face.h b/watch-faces/complication/stopwatch_face.h similarity index 100% rename from legacy/watch_faces/complication/stopwatch_face.h rename to watch-faces/complication/stopwatch_face.h