summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWesley Aptekar-Cassels <me@wesleyac.com>2023-11-09 17:33:43 -0500
committerWesley Aptekar-Cassels <me@wesleyac.com>2023-11-09 17:35:58 -0500
commit26f63dcaebb375dd7fb756cc482d321da529d92f (patch)
tree046868320027aad96007dd386e273290348d48b1
parent2e8ee9965e843f9fc571681d7f3911fd68f36c7b (diff)
downloadSensor-Watch-26f63dcaebb375dd7fb756cc482d321da529d92f.tar.gz
Sensor-Watch-26f63dcaebb375dd7fb756cc482d321da529d92f.tar.bz2
Sensor-Watch-26f63dcaebb375dd7fb756cc482d321da529d92f.zip
day_night_percentage_face: Use PM indicator instead of DA/NI.
This allows for use of the weekday digits for displaying the weekday.
-rw-r--r--movement/watch_faces/clock/day_night_percentage_face.c17
-rw-r--r--movement/watch_faces/clock/day_night_percentage_face.h10
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.