This commit is contained in:
hueso
2025-05-16 18:41:17 -03:00
parent 48399312be
commit 13863d32ca
3 changed files with 151 additions and 151 deletions

View File

@@ -52,7 +52,7 @@ static void _moonrise_face_update(movement_settings_t *settings, moonrise_state_
if (movement_location.reg == 0) {
watch_clear_colon();
watch_display_string("MR no Loc", 0);
watch_display_string("Mz no Loc", 0);
return;
}
@@ -60,15 +60,10 @@ static void _moonrise_face_update(movement_settings_t *settings, moonrise_state_
watch_date_time scratch_time; // scratchpad, contains different values at different times
scratch_time.reg = date_time.reg;
// Weird quirky unsigned things were happening when I tried to cast these directly to doubles below.
// it looks redundant, but extracting them to local int16's seemed to fix it.
int16_t lat_centi = (int16_t)movement_location.bit.latitude;
int16_t lon_centi = (int16_t)movement_location.bit.longitude;
double lat = (double)movement_location.bit.latitude / 100.0;
double lon = (double)movement_location.bit.longitude / 100.0;
double lat = (double)lat_centi / 100.0;
double lon = (double)lon_centi / 100.0;
time_t t = watch_utility_date_time_to_unix_time(scratch_time, movement_timezone_offsets[settings->bit.time_zone] * 60);
uint32_t t = watch_utility_date_time_to_unix_time(date_time, movement_timezone_offsets[settings->bit.time_zone] * 60);
MoonRise mr = MoonRise_calculate(lat, lon, t);
if(mr.isVisible)
@@ -76,11 +71,12 @@ static void _moonrise_face_update(movement_settings_t *settings, moonrise_state_
else
watch_clear_indicator(WATCH_INDICATOR_LAP);
if (!mr.hasRise && !mr.hasSet) {
if ( (state->rise_index == 0 && !mr.hasRise) ||
(state->rise_index == 1 && !mr.hasSet) ) {
watch_clear_colon();
watch_clear_indicator(WATCH_INDICATOR_PM);
watch_clear_indicator(WATCH_INDICATOR_24H);
snprintf(buf, sizeof(buf), "MR%2d none ", scratch_time.unit.day);
snprintf(buf, sizeof(buf), "%s%2d none ", state->rise_index ? "M_" : "M~", scratch_time.unit.day);
watch_display_string(buf, 0);
return;
}
@@ -95,7 +91,6 @@ static void _moonrise_face_update(movement_settings_t *settings, moonrise_state_
state->rise_set_expires.reg = scratch_time.reg;
bool set_leading_zero = false;
if (!settings->bit.clock_mode_24h)
if (watch_utility_convert_to_12_hour(&scratch_time))
@@ -105,12 +100,9 @@ static void _moonrise_face_update(movement_settings_t *settings, moonrise_state_
else if (settings->bit.clock_24h_leading_zero && scratch_time.unit.hour < 10) {
set_leading_zero = true;
}
snprintf(buf, sizeof(buf), "M %2d%2d%02d%2s", scratch_time.unit.day, scratch_time.unit.hour, scratch_time.unit.minute,longLatPresets[state->longLatToUse].name);
snprintf(buf, sizeof(buf), "%s%2d%2d%02d%2s", state->rise_index ? "M_" : "M~", scratch_time.unit.day, scratch_time.unit.hour, scratch_time.unit.minute,longLatPresets[state->longLatToUse].name);
watch_display_string(buf, 0);
if(state->rise_index == 0)
watch_set_pixel(0,11);
else
watch_set_pixel(2,11);
if (set_leading_zero)
watch_display_string("0", 4);
return;