-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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(beahviors): Allow encoders to use any behavior #1275
feat(beahviors): Allow encoders to use any behavior #1275
Conversation
Working with rgb behavior: IMG_3420.mov |
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.
Looking good so far! I'm currently unable to get this feature working on my local hardware, but in the meantime I have a few comments.
Edit: Can confirm that the updated sensor-rotate behavior works with |
I too get the same warning during the build process though Its still working. Here my config: https://github.com/eXsoR65/bdn9_zmk_config |
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.
Did another pass through this PR to make some more minor suggestions. Thanks for the updates based on the first review!
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.
Thanks for working on this! A few minor comments, and one higher level change we might want to roll into this.
733da73
to
cb7da72
Compare
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.
Comment on the behavior queue usage, naming tweaks.
I don't love the code duplication between the parameterized version and not, but the amount duplicated is so minimal, I'd say it's fine.
c4cbbaf
to
e7fd119
Compare
We could the duplicated code to another file that gets included in each behavior? |
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.
One more thought...
zmk_behavior_queue_add(0, triggered_binding, true, cfg->tap_ms); | ||
zmk_behavior_queue_add(0, triggered_binding, false, 0); |
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.
Instead of simulating this at the zeroth key position, perhaps better to simulate it at "max key position + sensor position" so there are actually unique? May be necessary for some code that tracks state tied to key position (or might actually break them.... hmmm...)
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.
This got fixed in the non-var version, but not this one.
848a15e
to
507fdcf
Compare
Excited to see this as it will make the defeault layer shifting stuff i'vebeen working on much neater. Iimplemented a rudimentary sensor behaviour but universall sensor beaviours are even better |
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.
Couple minor things. Want to give this a test before merging though.
Thanks for the work on this!
@nickconway can you please rebase to pull in the docs build fixes? |
1d2f4a8
to
22818e6
Compare
@petejohanson done. |
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.
A few minor fixes needed.
Also, we probably need to remove app/dts/bindings/behaviors/zmk,behavior-sensor-rotate-key-press.yaml
in this PR as well as the driver code itself.
### Configuration | ||
|
||
An example implementation of an encoder that changes RGB brightness is shown below: | ||
|
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.
We need an example for the -var and non-var variants here.
zmk_behavior_queue_add(0, triggered_binding, true, cfg->tap_ms); | ||
zmk_behavior_queue_add(0, triggered_binding, false, 0); |
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.
This got fixed in the non-var version, but not this one.
|
||
LOG_DBG("Sensor binding: %s", log_strdup(binding->behavior_dev)); | ||
|
||
zmk_behavior_queue_add(ZMK_KEYMAP_LEN + event.position, *triggered_binding, true, cfg->tap_ms); |
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.
I think this will overlap with combo positions?
Merged in the updated PR #1758 |
This PR adds the sensor-rotate behavior, which will allow for encoders to use any behavior in addition to basic keypresses.
In the documentation I have assumed this will deprecate the existing &inc_dec_kp behavior.
This has not been tested extensively but is confirmed to be working with RGB behaviors.