Skip to content

Commit

Permalink
fix: Fix up layer metadata, move to layer IDs.
Browse files Browse the repository at this point in the history
* Studio will use stable layer IDs to refer to layers, so that
  layer reordering doesn't affect behavior bindings, so update to match.
* Fix a few layer metadata entries that missed being refactored.
  • Loading branch information
petejohanson committed Jul 5, 2024
1 parent e01f13f commit 782b4cf
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/include/drivers/behavior.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct behavior_parameter_value_metadata {
BEHAVIOR_PARAMETER_VALUE_TYPE_VALUE = 1,
BEHAVIOR_PARAMETER_VALUE_TYPE_RANGE = 2,
BEHAVIOR_PARAMETER_VALUE_TYPE_HID_USAGE = 3,
BEHAVIOR_PARAMETER_VALUE_TYPE_LAYER_INDEX = 4,
BEHAVIOR_PARAMETER_VALUE_TYPE_LAYER_ID = 4,
} type;
};

Expand Down
2 changes: 1 addition & 1 deletion app/src/behavior.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static int check_param_matches_value(const struct behavior_parameter_value_metad
}

break;
case BEHAVIOR_PARAMETER_VALUE_TYPE_LAYER_INDEX:
case BEHAVIOR_PARAMETER_VALUE_TYPE_LAYER_ID:
if (param >= 0 && param < ZMK_KEYMAP_LEN) {
return PARAM_MATCHES;
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/behaviors/behavior_momentary_layer.c
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);
static const struct behavior_parameter_value_metadata param_values[] = {
{
.display_name = "Layer",
.type = BEHAVIOR_PARAMETER_VALUE_TYPE_LAYER_INDEX,
.type = BEHAVIOR_PARAMETER_VALUE_TYPE_LAYER_ID,
},
};

Expand Down
3 changes: 1 addition & 2 deletions app/src/behaviors/behavior_to_layer.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,7 @@ static int to_keymap_binding_released(struct zmk_behavior_binding *binding,
static const struct behavior_parameter_value_metadata param_values[] = {
{
.display_name = "Layer",
.type = BEHAVIOR_PARAMETER_VALUE_TYPE_STANDARD,
.standard = BEHAVIOR_PARAMETER_STANDARD_DOMAIN_LAYER_INDEX,
.type = BEHAVIOR_PARAMETER_VALUE_TYPE_LAYER_ID,
},
};

Expand Down
3 changes: 1 addition & 2 deletions app/src/behaviors/behavior_toggle_layer.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ static int tog_keymap_binding_released(struct zmk_behavior_binding *binding,
static const struct behavior_parameter_value_metadata param_values[] = {
{
.display_name = "Layer",
.type = BEHAVIOR_PARAMETER_VALUE_TYPE_STANDARD,
.standard = BEHAVIOR_PARAMETER_STANDARD_DOMAIN_LAYER_INDEX,
.type = BEHAVIOR_PARAMETER_VALUE_TYPE_LAYER_ID,
},
};

Expand Down

0 comments on commit 782b4cf

Please sign in to comment.