Describe the bug
Using the code in the documentation I tried to get my keyboard to print some letters to the console when the lock status changes. However nothing seems to happen.
To Reproduce
pull master at commit 74db929
put the following code in code.py:
# in your main.py
from kmk.kmk_keyboard import KMKKeyboard
from kmk.extensions.lock_status import LockStatus
keyboard = KMKKeyboard()
class LEDLockStatus(LockStatus):
def set_lock_leds(self):
if self.get_caps_lock():
print("A")
else:
print("B")
if self.get_scroll_lock():
print("C")
else:
print("D")
def after_hid_send(self, sandbox):
super().after_hid_send(sandbox) # Critically important. Do not forget
#if self.report_updated:
self.set_lock_leds()
**Expected behavior**
Expecting the serial terminal to print either A or B depending on the capslock status.
**Debug output**
The serial terminal is working as it does print the "print test" text as can be seen below:
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable.
code.py output:
print test
Code done running.
Press any key to enter the REPL. Use CTRL-D to reload.
**Additional context**
With some further testing it seems that the get_caps_lock() function only returns that the caps lock is not on even when it is. The module itself doesn't seem to hook into the HID stack properly?
Nevermind I forgot to actually turn this thing into a keyboard so the code would keep executing. This is why you rubber duck before you make an issue I guess...
Describe the bug Using the code in the documentation I tried to get my keyboard to print some letters to the console when the lock status changes. However nothing seems to happen.
To Reproduce
keyboard = KMKKeyboard()
class LEDLockStatus(LockStatus): def set_lock_leds(self): if self.get_caps_lock(): print("A") else: print("B")
print("print test") keyboard.extensions.append(LEDLockStatus())
Auto-reload is on. Simply save files over USB to run them or enter REPL to disable. code.py output: print test
Code done running.
Press any key to enter the REPL. Use CTRL-D to reload.