case 0:
return;
case 1:
+ // Latitude
watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "LAT", "LA");
if (watch_get_lcd_type() == WATCH_LCD_TYPE_CUSTOM) {
watch_set_decimal_if_available();
}
break;
case 2:
+ // Longitude
watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "LON", "LO");
if (watch_get_lcd_type() == WATCH_LCD_TYPE_CUSTOM) {
watch_set_decimal_if_available();
// Handle leading 1 for longitudes >99
- if (state->working_longitude.tens > 9) watch_set_pixel(0, 22);
- watch_display_character('0' + state->working_longitude.tens % 10, 4);
+ if (state->working_longitude.hundreds == 1) watch_set_pixel(0, 22);
+ watch_display_character('0' + state->working_longitude.tens, 4);
watch_display_character('0' + state->working_longitude.ones, 5);
watch_display_character('0' + state->working_longitude.tenths, 6);
watch_display_character('0' + state->working_longitude.hundredths, 7);
case 2: // longitude
switch (state->active_digit) {
case 0:
- state->working_longitude.tens = (state->working_longitude.tens + 1) % 18;
+ // Increase tens and handle carry-over to hundreds
+ state->working_longitude.tens++;
+ if (state->working_longitude.tens >= 10) {
+ state->working_longitude.tens = 0;
+ state->working_longitude.hundreds++;
+ }
+
+ // Reset if we've gone over ±180
if (abs(_sunrise_sunset_face_latlon_from_struct(state->working_longitude)) > 18000) {
state->working_longitude.hundreds = 0;
state->working_longitude.tens = 0;