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

How do I override encoder_update_kb in a Vial layout? #811

Open
Eloren1 opened this issue Nov 2, 2024 · 1 comment
Open

How do I override encoder_update_kb in a Vial layout? #811

Eloren1 opened this issue Nov 2, 2024 · 1 comment

Comments

@Eloren1
Copy link
Contributor

Eloren1 commented Nov 2, 2024

I have a code that overrides the encoder update to remove accidental double actuations. It’s inside the sofle.c file.

However, it only works if I build the default firmware, not the :vial one. I tried placing this code inside rev1/keymaps/vial/keymap.c, but it didn’t override the encoder behavior.

#ifdef ENCODER_ENABLE
static uint16_t last_encoder_time = 0;

bool encoder_update_kb(uint8_t index, bool clockwise) {
    if (!encoder_update_user(index, clockwise)) {
        return false;
    }

    if (timer_elapsed(last_encoder_time) < 100) {
        return false; 
    }
    last_encoder_time = timer_read();
    // etc
}
#endif
@Eloren1
Copy link
Contributor Author

Eloren1 commented Nov 2, 2024

I wish encoder debouncing was officially supported in VIAL...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant