Compare commits
1 Commits
2dfe165f22
...
legacy_moo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b98a2a0870 |
@@ -43,6 +43,15 @@ static void _moonrise_face_update(movement_settings_t *settings, moonrise_state_
|
||||
char buf[11];
|
||||
movement_location_t movement_location;
|
||||
|
||||
watch_clear_colon();
|
||||
watch_clear_indicator(WATCH_INDICATOR_PM);
|
||||
watch_clear_indicator(WATCH_INDICATOR_24H);
|
||||
// watch_display_string("__ _ ", 0);
|
||||
if(state->rise_index == 0)
|
||||
watch_display_string("M~ rise", 0);
|
||||
else
|
||||
watch_display_string("M_ set ", 0);
|
||||
|
||||
if (state->longLatToUse == 0 || _location_count <= 1)
|
||||
movement_location = (movement_location_t) watch_get_backup_data(1);
|
||||
else{
|
||||
@@ -60,8 +69,13 @@ 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;
|
||||
|
||||
double lat = (double)movement_location.bit.latitude / 100.0;
|
||||
double lon = (double)movement_location.bit.longitude / 100.0;
|
||||
// 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)lat_centi / 100.0;
|
||||
double lon = (double)lon_centi / 100.0;
|
||||
|
||||
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);
|
||||
@@ -78,6 +92,9 @@ static void _moonrise_face_update(movement_settings_t *settings, moonrise_state_
|
||||
watch_clear_indicator(WATCH_INDICATOR_24H);
|
||||
snprintf(buf, sizeof(buf), "%s%2d none ", state->rise_index ? "M_" : "M~", scratch_time.unit.day);
|
||||
watch_display_string(buf, 0);
|
||||
state->rise_set_expires = watch_utility_date_time_from_unix_time(
|
||||
watch_utility_offset_timestamp(t, MR_WINDOW, 0, 0),
|
||||
movement_timezone_offsets[settings->bit.time_zone] * 60);
|
||||
return;
|
||||
}
|
||||
watch_set_colon();
|
||||
|
||||
@@ -45,7 +45,7 @@ static void _sunrise_sunset_set_expiration(sunrise_sunset_state_t *state, watch_
|
||||
}
|
||||
|
||||
static void _sunrise_sunset_face_update(movement_settings_t *settings, sunrise_sunset_state_t *state) {
|
||||
char buf[11];
|
||||
char buf[14];
|
||||
double rise, set, minutes, seconds;
|
||||
bool show_next_match = false;
|
||||
movement_location_t movement_location;
|
||||
@@ -87,7 +87,7 @@ static void _sunrise_sunset_face_update(movement_settings_t *settings, sunrise_s
|
||||
watch_clear_colon();
|
||||
watch_clear_indicator(WATCH_INDICATOR_PM);
|
||||
watch_clear_indicator(WATCH_INDICATOR_24H);
|
||||
snprintf(buf, sizeof(buf), "%s%2d none ", (result == 1) ? "SE" : "rI", scratch_time.unit.day);
|
||||
sprintf(buf, "%s%2d none ", (result == 1) ? "SE" : "rI", scratch_time.unit.day);
|
||||
watch_display_string(buf, 0);
|
||||
return;
|
||||
}
|
||||
@@ -120,7 +120,7 @@ static void _sunrise_sunset_face_update(movement_settings_t *settings, sunrise_s
|
||||
} else if (settings->bit.clock_24h_leading_zero && scratch_time.unit.hour < 10) {
|
||||
set_leading_zero = true;
|
||||
}
|
||||
snprintf(buf, sizeof(buf), "rI%2d%2d%02d%s", scratch_time.unit.day, scratch_time.unit.hour, scratch_time.unit.minute,longLatPresets[state->longLatToUse].name);
|
||||
sprintf(buf, "rI%2d%2d%02d%s", scratch_time.unit.day, scratch_time.unit.hour, scratch_time.unit.minute,longLatPresets[state->longLatToUse].name);
|
||||
watch_display_string(buf, 0);
|
||||
if (set_leading_zero)
|
||||
watch_display_string("0", 4);
|
||||
@@ -152,7 +152,7 @@ static void _sunrise_sunset_face_update(movement_settings_t *settings, sunrise_s
|
||||
} else if (settings->bit.clock_24h_leading_zero && scratch_time.unit.hour < 10) {
|
||||
set_leading_zero = true;
|
||||
}
|
||||
snprintf(buf, sizeof(buf), "SE%2d%2d%02d%s", scratch_time.unit.day, scratch_time.unit.hour, scratch_time.unit.minute, longLatPresets[state->longLatToUse].name);
|
||||
sprintf(buf, "SE%2d%2d%02d%s", scratch_time.unit.day, scratch_time.unit.hour, scratch_time.unit.minute, longLatPresets[state->longLatToUse].name);
|
||||
watch_display_string(buf, 0);
|
||||
if (set_leading_zero)
|
||||
watch_display_string("0", 4);
|
||||
@@ -212,16 +212,16 @@ static void _sunrise_sunset_face_update_location_register(sunrise_sunset_state_t
|
||||
}
|
||||
|
||||
static void _sunrise_sunset_face_update_settings_display(movement_event_t event, sunrise_sunset_state_t *state) {
|
||||
char buf[11];
|
||||
char buf[12];
|
||||
|
||||
switch (state->page) {
|
||||
case 0:
|
||||
return;
|
||||
case 1:
|
||||
snprintf(buf, sizeof(buf), "LA %c %04d", state->working_latitude.sign ? '-' : '+', abs(_sunrise_sunset_face_latlon_from_struct(state->working_latitude)));
|
||||
sprintf(buf, "LA %c %04d", state->working_latitude.sign ? '-' : '+', abs(_sunrise_sunset_face_latlon_from_struct(state->working_latitude)));
|
||||
break;
|
||||
case 2:
|
||||
snprintf(buf, sizeof(buf), "LO %c%05d", state->working_longitude.sign ? '-' : '+', abs(_sunrise_sunset_face_latlon_from_struct(state->working_longitude)));
|
||||
sprintf(buf, "LO %c%05d", state->working_longitude.sign ? '-' : '+', abs(_sunrise_sunset_face_latlon_from_struct(state->working_longitude)));
|
||||
break;
|
||||
}
|
||||
if (event.subsecond % 2) {
|
||||
|
||||
Reference in New Issue
Block a user