-
Notifications
You must be signed in to change notification settings - Fork 488
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
make_key not working; issue with lambda? #573
Comments
That sounds like a configuration issue and may be best addressed in matrix/discord chat. |
I'm not sure I totally understand what you mean by configuration issue, could you be more specific? Like configuration in the OS? I forgot to mention in the original post that I have made three different KMK keyboards now, with three different MCUs (ItsyBitsy, SeeedStudio nRF, and a wired board with the Pi Pico) and have had this same issue across all the boards. |
TLDR: bad code. Feel free to stop by to get real time support in the matrix/discord bridge. Harder to work on when we don't have real time chat. |
The thing is that I have now stripped almost everything out of my code and it still has the same problem. In general I find Discord servers to be really unhelpful, so before moving there, I just want to post this - if people look at this and tell me this is still something I am doing wrong in my code, I will take it to discord for further help. Here is my entire code.py file: print("Starting")
import board
from kb import KMKKeyboard
from kmk.keys import KC, make_key
from kmk.handlers.sequences import simple_key_sequence
from kmk.handlers.sequences import send_string
from kmk.modules.combos import Combos, Chord, Sequence
combos = Combos()
keyboard = KMKKeyboard()
keyboard.modules.append(combos)
keyboard.debug_enabled = True
make_key(
names=('MYKEY',),
on_press=lambda: print('I pressed MYKEY'),
)
keyboard.keymap = [
[
KC.MYKEY, KC.B,\
KC.C, KC.D,\
],
]
if __name__ == '__main__':
keyboard.go() and my entire kb.py file: import board
from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
from kmk.scanners import DiodeOrientation
class KMKKeyboard(_KMKKeyboard):
row_pins = (board.GP4, board.GP5,)
col_pins = (board.GP9, board.GP8,)
diode_orientation = DiodeOrientation.COL2ROW I am currently running this on a Pi Pico. Everything works except for KC.MYKEY, which gives me the positional arguments error mentioned above. |
Docs have been changed to reflect the problem in #578 Closing for now, but let us know if you have any more issues |
This fixed the "positional arguments" error for me, but it still just prints the text to the debug console, doesn't output HID text. In general, should a print statement act like a key? Should running |
|
I've got a bunch of those, and they work great. But when you use them in conjunction with make_key, they no longer actually type the text. And since the output of a combo must be another key, you have to use make_key to get that sequence to be the output of your combo. If I want a combo to actually type several letters, how would I do that? Specifically I want a U+Y combo to type "you". The docs seem to suggest this is possible using Even ignoring the combo use, just replacing the print statement in I guess the base question here is: can you use |
It's possible something has regressed (the sequences section of KMK is practically an easter egg at this point: I wrote it in 2018-19 at some point with almost no docs (oops) and the core of KMK has been refactored a lot since then, so this is probably barely-if-at-all tested), but in general, kmk_firmware/user_keymaps/klardotsh/klarank_featherm4.py Lines 51 to 56 in fdb07dd
|
Impl of kmk_firmware/kmk/handlers/sequences.py Lines 33 to 52 in fdb07dd
|
when I use the code from the docs (combos page), I get an error:
(in this instance, I am not trying to use it in a combo yet, just assigning KC.MYKEY to a key on my keyboard)
If I do try to use it in a combo, I get a different error:
I attempted to look for a keymap in the repo which used
make_key
to see if I could use their code and try to make it work. I ended up finding the "shrek_is_love" code (lol) in the Klarank keymap. This code works, in that it will print Shrek's face to my debug console, but it won't actually type anything like an HID keyboard. I attempted to change the print statements tosend_string
and evensimple_key_sequence
, but neither worked. The keyboard functions fine, it even registers the keypresses. That key just doesn't type anything.I also tried incorporating lambda into the shrek code, but receive the same error as before with the code from the docs (but often with different numbers - "takes 4 positional arguments and 5 were given" etc)
So, I can print stuff to the console just fine, but if I try to use it to actually output text using lambda, I get the positional arguments error.
I am not sure if this is a bug or I am simply making a mistake somehow! Any help would be appreciated.
I am using an ItsyBitsy nRF52840 Express
The text was updated successfully, but these errors were encountered: