From 4e710066b9de1de07fe21d563bbe164020d110db Mon Sep 17 00:00:00 2001 From: voloved <36523934+voloved@users.noreply.github.com> Date: Sun, 6 Jul 2025 15:33:56 -0400 Subject: [PATCH] Tally face port (#38) * Moved tally face over * Bugfix on tally_face_should_move_back * changed watch_display_text logic * Negative numbers don't appear small * remove tally face from movement_config.h --- movement_faces.h | 1 + watch-faces.mk | 1 + .../complication/tally_face.c | 15 ++++++--------- .../complication/tally_face.h | 0 4 files changed, 8 insertions(+), 9 deletions(-) rename {legacy/watch_faces => watch-faces}/complication/tally_face.c (95%) rename {legacy/watch_faces => watch-faces}/complication/tally_face.h (100%) diff --git a/movement_faces.h b/movement_faces.h index 4cac85ec..f5c087bc 100644 --- a/movement_faces.h +++ b/movement_faces.h @@ -59,5 +59,6 @@ #include "periodic_table_face.h" #include "squash_face.h" #include "totp_face.h" +#include "tally_face.h" #include "probability_face.h" // New includes go above this line. diff --git a/watch-faces.mk b/watch-faces.mk index 1bc3f84f..665ec4b7 100644 --- a/watch-faces.mk +++ b/watch-faces.mk @@ -15,6 +15,7 @@ SRCS += \ ./watch-faces/complication/breathing_face.c \ ./watch-faces/complication/squash_face.c \ ./watch-faces/complication/totp_face.c \ + ./watch-faces/complication/tally_face.c \ ./watch-faces/demo/all_segments_face.c \ ./watch-faces/demo/character_set_face.c \ ./watch-faces/demo/light_sensor_face.c \ diff --git a/legacy/watch_faces/complication/tally_face.c b/watch-faces/complication/tally_face.c similarity index 95% rename from legacy/watch_faces/complication/tally_face.c rename to watch-faces/complication/tally_face.c index 128e84a6..c2d202e6 100644 --- a/legacy/watch_faces/complication/tally_face.c +++ b/watch-faces/complication/tally_face.c @@ -1,7 +1,7 @@ /* * MIT License * - * Copyright (c) 2022 Andrew Mike + * Copyright (c) 2022-2025 Andrew Mike and David Volovskiy * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -28,7 +28,7 @@ #include "watch.h" #define TALLY_FACE_MAX 9999 -#define TALLY_FACE_MIN -99 +#define TALLY_FACE_MIN -999 static bool _init_val; static bool _quick_ticks_running; @@ -104,7 +104,6 @@ static void tally_face_decrement(tally_state_t *state, bool sound_on) { } static bool tally_face_should_move_back(tally_state_t *state) { - if (TALLY_FACE_PRESETS_SIZE() <= 1) { return false; } return state->tally_idx == _tally_default[state->tally_default_idx]; } @@ -195,16 +194,14 @@ bool tally_face_loop(movement_event_t event, void *context) { // print tally index at the center of display. void print_tally(tally_state_t *state, bool sound_on) { - char buf[14]; + char buf[6]; if (sound_on) watch_set_indicator(WATCH_INDICATOR_BELL); else watch_clear_indicator(WATCH_INDICATOR_BELL); - if (state->tally_idx >= 0) - sprintf(buf, "TA %4d ", (int)(state->tally_idx)); // center of LCD display - else - sprintf(buf, "TA %-3d", (int)(state->tally_idx)); // center of LCD display - watch_display_string(buf, 0); + watch_display_text_with_fallback(WATCH_POSITION_TOP, "TALLY", "TA"); + sprintf(buf, "%4d", (int)(state->tally_idx)); + watch_display_text(WATCH_POSITION_BOTTOM, buf); } void tally_face_resign(void *context) { diff --git a/legacy/watch_faces/complication/tally_face.h b/watch-faces/complication/tally_face.h similarity index 100% rename from legacy/watch_faces/complication/tally_face.h rename to watch-faces/complication/tally_face.h