diff options
author | Peter Johanson <[email protected]> | 2024-03-16 14:15:52 -0700 |
---|---|---|
committer | Pete Johanson <[email protected]> | 2024-03-27 20:59:26 -0700 |
commit | 2df6dcd973776c0c0d1047d13178a72b5c0b6ca7 (patch) | |
tree | 8f43b3c1f69dda2f19ad94287d33ada2cbf9c989 | |
parent | fa9ea9ea8b171a86765b5b08bed31922e9b2af76 (diff) | |
download | zmk-2df6dcd973776c0c0d1047d13178a72b5c0b6ca7.tar.gz zmk-2df6dcd973776c0c0d1047d13178a72b5c0b6ca7.zip |
feat(behaviors): More logging in soft off.
-rw-r--r-- | app/src/behaviors/behavior_soft_off.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/app/src/behaviors/behavior_soft_off.c b/app/src/behaviors/behavior_soft_off.c index 878a2fc586..8b8ba4f9ad 100644 --- a/app/src/behaviors/behavior_soft_off.c +++ b/app/src/behaviors/behavior_soft_off.c @@ -45,8 +45,18 @@ static int on_keymap_binding_released(struct zmk_behavior_binding *binding, struct behavior_soft_off_data *data = dev->data; 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(); + } 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; |