mirror of
https://github.com/joeycastillo/second-movement.git
synced 2026-02-04 10:35:28 +00:00
disable REALLY_LONG_UP event for now
This commit is contained in:
16
movement.c
16
movement.c
@ -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 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 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_mode_button_events_mask = 0b11111 << EVENT_MODE_BUTTON_DOWN;
|
||||||
const uint32_t _movement_light_button_events_mask = 0b111111 << EVENT_LIGHT_BUTTON_DOWN;
|
const uint32_t _movement_light_button_events_mask = 0b11111 << EVENT_LIGHT_BUTTON_DOWN;
|
||||||
const uint32_t _movement_alarm_button_events_mask = 0b111111 << EVENT_ALARM_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;
|
const uint32_t _movement_button_events_mask = _movement_mode_button_events_mask | _movement_light_button_events_mask | _movement_alarm_button_events_mask;
|
||||||
|
|
||||||
typedef struct {
|
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 a button up or button long up occurred
|
||||||
if (pending_events & (
|
if (pending_events & (
|
||||||
(1 << (button->down_event + 1)) |
|
(1 << (button->down_event + 1)) |
|
||||||
(1 << (button->down_event + 3)) |
|
(1 << (button->down_event + 3))
|
||||||
(1 << (button->down_event + 5))
|
// (1 << (button->down_event + 5))
|
||||||
)) {
|
)) {
|
||||||
// We cancel the timeout if it hasn't fired yet
|
// We cancel the timeout if it hasn't fired yet
|
||||||
watch_rtc_disable_comp_callback_no_schedule(button->timeout_index);
|
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;
|
button->up_timestamp = counter;
|
||||||
#endif
|
#endif
|
||||||
if ((counter - button->down_timestamp) >= MOVEMENT_REALLY_LONG_PRESS_TICKS) {
|
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) {
|
} else if ((counter - button->down_timestamp) >= MOVEMENT_LONG_PRESS_TICKS) {
|
||||||
event_type = button->down_event + 3;
|
event_type = button->down_event + 3;
|
||||||
} else {
|
} else {
|
||||||
@ -1462,7 +1463,8 @@ static movement_event_type_t _process_button_longpress_timeout(bool pin_level, m
|
|||||||
#endif
|
#endif
|
||||||
button->is_down = false;
|
button->is_down = false;
|
||||||
if (max_long_press) {
|
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) {
|
} else if (really_long_press) {
|
||||||
return button->down_event + 3; // event_long_up
|
return button->down_event + 3; // event_long_up
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -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_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_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_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_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_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_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_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_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_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_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_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_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_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_ACCELEROMETER_WAKE, // The accelerometer has detected motion and woken up.
|
||||||
EVENT_SINGLE_TAP, // Accelerometer detected a single tap. This event is not yet implemented.
|
EVENT_SINGLE_TAP, // Accelerometer detected a single tap. This event is not yet implemented.
|
||||||
|
|||||||
Reference in New Issue
Block a user