-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
refactor: Use Kconfig to conditionally compile behaviors #2106
base: main
Are you sure you want to change the base?
refactor: Use Kconfig to conditionally compile behaviors #2106
Conversation
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.
LGTM in general from a docs perspective. Note that if you remove the #define
as in the first comments the docs need to be updated for that too.
b3e50a9
to
01a8a9d
Compare
01a8a9d
to
347cd10
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.
A few high level comments on how this fits with splits.
app/Kconfig.behaviors
Outdated
config ZMK_BEHAVIOR_RESET | ||
bool | ||
default y | ||
depends on DT_HAS_ZMK_BEHAVIOR_RESET_ENABLED |
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.
So this one is a bit tricky... This is needs to be enables a bit more specifically for the right side of splits, even if it's not referenced in a keymap. There's a few of those, like the RBG behavior, that are either "local" or "global" so need this special handling.
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 makes sense. I've removed the Kconfig options for the behaviors we talked about in Discord and reverted them back to using the main Kconfig option where available. This means the reset behaviors are always compiled in for both sides.
app/Kconfig.behaviors
Outdated
default y | ||
depends on DT_HAS_ZMK_BEHAVIOR_RESET_ENABLED | ||
|
||
config ZMK_BEHAVIOR_RGB_UNDERGLOW |
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.
Ditto.
app/dts/behaviors/ext_power.dtsi
Outdated
@@ -7,7 +7,7 @@ | |||
/ { | |||
behaviors { | |||
// Behavior can be invoked on peripherals, so name must be <= 8 characters. | |||
ext_power: extpower { | |||
/omit-if-no-ref/ ext_power: extpower { |
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 was intentional, so probably needs an added comment, instead of adding the omit-if-no-ref
.
app/dts/behaviors/reset.dtsi
Outdated
@@ -9,13 +9,13 @@ | |||
/ { | |||
behaviors { | |||
// Behavior can be invoked on peripherals, so name must be <= 8 characters. | |||
sys_reset: sysreset { | |||
/omit-if-no-ref/ sys_reset: sysreset { |
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.
Ditto in this file.
Because global behaviors have to exist on both the central and split regardless if the user references them in their keymap, we can't omit the behavior declaration if the user doen't reference it and decide to compile it later based on the existence of the behavior declaration. The best option seems to be to decide whether to compile those behaviors based on the feature Kconfig flag. This also means that the two reset behaviors will always be compiled into both sides.
347cd10
to
72f8c50
Compare
This pull request updates the current behaviors to use
Kconfig.behaviors
andtarget_sources_ifdef()
withinapp/CMakeLists.txt
to conditionally compile behaviors based on the behaviors used in the user's keymap