From 26f63dcaebb375dd7fb756cc482d321da529d92f Mon Sep 17 00:00:00 2001 From: Wesley Aptekar-Cassels Date: Thu, 9 Nov 2023 17:33:43 -0500 Subject: day_night_percentage_face: Use PM indicator instead of DA/NI. This allows for use of the weekday digits for displaying the weekday. --- movement/watch_faces/clock/day_night_percentage_face.c | 17 +++++++++++------ movement/watch_faces/clock/day_night_percentage_face.h | 10 +++++----- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/movement/watch_faces/clock/day_night_percentage_face.c b/movement/watch_faces/clock/day_night_percentage_face.c index eaeeeb91..02062064 100644 --- a/movement/watch_faces/clock/day_night_percentage_face.c +++ b/movement/watch_faces/clock/day_night_percentage_face.c @@ -92,8 +92,14 @@ bool day_night_percentage_face_loop(movement_event_t event, movement_settings_t break; } + const char* weekday = watch_utility_get_weekday(date_time); if (state->result != 0) { - sprintf(buf, "%s%2dEtrnal", state->result == 1 ? "DA" : "NI", date_time.unit.day); + if (state->result == 1) { + watch_clear_indicator(WATCH_INDICATOR_PM); + } else { + watch_set_indicator(WATCH_INDICATOR_PM); + } + sprintf(buf, "%s%2dEtrnal", weekday, date_time.unit.day); watch_display_string(buf, 0); } else { double day_hours_decimal = utc_now.unit.hour + (utc_now.unit.minute + (utc_now.unit.second / 60.0)) / 60.0; @@ -102,19 +108,18 @@ bool day_night_percentage_face_loop(movement_event_t event, movement_settings_t double night_percentage = (24.0 - better_fmod(state->set - day_hours_decimal, 24.0)) / (24 - state->daylen); uint16_t percentage; - char day_night[3]; if (day_percentage > 0.0 && day_percentage < 1.0) { percentage = day_percentage * 10000; - sprintf(day_night, "%s", "DA"); + watch_clear_indicator(WATCH_INDICATOR_PM); } else { percentage = night_percentage * 10000; - sprintf(day_night, "%s", "NI"); + watch_set_indicator(WATCH_INDICATOR_PM); } if (event.event_type == EVENT_LOW_ENERGY_UPDATE) { if (!watch_tick_animation_is_running()) watch_start_tick_animation(500); - sprintf(buf, "%s%2d %02d", day_night, date_time.unit.day, percentage / 100); + sprintf(buf, "%s%2d %02d", weekday, date_time.unit.day, percentage / 100); } else { - sprintf(buf, "%s%2d %04d", day_night, date_time.unit.day, percentage); + sprintf(buf, "%s%2d %04d", weekday, date_time.unit.day, percentage); } watch_display_string(buf, 0); } diff --git a/movement/watch_faces/clock/day_night_percentage_face.h b/movement/watch_faces/clock/day_night_percentage_face.h index c5865329..d172c748 100644 --- a/movement/watch_faces/clock/day_night_percentage_face.h +++ b/movement/watch_faces/clock/day_night_percentage_face.h @@ -32,11 +32,11 @@ * * Shows the percentage of the way through the day/night the current time is. * - * The weekday digits show "DA" or "NI" depending on whether it's currently day - * or night. The day digits show what the current day of the month is. The time - * digits show the percentage of the way through the day/night it is, with - * decimals in the smaller seconds digits. If the day or night will last for a - * full 24 hours, the text "Etrnal" is displayed instead of a percentage. + * The time digits show the percentage of the way through the day/night it is, + * with decimals in the smaller seconds digits. If the day or night will last + * for a full 24 hours, the text "Etrnal" is displayed instead of a percentage. + * The "PM" indicator is set when it is currently nighttime. The weekday and + * day digits display the weekday and day, as one would expect. * * This face does not currently offer any configuration. You must set the * location register with some other face. -- cgit v1.2.3