]> git.earman.xyz Git - sensor-watch.git/commitdiff
light sensor: improvements for custom LCD
authorJoey Castillo <joeycastillo@utexas.edu>
Sun, 18 May 2025 03:18:10 +0000 (23:18 -0400)
committerJoey Castillo <joeycastillo@utexas.edu>
Sun, 18 May 2025 03:18:10 +0000 (23:18 -0400)
watch-faces/sensor/light_sensor_face.c

index a3f0223ac53a048c9ddc0c7991880618893e6245..8357b3793b73b18cf5f3eac7fda0ea5a5d3f873c 100644 (file)
@@ -61,21 +61,18 @@ bool light_sensor_face_loop(movement_event_t event, void *context) {
         case EVENT_ACTIVATE:
         case EVENT_TICK:
         {
-            char buf[14];
+            char buf[7];
             uint16_t light_level = adc_get_analog_value(HAL_GPIO_IRSENSE_pin());
-            snprintf(buf, 14, "LL  %-6d", light_level);
-            watch_display_text(WATCH_POSITION_FULL, buf);
-            printf("%s\n", buf);
+            snprintf(buf, 7, "%-6d", light_level);
+            watch_display_text_with_fallback(WATCH_POSITION_TOP, "LIGHT", "LL");
+            watch_display_text(WATCH_POSITION_BOTTOM, buf);
         }
             break;
         case EVENT_LIGHT_BUTTON_UP:
-            break;
-        case EVENT_ALARM_BUTTON_UP:
+            // suppress LED, as it would interfere with light sensing
             break;
         case EVENT_TIMEOUT:
-            break;
-        case EVENT_LOW_ENERGY_UPDATE:
-            watch_display_text(WATCH_POSITION_TOP_RIGHT, " <");
+            movement_move_to_face(0);
             break;
         default:
             return movement_default_loop_handler(event);