moon phase display improvements
This commit is contained in:
@@ -55,7 +55,7 @@ void moon_phase_face_activate(void *context) {
|
|||||||
|
|
||||||
static void _update(moon_phase_state_t *state, uint32_t offset) {
|
static void _update(moon_phase_state_t *state, uint32_t offset) {
|
||||||
(void)state;
|
(void)state;
|
||||||
char buf[11];
|
char buf[4];
|
||||||
watch_date_time_t date_time = watch_rtc_get_date_time();
|
watch_date_time_t date_time = watch_rtc_get_date_time();
|
||||||
uint32_t now = watch_utility_date_time_to_unix_time(date_time, movement_get_current_timezone_offset()) + offset;
|
uint32_t now = watch_utility_date_time_to_unix_time(date_time, movement_get_current_timezone_offset()) + offset;
|
||||||
date_time = watch_utility_date_time_from_unix_time(now, movement_get_current_timezone_offset());
|
date_time = watch_utility_date_time_from_unix_time(now, movement_get_current_timezone_offset());
|
||||||
@@ -67,14 +67,13 @@ static void _update(moon_phase_state_t *state, uint32_t offset) {
|
|||||||
if (currentday > phase_changes[phase_index] && currentday <= phase_changes[phase_index + 1]) break;
|
if (currentday > phase_changes[phase_index] && currentday <= phase_changes[phase_index + 1]) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
watch_clear_display();
|
|
||||||
|
|
||||||
sprintf(buf, "%2d", date_time.unit.day);
|
sprintf(buf, "%2d", date_time.unit.day);
|
||||||
watch_display_text(WATCH_POSITION_TOP_RIGHT, buf);
|
watch_display_text(WATCH_POSITION_TOP_RIGHT, buf);
|
||||||
switch (phase_index) {
|
switch (phase_index) {
|
||||||
case 0:
|
case 0:
|
||||||
case 8:
|
case 8:
|
||||||
watch_display_text_with_fallback(WATCH_POSITION_BOTTOM, "NE!J ", " Neu ");
|
watch_display_text_with_fallback(WATCH_POSITION_BOTTOM, "NE!J ", " Neu ");
|
||||||
|
watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, " ", " ");
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
watch_display_text(WATCH_POSITION_BOTTOM, "CresNt");
|
watch_display_text(WATCH_POSITION_BOTTOM, "CresNt");
|
||||||
@@ -150,7 +149,6 @@ static void _update(moon_phase_state_t *state, uint32_t offset) {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
watch_display_string(buf, 2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool moon_phase_face_loop(movement_event_t event, void *context) {
|
bool moon_phase_face_loop(movement_event_t event, void *context) {
|
||||||
@@ -172,8 +170,10 @@ bool moon_phase_face_loop(movement_event_t event, void *context) {
|
|||||||
if (state->offset || (watch_rtc_get_date_time().unit.minute == 0)) _update(state, 0);
|
if (state->offset || (watch_rtc_get_date_time().unit.minute == 0)) _update(state, 0);
|
||||||
// and kill the offset so when the wearer wakes up, it matches what's on screen.
|
// and kill the offset so when the wearer wakes up, it matches what's on screen.
|
||||||
state->offset = 0;
|
state->offset = 0;
|
||||||
// finally: clear out the last two digits and replace them with the sleep mode indicator
|
if (watch_get_lcd_type() == WATCH_LCD_TYPE_CLASSIC) {
|
||||||
watch_display_string(" ", 8);
|
// clear out the last two digits and replace them with the sleep mode indicator
|
||||||
|
watch_display_text(WATCH_POSITION_SECONDS, " ");
|
||||||
|
}
|
||||||
if (!watch_sleep_animation_is_running()) watch_start_sleep_animation(1000);
|
if (!watch_sleep_animation_is_running()) watch_start_sleep_animation(1000);
|
||||||
break;
|
break;
|
||||||
case EVENT_ALARM_BUTTON_UP:
|
case EVENT_ALARM_BUTTON_UP:
|
||||||
|
|||||||
Reference in New Issue
Block a user