refactor(behaviors): global-quick-tap -> require-prior-idle

Renaming global-quick-tap-ms to require-prior-idle.
This commit is contained in:
Andrew Rae
2023-09-24 09:38:45 -04:00
committed by Pete Johanson
parent 49c393e8f8
commit b85ffa4b6c
39 changed files with 41 additions and 41 deletions

View File

@@ -22,7 +22,7 @@ properties:
type: int
global-quick-tap: # deprecated
type: boolean
global-quick-tap-ms:
require-prior-idle-ms:
type: int
default: -1
flavor:

View File

@@ -18,7 +18,7 @@ child-binding:
timeout-ms:
type: int
default: 50
global-quick-tap-ms:
require-prior-idle-ms:
type: int
default: -1
slow-release:

View File

@@ -57,7 +57,7 @@ struct behavior_hold_tap_config {
char *hold_behavior_dev;
char *tap_behavior_dev;
int quick_tap_ms;
int global_quick_tap_ms;
int require_prior_idle_ms;
enum flavor flavor;
bool retro_tap;
bool hold_trigger_on_release;
@@ -114,7 +114,7 @@ static void store_last_hold_tapped(struct active_hold_tap *hold_tap) {
}
static bool is_quick_tap(struct active_hold_tap *hold_tap) {
if ((last_tapped.timestamp + hold_tap->config->global_quick_tap_ms) > hold_tap->timestamp) {
if ((last_tapped.timestamp + hold_tap->config->require_prior_idle_ms) > hold_tap->timestamp) {
return true;
} else {
return (last_tapped.position == hold_tap->position) &&
@@ -706,9 +706,9 @@ static int behavior_hold_tap_init(const struct device *dev) {
.hold_behavior_dev = DT_PROP(DT_INST_PHANDLE_BY_IDX(n, bindings, 0), label), \
.tap_behavior_dev = DT_PROP(DT_INST_PHANDLE_BY_IDX(n, bindings, 1), label), \
.quick_tap_ms = DT_INST_PROP(n, quick_tap_ms), \
.global_quick_tap_ms = DT_INST_PROP(n, global_quick_tap) \
? DT_INST_PROP(n, quick_tap_ms) \
: DT_INST_PROP(n, global_quick_tap_ms), \
.require_prior_idle_ms = DT_INST_PROP(n, global_quick_tap) \
? DT_INST_PROP(n, quick_tap_ms) \
: DT_INST_PROP(n, require_prior_idle_ms), \
.flavor = DT_ENUM_IDX(DT_DRV_INST(n), flavor), \
.retro_tap = DT_INST_PROP(n, retro_tap), \
.hold_trigger_on_release = DT_INST_PROP(n, hold_trigger_on_release), \

View File

@@ -31,7 +31,7 @@ struct combo_cfg {
int32_t key_position_len;
struct zmk_behavior_binding behavior;
int32_t timeout_ms;
int32_t global_quick_tap_ms;
int32_t require_prior_idle_ms;
// if slow release is set, the combo releases when the last key is released.
// otherwise, the combo releases when the first key is released.
bool slow_release;
@@ -136,7 +136,7 @@ static bool combo_active_on_layer(struct combo_cfg *combo, uint8_t layer) {
}
static bool is_quick_tap(struct combo_cfg *combo, int64_t timestamp) {
return (last_tapped_timestamp + combo->global_quick_tap_ms) > timestamp;
return (last_tapped_timestamp + combo->require_prior_idle_ms) > timestamp;
}
static int setup_candidates_for_first_keypress(int32_t position, int64_t timestamp) {
@@ -523,7 +523,7 @@ ZMK_SUBSCRIPTION(combo, zmk_keycode_state_changed);
#define COMBO_INST(n) \
static struct combo_cfg combo_config_##n = { \
.timeout_ms = DT_PROP(n, timeout_ms), \
.global_quick_tap_ms = DT_PROP(n, global_quick_tap_ms), \
.require_prior_idle_ms = DT_PROP(n, require_prior_idle_ms), \
.key_positions = DT_PROP(n, key_positions), \
.key_position_len = DT_PROP_LEN(n, key_positions), \
.behavior = ZMK_KEYMAP_EXTRACT_BINDING(0, n), \

View File

@@ -9,7 +9,7 @@
timeout-ms = <50>;
key-positions = <0 1>;
bindings = <&kp X>;
global-quick-tap-ms = <100>;
require-prior-idle-ms = <100>;
};
combo_two {

View File

@@ -11,7 +11,7 @@
flavor = "balanced";
tapping-term-ms = <300>;
quick-tap-ms = <300>;
global-quick-tap-ms = <100>;
require-prior-idle-ms = <100>;
bindings = <&kp>, <&kp>;
};
};

View File

@@ -11,7 +11,7 @@
flavor = "hold-preferred";
tapping-term-ms = <300>;
quick-tap-ms = <300>;
global-quick-tap-ms = <100>;
require-prior-idle-ms = <100>;
bindings = <&kp>, <&kp>;
};
};

View File

@@ -11,7 +11,7 @@
flavor = "tap-preferred";
tapping-term-ms = <300>;
quick-tap-ms = <300>;
global-quick-tap-ms = <100>;
require-prior-idle-ms = <100>;
bindings = <&kp>, <&kp>;
};
};

View File

@@ -11,7 +11,7 @@
flavor = "tap-unless-interrupted";
tapping-term-ms = <300>;
quick-tap-ms = <300>;
global-quick-tap-ms = <100>;
require-prior-idle-ms = <100>;
bindings = <&kp>, <&kp>;
};
};