Merge PR #428 - fix issues in sunrise/sunset
Takes zero into account, allowing the sunrise/sunset watch face to work with no presets defined. Also resolves a warning during compilation of the sunrise/sunset face. Reviewed-by: Matheus Afonso Martins Moreira <matheus@matheusmoreira.com> GitHub-Pull-Request: https://github.com/joeycastillo/Sensor-Watch/pull/428
This commit is contained in:
commit
dea05663b0
@ -49,7 +49,7 @@ static void _sunrise_sunset_face_update(movement_settings_t *settings, sunrise_s
|
|||||||
double rise, set, minutes, seconds;
|
double rise, set, minutes, seconds;
|
||||||
bool show_next_match = false;
|
bool show_next_match = false;
|
||||||
movement_location_t movement_location;
|
movement_location_t movement_location;
|
||||||
if (state->longLatToUse == 0)
|
if (state->longLatToUse == 0 || _location_count <= 1)
|
||||||
movement_location = (movement_location_t) watch_get_backup_data(1);
|
movement_location = (movement_location_t) watch_get_backup_data(1);
|
||||||
else{
|
else{
|
||||||
movement_location.bit.latitude = longLatPresets[state->longLatToUse].latitude;
|
movement_location.bit.latitude = longLatPresets[state->longLatToUse].latitude;
|
||||||
@ -359,7 +359,7 @@ bool sunrise_sunset_face_loop(movement_event_t event, movement_settings_t *setti
|
|||||||
_sunrise_sunset_face_update_location_register(state);
|
_sunrise_sunset_face_update_location_register(state);
|
||||||
}
|
}
|
||||||
_sunrise_sunset_face_update_settings_display(event, context);
|
_sunrise_sunset_face_update_settings_display(event, context);
|
||||||
} else if (_location_count == 1) {
|
} else if (_location_count <= 1) {
|
||||||
movement_illuminate_led();
|
movement_illuminate_led();
|
||||||
}
|
}
|
||||||
if (state->page == 0) {
|
if (state->page == 0) {
|
||||||
@ -368,7 +368,7 @@ bool sunrise_sunset_face_loop(movement_event_t event, movement_settings_t *setti
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EVENT_LIGHT_LONG_PRESS:
|
case EVENT_LIGHT_LONG_PRESS:
|
||||||
if (_location_count == 1) break;
|
if (_location_count <= 1) break;
|
||||||
else if (!state->page) movement_illuminate_led();
|
else if (!state->page) movement_illuminate_led();
|
||||||
break;
|
break;
|
||||||
case EVENT_LIGHT_BUTTON_UP:
|
case EVENT_LIGHT_BUTTON_UP:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user