kmk_firmware
kmk_firmware copied to clipboard
Improved debugging
There's no consistent or central debugging mechanism. The current debug prints from KMKKeyboard
can be very verbose to the point of being counterproductive in some scenarios.
In my testing branch I've been using variations of:
# in kmk.utils:
class Debug:
def __init__(self, name):
self.enabled = False
self.name = name
def __call__(self, *message):
if self.enabled:
print(f'{ticks_ms()} {self.name} {*message}')
# in individual source files:
debug = Debug(__name__)
debug("E: I'm an error.")
This would allow to enable/disable debugging for certain parts of KMK individually, and it's on purpose lighter weight than adafruit_logger
. I don't think that a bunch of debug levels would be particularly useful in KMK.
It could be extended by a global debug flag in order to facilitate switching on/off via special function key.
Looking forward to feedback.
resolved by #529