Only update the hemisphere if the load didn't fail

This commit is contained in:
David Volovskiy
2026-06-06 16:23:21 -04:00
parent 191b0c4ab2
commit 1fc366b073
+5 -4
View File
@@ -42,10 +42,11 @@
static const float phase_changes[] = {0, 1, 6.38264692644, 8.38264692644, 13.76529385288, 15.76529385288, 21.14794077932, 23.14794077932, 28.53058770576, 29.53058770576}; static const float phase_changes[] = {0, 1, 6.38264692644, 8.38264692644, 13.76529385288, 15.76529385288, 21.14794077932, 23.14794077932, 28.53058770576, 29.53058770576};
static bool is_southern_hemisphere(void) { static bool is_southern_hemisphere(moon_phase_state_t *state) {
movement_location_t location = {0}; movement_location_t location = {0};
filesystem_read_file("location.u32", (char *) &location.reg, sizeof(movement_location_t)); if (filesystem_read_file("location.u32", (char *) &location.reg, sizeof(movement_location_t))) {
return location.bit.latitude < 0; state->southern_hemisphere = location.bit.latitude < 0;
}
} }
void moon_phase_face_setup(uint8_t watch_face_index, void ** context_ptr) { void moon_phase_face_setup(uint8_t watch_face_index, void ** context_ptr) {
@@ -208,7 +209,7 @@ bool moon_phase_face_loop(movement_event_t event, void *context) {
switch (event.event_type) { switch (event.event_type) {
case EVENT_ACTIVATE: case EVENT_ACTIVATE:
if (watch_sleep_animation_is_running()) watch_stop_sleep_animation(); if (watch_sleep_animation_is_running()) watch_stop_sleep_animation();
state->southern_hemisphere = is_southern_hemisphere(); is_southern_hemisphere(state);
_update(state); _update(state);
break; break;
case EVENT_TICK: case EVENT_TICK: