From e0010f676022db4d31dfafec6c29572eaae0a29c Mon Sep 17 00:00:00 2001 From: Joey Castillo Date: Wed, 21 May 2025 00:50:15 -0400 Subject: [PATCH] port nanosec and finetune to Second Movement --- movement_faces.h | 2 ++ watch-faces.mk | 2 ++ .../settings/finetune_face.c | 34 ++++++++++--------- .../settings/finetune_face.h | 0 .../settings/nanosec_face.c | 23 ++++++++----- .../settings/nanosec_face.h | 0 6 files changed, 37 insertions(+), 24 deletions(-) rename {legacy/watch_faces => watch-faces}/settings/finetune_face.c (87%) rename {legacy/watch_faces => watch-faces}/settings/finetune_face.h (100%) rename {legacy/watch_faces => watch-faces}/settings/nanosec_face.c (92%) rename {legacy/watch_faces => watch-faces}/settings/nanosec_face.h (100%) diff --git a/movement_faces.h b/movement_faces.h index 3a6e65eb..246f4945 100644 --- a/movement_faces.h +++ b/movement_faces.h @@ -48,4 +48,6 @@ #include "light_sensor_face.h" #include "irda_upload_face.h" #include "chirpy_demo_face.h" +#include "finetune_face.h" +#include "nanosec_face.h" // New includes go above this line. diff --git a/watch-faces.mk b/watch-faces.mk index 981076af..20c881be 100644 --- a/watch-faces.mk +++ b/watch-faces.mk @@ -21,6 +21,8 @@ SRCS += \ ./watch-faces/settings/set_time_face.c \ ./watch-faces/settings/preferences_face.c \ ./watch-faces/settings/settings_face.c \ + ./watch-faces/settings/finetune_face.c \ + ./watch-faces/settings/nanosec_face.c \ ./watch-faces/io/chirpy_demo_face.c \ ./watch-faces/io/irda_upload_face.c \ # New watch faces go above this line. diff --git a/legacy/watch_faces/settings/finetune_face.c b/watch-faces/settings/finetune_face.c similarity index 87% rename from legacy/watch_faces/settings/finetune_face.c rename to watch-faces/settings/finetune_face.c index e1b64a9c..7567f9fc 100644 --- a/legacy/watch_faces/settings/finetune_face.c +++ b/watch-faces/settings/finetune_face.c @@ -28,6 +28,7 @@ #include "finetune_face.h" #include "nanosec_face.h" #include "watch_utility.h" +#include "delay.h" extern nanosec_state_t nanosec_state; @@ -44,7 +45,7 @@ void finetune_face_activate(void *context) { (void) context; // Handle any tasks related to your watch face coming on screen. - watch_display_string("FT", 0); + watch_display_text(WATCH_POSITION_TOP_LEFT, "FT"); total_adjustment = 0; finetune_page = 0; } @@ -62,32 +63,33 @@ static void finetune_update_display(void) { char buf[25]; if (finetune_page == 0) { - watch_display_string("FT", 0); + watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "FTU", "FT"); watch_date_time_t date_time = watch_rtc_get_date_time(); - sprintf(buf, "%02d", date_time.unit.second); - watch_display_string(buf, 8); - - sprintf(buf, "%04d", abs(total_adjustment)); - watch_display_string(buf, 4); + sprintf(buf, "%04d%02d", abs(total_adjustment), date_time.unit.second); + watch_display_text(WATCH_POSITION_BOTTOM, buf); if (total_adjustment < 0) { - watch_display_string("--", 2); + watch_display_text(WATCH_POSITION_TOP_RIGHT, "--"); } else { - watch_display_string(" ", 2); + watch_display_text(WATCH_POSITION_TOP_RIGHT, " "); } } else if (finetune_page == 1) { float hours = finetune_get_hours_passed(); - - sprintf(buf, "DT %4d%02d", (int)hours, (int)(fmodf(hours, 1.) * 100)); - watch_display_string(buf, 0); + watch_display_text(WATCH_POSITION_TOP_RIGHT, " "); + watch_display_text_with_fallback(WATCH_POSITION_TOP, "DELtA", "DT"); + sprintf(buf, "%4d%02d", (int)hours, (int)(fmodf(hours, 1.) * 100)); + watch_display_text(WATCH_POSITION_BOTTOM, buf); } else if (finetune_page == 2) { + watch_display_text(WATCH_POSITION_TOP_RIGHT, " "); + watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "Frq", " F"); if (finetune_get_hours_passed() < 6) { - sprintf(buf, " F 6HR "); - watch_display_string(buf, 0); + watch_display_text(WATCH_POSITION_BOTTOM, "6HR "); } else { float correction = finetune_get_correction(); - sprintf(buf, " F%s%2d%04d", (total_adjustment < 0) ? " -" : " ", (int)fabsf(correction), (int)(remainderf(fabsf(correction), 1.) * 10000)); - watch_display_string(buf, 0); + watch_display_text(WATCH_POSITION_TOP_RIGHT, (total_adjustment < 0) ? " -" : " "); + + sprintf(buf, "%2d%04d", (int)fabsf(correction), (int)(remainderf(fabsf(correction), 1.) * 10000)); + watch_display_text(WATCH_POSITION_BOTTOM, buf); } } } diff --git a/legacy/watch_faces/settings/finetune_face.h b/watch-faces/settings/finetune_face.h similarity index 100% rename from legacy/watch_faces/settings/finetune_face.h rename to watch-faces/settings/finetune_face.h diff --git a/legacy/watch_faces/settings/nanosec_face.c b/watch-faces/settings/nanosec_face.c similarity index 92% rename from legacy/watch_faces/settings/nanosec_face.c rename to watch-faces/settings/nanosec_face.c index 8efdacca..25653800 100644 --- a/legacy/watch_faces/settings/nanosec_face.c +++ b/watch-faces/settings/nanosec_face.c @@ -178,28 +178,35 @@ static void nanosec_update_display() { switch (nanosec_screen) { case 0: - sprintf(buf, "FC %6d", nanosec_state.freq_correction); + watch_display_text_with_fallback(WATCH_POSITION_TOP, "FCorr", "FC"); + sprintf(buf, "%6d", nanosec_state.freq_correction); break; case 1: - sprintf(buf, "T0 %6d", nanosec_state.center_temperature); + watch_display_text_with_fallback(WATCH_POSITION_TOP, "CTMP ", "T0"); + sprintf(buf, "%6d", nanosec_state.center_temperature); break; case 2: - sprintf(buf, "2C %6d", nanosec_state.quadratic_tempco); + watch_display_text_with_fallback(WATCH_POSITION_TOP, "2Coef", "2C"); + sprintf(buf, "%6d", nanosec_state.quadratic_tempco); break; case 3: - sprintf(buf, "3C %6d", nanosec_state.cubic_tempco); + watch_display_text_with_fallback(WATCH_POSITION_TOP, "3Coef", "3C"); + sprintf(buf, "%6d", nanosec_state.cubic_tempco); break; case 4: // Profile - sprintf(buf, "PR P%1d", nanosec_state.correction_profile); + watch_display_text_with_fallback(WATCH_POSITION_TOP, "PROFL", "PR"); + sprintf(buf, " P%1d", nanosec_state.correction_profile); break; case 5: // Cadence - sprintf(buf, "CD %2d", nanosec_state.correction_cadence); + watch_display_text_with_fallback(WATCH_POSITION_TOP, "Cadnc", "CD"); + sprintf(buf, " %2d", nanosec_state.correction_cadence); break; case 6: // Aging - sprintf(buf, "AA %6d", nanosec_state.aging_ppm_pa); + watch_display_text_with_fallback(WATCH_POSITION_TOP, "AgeCo", "CD"); + sprintf(buf, "%6d", nanosec_state.aging_ppm_pa); break; } - watch_display_string(buf, 0); + watch_display_text(WATCH_POSITION_BOTTOM, buf); } static void value_increase(int16_t delta) { diff --git a/legacy/watch_faces/settings/nanosec_face.h b/watch-faces/settings/nanosec_face.h similarity index 100% rename from legacy/watch_faces/settings/nanosec_face.h rename to watch-faces/settings/nanosec_face.h