]> git.earman.xyz Git - sensor-watch.git/commitdiff
improve sunrise/sunset on custom LCD
authorJoey Castillo <joeycastillo@utexas.edu>
Sat, 8 Mar 2025 22:40:39 +0000 (17:40 -0500)
committerJoey Castillo <joeycastillo@utexas.edu>
Sat, 8 Mar 2025 22:40:39 +0000 (17:40 -0500)
watch-faces/complication/sunrise_sunset_face.c
watch-library/shared/watch/watch_common_display.c
watch-library/shared/watch/watch_common_display.h

index 1a657104754dfb266f8242eae3032c96486f67ff..88089c547d16a3db75c397b668997893c79ca545 100644 (file)
@@ -88,8 +88,11 @@ static void _sunrise_sunset_face_update(sunrise_sunset_state_t *state) {
             watch_clear_colon();
             watch_clear_indicator(WATCH_INDICATOR_PM);
             watch_clear_indicator(WATCH_INDICATOR_24H);
-            sprintf(buf, "%s%2d none ", (result == 1) ? "SE" : "rI", scratch_time.unit.day);
-            watch_display_text(WATCH_POSITION_FULL, buf);
+            if (result == 1) watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "SET", "SE");
+            else watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "RIS", "rI");
+            sprintf(buf, "%2d", scratch_time.unit.day);
+            watch_display_text(WATCH_POSITION_TOP_RIGHT, buf);
+            watch_display_text(WATCH_POSITION_BOTTOM, "None  ");
             return;
         }
 
@@ -118,8 +121,11 @@ static void _sunrise_sunset_face_update(sunrise_sunset_state_t *state) {
                     if (watch_utility_convert_to_12_hour(&scratch_time)) watch_set_indicator(WATCH_INDICATOR_PM);
                     else watch_clear_indicator(WATCH_INDICATOR_PM);
                 }
-                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_text(WATCH_POSITION_FULL, buf);
+                watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "RIS", "rI");
+                sprintf(buf, "%2d", scratch_time.unit.day);
+                watch_display_text(WATCH_POSITION_TOP_RIGHT, buf);
+                sprintf(buf, "%2d%02d%s", scratch_time.unit.hour, scratch_time.unit.minute,longLatPresets[state->longLatToUse].name);
+                watch_display_text(WATCH_POSITION_BOTTOM, buf);
                 return;
             } else {
                 show_next_match = true;
@@ -145,8 +151,11 @@ static void _sunrise_sunset_face_update(sunrise_sunset_state_t *state) {
                     if (watch_utility_convert_to_12_hour(&scratch_time)) watch_set_indicator(WATCH_INDICATOR_PM);
                     else watch_clear_indicator(WATCH_INDICATOR_PM);
                 }
-                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_text(WATCH_POSITION_FULL, buf);
+                watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "SET", "SE");
+                sprintf(buf, "%2d", scratch_time.unit.day);
+                watch_display_text(WATCH_POSITION_TOP_RIGHT, buf);
+                sprintf(buf, "%2d%02d%s", scratch_time.unit.hour, scratch_time.unit.minute,longLatPresets[state->longLatToUse].name);
+                watch_display_text(WATCH_POSITION_BOTTOM, buf);
                 return;
             } else {
                 show_next_match = true;
@@ -205,20 +214,24 @@ 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[12];
 
+    watch_clear_display();
+
     switch (state->page) {
         case 0:
             return;
         case 1:
-            sprintf(buf, "LA  %c %04d", state->working_latitude.sign ? '-' : '+', abs(_sunrise_sunset_face_latlon_from_struct(state->working_latitude)));
+            watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "LAT", "LA");
+            sprintf(buf, "%c %04d", state->working_latitude.sign ? '-' : '+', abs(_sunrise_sunset_face_latlon_from_struct(state->working_latitude)));
+            if (event.subsecond % 2) buf[state->active_digit] = ' ';
+            watch_display_text(WATCH_POSITION_BOTTOM, buf);
             break;
-        case 2:
-            sprintf(buf, "LO  %c%05d", state->working_longitude.sign ? '-' : '+', abs(_sunrise_sunset_face_latlon_from_struct(state->working_longitude)));
+            case 2:
+            watch_display_text_with_fallback(WATCH_POSITION_TOP_LEFT, "LON", "LO");
+            sprintf(buf, "%c%05d", state->working_longitude.sign ? '-' : '+', abs(_sunrise_sunset_face_latlon_from_struct(state->working_longitude)));
+            if (event.subsecond % 2) buf[state->active_digit] = ' ';
+            watch_display_text(WATCH_POSITION_BOTTOM, buf);
             break;
     }
-    if (event.subsecond % 2) {
-        buf[state->active_digit + 4] = ' ';
-    }
-    watch_display_text(WATCH_POSITION_FULL, buf);
 }
 
 static void _sunrise_sunset_face_advance_digit(sunrise_sunset_state_t *state) {
index f4133c45786ff30cec27d4a4d113c11704c82d99..5918d69b0a187eeb98dad0064d4369b18b7205b2 100644 (file)
@@ -33,7 +33,7 @@ uint32_t IndicatorSegments[7] = {0};
 
 void watch_display_character(uint8_t character, uint8_t position) {
     if (watch_get_lcd_type() == WATCH_LCD_TYPE_CUSTOM) {
-        if (character == 'R') character = 'r'; // We can't display uppercase R on this display.
+        if (character == 'R' && position > 1 && position < 8) character = 'r'; // We can't display uppercase R in these positions
         else if (character == 'T' && position > 1 && position < 8) character = 't'; // lowercase t is the only option for these positions
     } else {
         // special cases for positions 4 and 6
index f174115a5f8967a36c199a8ff751f199d069c837..2162b0b8c8f25ee8a57f90c7df9479f59e35aee1 100644 (file)
@@ -97,7 +97,7 @@ static const uint8_t Custom_LCD_Character_Set[] =
     0b00111111, // O
     0b01110011, // P
     0b01100111, // Q
-    0b01010000, // R (lowercase, this is the only capital we can't do)
+    0b11000111, // R
     0b01101101, // S
     0b10000001, // T (only works in position 0; set (1, 12) to make it work in position 1)
     0b00111110, // U