feat(behaviors): More logging in soft off.
This commit is contained in:
parent
fa9ea9ea8b
commit
2df6dcd973
1 changed files with 11 additions and 1 deletions
|
@ -45,8 +45,18 @@ static int on_keymap_binding_released(struct zmk_behavior_binding *binding,
|
||||||
struct behavior_soft_off_data *data = dev->data;
|
struct behavior_soft_off_data *data = dev->data;
|
||||||
const struct behavior_soft_off_config *config = dev->config;
|
const struct behavior_soft_off_config *config = dev->config;
|
||||||
|
|
||||||
if (config->hold_time_ms == 0 || (k_uptime_get() - data->press_start) >= config->hold_time_ms) {
|
if (config->hold_time_ms == 0) {
|
||||||
|
LOG_DBG("No hold time set, triggering soft off");
|
||||||
zmk_pm_soft_off();
|
zmk_pm_soft_off();
|
||||||
|
} else {
|
||||||
|
uint32_t hold_time = k_uptime_get() - data->press_start;
|
||||||
|
|
||||||
|
if (hold_time > config->hold_time_ms) {
|
||||||
|
zmk_pm_soft_off();
|
||||||
|
} else {
|
||||||
|
LOG_INF("Not triggering soft off: held for %d and hold time is %d", hold_time,
|
||||||
|
config->hold_time_ms);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ZMK_BEHAVIOR_OPAQUE;
|
return ZMK_BEHAVIOR_OPAQUE;
|
||||||
|
|
Loading…
Add table
Reference in a new issue