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

Handling rotary encoder keycodes in VIA #91

Closed
Pimentoso opened this issue Apr 12, 2020 · 9 comments
Closed

Handling rotary encoder keycodes in VIA #91

Pimentoso opened this issue Apr 12, 2020 · 9 comments

Comments

@Pimentoso
Copy link

Hi, I'm making a keypad with a single rotary encoder and I want to configure the keycodes triggered by CW/CCW rotation from inside VIA.

I saw that the satisfaction75 keyboard did something like this, I looked at the via.c and satisfaction75.c, but mainly my problem is that raw_hid_receive_kb never gets called because I have no idea how to send an unhandled command, so that raw_hid_receive yields to my custom method.
I have seen that the satisfaction75 has some custom menu .tsx files in this repo, and that's probably where the custom command gets sent. What's the correct way to implement some custom components/menus and test them locally?

Or is there a simpler way to achieve this? I tried adding two mock buttons to the keymap, and I can assign keycodes to them in VIA, and I could wire the encoder_update_kb method to read the correct eeprom location and get their keycodes, but I haven't found a way to do that.

@wilba
Copy link
Contributor

wilba commented Jun 21, 2020

Sorry for the late reply.

We are adding support for custom UI to VIA right now, which will allow people to add their own custom menus to VIA, to contol such things as rotary encoders, lighting, etc.

Basically this is refactoring how Satisfaction 75's custom menus work, so that you will be able to do what you want.

We'll reply to this issue when it's ready.

@Pimentoso
Copy link
Author

That's great news.

@rtitmuss
Copy link

I'd really like to support configurable rotary encoders on my keyboard. I was wondering how this change was progressing, is there anything I can do to help?

@Pimentoso
Copy link
Author

The last release was 6 months ago, I doubt this project is still maintained.

@kb-elmo
Copy link
Contributor

kb-elmo commented Dec 27, 2020

Any news on this? @Wilba6582

Is VIA even developed actively anymore? Since Olivia is pretty much inactive it seems?

@nathan-teoh
Copy link

I believe the only way to get rotary encoder right now is to port what they have for the satisfaction75. I took a quick look at it and I think it's pretty doable. I'm currently trying it out but haven't had anything successfully show up yet, but I'll report back if I have any progress

@kaz3304
Copy link

kaz3304 commented May 15, 2021

I believe the only way to get rotary encoder right now is to port what they have for the satisfaction75. I took a quick look at it and I think it's pretty doable. I'm currently trying it out but haven't had anything successfully show up yet, but I'll report back if I have any progress

Have you made any progress? I've tried another piece of software that handles knobs pretty well, but I hadn't considered there might be some things to reverse engineer within via.

@bryan065
Copy link

bryan065 commented Apr 6, 2022

I was helping another user with a bm60ec keyboard and the way that one handles encoders is pretty neat. You can remap the encoder in via like a regular key. Even works with layers. Everything works with the existing framework.

I have a kb67 soldered and modified with an encoder and I can remap it freely in via.

image
The two keys sticking out are for the encoder.

Right now I have the via .JSON modified and have to load it each time. I don't know how Via deals with one-off or handwired keyboards. Will any pull requests for one-off keyboards be accepted?

How I got it to work on my kbd67 soldered:

-Copy your keyboard.h file into your keymap folder. (in my case, mkii_soldered.h).
-Edit the file to add the extra keys in the matrix. You then have to map it to any empty spot:
image

-Update your keymap.c file with the new layout:
image

-Add the encoder functions:
image
Where each command corresponds to the row and column of the empty matrix spot you used earlier. In my case K406 and K408. (Row 4, columns 6 * 8).
Command is dynamic_keymap_get_keycode( LAYER, ROW, COLUMN)

Finally, download the via .JSON for your keyboard

and add the extra keys so you see it in via.
image
I added two keys to the end of the first row corresponding to the matrix positions (row 4, columns 6/8).

@yiancar
Copy link
Collaborator

yiancar commented Jul 17, 2022

The above solution is the best solution I have found as well. You can take a look at:
qmk/qmk_firmware@master...yiancar:qmk_firmware:P01 especially the p01.c file:)

@yiancar yiancar closed this as completed Jul 17, 2022
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

8 participants