]> git.earman.xyz Git - sensor-watch.git/commitdiff
disable REALLY_LONG_UP event for now
authorAlessandro Genova <ales.genova@gmail.com>
Wed, 26 Nov 2025 18:23:42 +0000 (13:23 -0500)
committerAlessandro Genova <ales.genova@gmail.com>
Sat, 3 Jan 2026 01:07:56 +0000 (20:07 -0500)
movement.c
movement.h

index bae267b388cae9d8bf1aea263574d3ccdd265d2c..f0fb96093fdf4c6018f8e9aee98a201f0f805ba4 100644 (file)
@@ -63,9 +63,9 @@ watch_date_time_t scheduled_tasks[MOVEMENT_NUM_FACES];
 const int32_t movement_le_inactivity_deadlines[8] = {INT_MAX, 600, 3600, 7200, 21600, 43200, 86400, 604800};
 const int16_t movement_timeout_inactivity_deadlines[4] = {60, 120, 300, 1800};
 
-const uint32_t _movement_mode_button_events_mask = 0b111111 << EVENT_MODE_BUTTON_DOWN;
-const uint32_t _movement_light_button_events_mask = 0b111111 << EVENT_LIGHT_BUTTON_DOWN;
-const uint32_t _movement_alarm_button_events_mask = 0b111111 << EVENT_ALARM_BUTTON_DOWN;
+const uint32_t _movement_mode_button_events_mask = 0b11111 << EVENT_MODE_BUTTON_DOWN;
+const uint32_t _movement_light_button_events_mask = 0b11111 << EVENT_LIGHT_BUTTON_DOWN;
+const uint32_t _movement_alarm_button_events_mask = 0b11111 << EVENT_ALARM_BUTTON_DOWN;
 const uint32_t _movement_button_events_mask = _movement_mode_button_events_mask | _movement_light_button_events_mask | _movement_alarm_button_events_mask;
 
 typedef struct {
@@ -340,8 +340,8 @@ static void _movement_handle_button_presses(uint32_t pending_events) {
         // If a button up or button long up occurred
         if (pending_events & (
             (1 << (button->down_event + 1)) |
-            (1 << (button->down_event + 3)) |
-            (1 << (button->down_event + 5))
+            (1 << (button->down_event + 3))
+            // (1 << (button->down_event + 5))
         )) {
             // We cancel the timeout if it hasn't fired yet
             watch_rtc_disable_comp_callback_no_schedule(button->timeout_index);
@@ -1408,7 +1408,8 @@ static movement_event_type_t _process_button_event(bool pin_level, movement_butt
         button->up_timestamp = counter;
 #endif
         if ((counter - button->down_timestamp) >= MOVEMENT_REALLY_LONG_PRESS_TICKS) {
-            event_type = button->down_event + 5;
+            // event_type = button->down_event + 5;
+            event_type = button->down_event + 3; // TODO: swith to REALLY_LONG_UP
         } else if ((counter - button->down_timestamp) >= MOVEMENT_LONG_PRESS_TICKS) {
             event_type = button->down_event + 3;
         } else {
@@ -1462,7 +1463,8 @@ static movement_event_type_t _process_button_longpress_timeout(bool pin_level, m
 #endif
         button->is_down = false;
         if (max_long_press) {
-            return button->down_event + 5; // event_really_long_up
+            // return button->down_event + 5; // event_really_long_up
+            return button->down_event + 3; // event_long_up TODO: use really_long_up
         } else if (really_long_press) {
             return button->down_event + 3; // event_long_up
         } else {
index 305a2e8cb1248a160d0a2d4ae39b7c29e002a0f9..1bbd9638837e445c10ee932109b3635eb328b690 100644 (file)
@@ -122,19 +122,19 @@ typedef enum {
     EVENT_LIGHT_LONG_PRESS,     // The light button was held for over half a second, but not yet released.
     EVENT_LIGHT_LONG_UP,        // The light button was held for over half a second, and released.
     EVENT_LIGHT_REALLY_LONG_PRESS, // The light button was held for more than 1.5 second, note yet released.
-    EVENT_LIGHT_REALLY_LONG_UP, // The light button was held for more than 1.5 second, and released.
+    // EVENT_LIGHT_REALLY_LONG_UP, // The light button was held for more than 1.5 second, and released.
     EVENT_MODE_BUTTON_DOWN,     // The mode button has been pressed, but not yet released.
     EVENT_MODE_BUTTON_UP,       // The mode button was pressed for less than half a second, and released.
     EVENT_MODE_LONG_PRESS,      // The mode button was held for over half a second, but not yet released.
     EVENT_MODE_LONG_UP,         // The mode button was held for over half a second, and released. NOTE: your watch face will resign immediately after receiving this event.
     EVENT_MODE_REALLY_LONG_PRESS, // The mode button was held for more than 1.5 second, note yet released.
-    EVENT_MODE_REALLY_LONG_UP, // The mode button was held for more than 1.5 second, and released.
+    // EVENT_MODE_REALLY_LONG_UP, // The mode button was held for more than 1.5 second, and released.
     EVENT_ALARM_BUTTON_DOWN,    // The alarm button has been pressed, but not yet released.
     EVENT_ALARM_BUTTON_UP,      // The alarm button was pressed for less than half a second, and released.
     EVENT_ALARM_LONG_PRESS,     // The alarm button was held for over half a second, but not yet released.
     EVENT_ALARM_LONG_UP,        // The alarm button was held for over half a second, and released.
     EVENT_ALARM_REALLY_LONG_PRESS, // The alarm button was held for more than 1.5 second, note yet released.
-    EVENT_ALARM_REALLY_LONG_UP, // The alarm button was held for more than 1.5 second, and released.
+    // EVENT_ALARM_REALLY_LONG_UP, // The alarm button was held for more than 1.5 second, and released.
 
     EVENT_ACCELEROMETER_WAKE,   // The accelerometer has detected motion and woken up.
     EVENT_SINGLE_TAP,           // Accelerometer detected a single tap. This event is not yet implemented.