day_night_percentage_face: Use PM indicator instead of DA/NI.

This allows for use of the weekday digits for displaying the weekday.
This commit is contained in:
Wesley Aptekar-Cassels 2023-11-09 17:33:43 -05:00
parent 2e8ee9965e
commit 26f63dcaeb
2 changed files with 16 additions and 11 deletions

View 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);
}

View file

@ -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.