Skip to content
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

PS2 Mouse: Add possiblity to disable layer timeout #8

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/mouse/input_listener_ps2.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,10 @@ void zmk_input_listener_ps2_layer_toggle_input_rel_received(const struct input_l
if (data->layer_toggle_layer_enabled == false) {
k_work_schedule(&data->layer_toggle_activation_delay,
K_MSEC(config->layer_toggle_delay_ms));
} else if(config->layer_toggle_timeout_ms == 0) {
if(data->layer_toggle_layer_enabled == true && !zmk_keymap_layer_active(config->layer_toggle)) {
data->layer_toggle_layer_enabled = false;
}
} else {
// Deactivate the layer if no further movement within
// layer_toggle_timeout_ms
Expand All @@ -272,7 +276,7 @@ void zmk_input_listener_ps2_layer_toggle_activate_layer(struct k_work *item) {
int64_t current_time = k_uptime_get();
int64_t last_mv_within_ms = current_time - data->layer_toggle_last_mouse_package_time;

if (last_mv_within_ms <= config->layer_toggle_timeout_ms * 0.1) {
if (last_mv_within_ms <= config->layer_toggle_delay_ms * 0.1) {
LOG_INF("Activating layer %d due to mouse activity...", config->layer_toggle);

#if IS_ENABLED(CONFIG_ZMK_INPUT_MOUSE_PS2_ENABLE_UROB_COMPAT)
Expand Down