]> git.earman.xyz Git - sensor-watch.git/commitdiff
improve time zone selection, show offset on odd ticks
authorjoeycastillo <joeycastillo@utexas.edu>
Sun, 29 Sep 2024 15:00:03 +0000 (11:00 -0400)
committerjoeycastillo <joeycastillo@utexas.edu>
Sun, 29 Sep 2024 15:00:03 +0000 (11:00 -0400)
utz
watch-faces/settings/set_time_face.c

diff --git a/utz b/utz
index 1969e6167e1c0d19872e1c5a1d7a88e259651d07..8c9447e1bc0eb8946800d5d7fa30b1383df324b0 160000 (submodule)
--- a/utz
+++ b/utz
@@ -1 +1 @@
-Subproject commit 1969e6167e1c0d19872e1c5a1d7a88e259651d07
+Subproject commit 8c9447e1bc0eb8946800d5d7fa30b1383df324b0
index ff7f46ba8cb6154f0c2c2b05a9ece7e2bd438180..70450e524dff18f21df4cff0f68141fb8e97d3b0 100644 (file)
@@ -33,6 +33,7 @@
 const char set_time_face_titles[SET_TIME_FACE_NUM_SETTINGS][3] = {"HR", "M1", "SE", "YR", "MO", "DA", "  "};
 
 static bool _quick_ticks_running;
+static int32_t current_offset;
 
 static void _handle_alarm_button(watch_date_time date_time, uint8_t current_page) {
     // handles short or long pressing of the alarm button
@@ -60,6 +61,7 @@ static void _handle_alarm_button(watch_date_time date_time, uint8_t current_page
         case 6: // time zone
             movement_set_timezone_index(movement_get_timezone_index() + 1);
             if (movement_get_timezone_index() >= NUM_ZONE_NAMES) movement_set_timezone_index(0);
+            current_offset = movement_get_current_timezone_offset_for_zone(movement_get_timezone_index());
             break;
     }
     if (date_time.unit.day > days_in_month(date_time.unit.month, date_time.unit.year + WATCH_RTC_REFERENCE_YEAR))
@@ -83,6 +85,7 @@ void set_time_face_activate(void *context) {
     *((uint8_t *)context) = 0;
     movement_request_tick_frequency(4);
     _quick_ticks_running = false;
+    current_offset = movement_get_current_timezone_offset();
 }
 
 bool set_time_face_loop(movement_event_t event, void *context) {
@@ -145,11 +148,17 @@ bool set_time_face_loop(movement_event_t event, void *context) {
         sprintf(buf, "%2d%02d%02d", date_time.unit.year + 20, date_time.unit.month, date_time.unit.day);
     } else {
         watch_display_text(WATCH_POSITION_TOP_RIGHT, " Z");
+        if (current_offset < 0) watch_display_text(WATCH_POSITION_TOP_LEFT, "- ");
+        else watch_display_text(WATCH_POSITION_TOP_LEFT, "* ");
         if (event.subsecond % 2) {
-            memset(buf, ' ', sizeof(buf));
+            uint8_t hours = abs(current_offset) / 3600;
+            uint8_t minutes = (abs(current_offset) % 3600) / 60;
+
+            sprintf(buf, "%2d%02d  ", hours % 100, minutes % 100);
+            watch_set_colon();
         } else {
-            watch_display_text(WATCH_POSITION_TOP_LEFT, (char *) (zone_names + 11 * movement_get_timezone_index()));
             sprintf(buf, "%s", (char *) (3 + zone_names + 11 * movement_get_timezone_index()));
+            watch_clear_colon();
         }
     }