-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(behaviors): Add reusable sensor behaviors. #1758
feat(behaviors): Add reusable sensor behaviors. #1758
Conversation
a3712d6
to
77370f3
Compare
ret = behavior_sensor_keymap_binding_triggered(binding, sensor, position, timestamp); | ||
struct zmk_behavior_binding_event event = { | ||
.position = ZMK_VIRTUAL_KEY_POSITION_SENSOR(sensor_number), .timestamp = timestamp}; | ||
ret = behavior_sensor_keymap_binding_triggered(binding, sensor, event); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@joelspadin Thoughts on if we should pass behaviors the actual sensor position, then let them generate the virtual key position if they need to queue behaviors?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned on Discord, my main concern with that is that it would be very easy to just pass the sensor position along when queueing behaviors, which could cause very subtle bugs.
|
||
struct behavior_sensor_rotate_var_config { | ||
char *cw_behavior_dev; | ||
char *ccw_behavior_dev; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might be able to share a lot of code between this and the other version if you use the previous file's config struct for both version, but just initialize the params to 0 in this version. Then inside the "binding triggered" function, everything before and after the switch
block could be identical.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, so moved the whole callback to a "common" code, and added an bool override_params
field to the config struct to determine if the parameters get updated or not.
77370f3
to
ac96787
Compare
* Add new sensor behaviors that either take full bindings add definition, or accept parameters when bound in the keymap. * Remove existing hard-coded key press sensor behavior and instead leverage new generic sensor behaviors to achieve the same functionality. Co-authored-by: [email protected]
ac96787
to
23f8cd6
Compare
I've taken the amazing work from @nickconway in #1275 and done the following:
main
with Zephyr 3.2 fixes.Still on my list is the docs updates I'd noted, but this should be nearly there, and is ready for review.