]> git.earman.xyz Git - sensor-watch.git/commitdiff
day_night_percentage_face: Use PM indicator instead of DA/NI.
authorWesley Aptekar-Cassels <me@wesleyac.com>
Thu, 9 Nov 2023 22:33:43 +0000 (17:33 -0500)
committerWesley Aptekar-Cassels <me@wesleyac.com>
Thu, 9 Nov 2023 22:35:58 +0000 (17:35 -0500)
This allows for use of the weekday digits for displaying the weekday.

movement/watch_faces/clock/day_night_percentage_face.c
movement/watch_faces/clock/day_night_percentage_face.h

index eaeeeb9162964a75e3348b1dddc1678ef412e0fd..02062064a6b71da8fbdd0e8e832738d6fb4e5139 100644 (file)
@@ -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);
             }
index c5865329c7e10d014bd8658fb35a53337564aeb3..d172c748588352575cdf7b29ad5c832a4493f028 100644 (file)
  *
  * 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.