Matter Switch: Handle InitialPress during BILRESA scrolling#2789
Matter Switch: Handle InitialPress during BILRESA scrolling#2789hcarter-775 merged 1 commit intomainfrom
Conversation
|
Channel deleted. |
Test Results 72 files 486 suites 0s ⏱️ Results for commit 8ebd6e4. ♻️ This comment has been updated with latest results. |
|
Minimum allowed coverage is Generated by 🐒 cobertura-action against 8ebd6e4 |
| local num_presses_to_handle = 1 - (device:get_field(scroll_fields.LATEST_NUMBER_OF_PRESSES_COUNTED) or 0) | ||
| if num_presses_to_handle > 0 then | ||
| device:set_field(scroll_fields.LATEST_NUMBER_OF_PRESSES_COUNTED, 1) | ||
| rotate_amount_event_helper(device, ib.endpoint_id, 1) | ||
| end |
There was a problem hiding this comment.
I think this is a little easier to understand. What do you think?
| local num_presses_to_handle = 1 - (device:get_field(scroll_fields.LATEST_NUMBER_OF_PRESSES_COUNTED) or 0) | |
| if num_presses_to_handle > 0 then | |
| device:set_field(scroll_fields.LATEST_NUMBER_OF_PRESSES_COUNTED, 1) | |
| rotate_amount_event_helper(device, ib.endpoint_id, 1) | |
| end | |
| local latest_presses_counted = device:get_field(scroll_fields.LATEST_NUMBER_OF_PRESSES_COUNTED) or 0 | |
| if latest_presses_counted == 0 then | |
| device:set_field(scroll_fields.LATEST_NUMBER_OF_PRESSES_COUNTED, 1) | |
| rotate_amount_event_helper(device, ib.endpoint_id, 1) | |
| end |
There was a problem hiding this comment.
works for me. I was trying to keep the same structure as the other 2 handlers but maybe that's more confusing than it is helpful
There was a problem hiding this comment.
I brought it up because when num_presses_to_handle is > 0 that means it is 1, but then on lines 55 and 56 the value of 1 is being hardcoded instead of using num_presses_to_handle. Another option would be to replace those hardcoded 1's with num_presses_to_handle but I guess I thought this suggestion was a bit easier to read.
493d661 to
70cfe70
Compare
70cfe70 to
8ebd6e4
Compare
Description of Change
Update the Bilresa subdriver to support scroll-style events with the InitialPress.
Summary of Completed Tests
Tested on-device.