Use debug() for error messages

This commit is contained in:
xs5871 2023-02-12 12:46:30 +00:00
parent 16d319359f
commit e9af3e542a
No known key found for this signature in database
GPG Key ID: 2A617DBC375C8352

View File

@ -10,6 +10,7 @@ import struct
from kmk.keys import AX, KC, make_argumented_key, make_key
from kmk.kmktime import PeriodicTimer
from kmk.modules import Module
from kmk.utils import Debug
_I2C_ADDRESS = const(0x0A)
_I2C_ADDRESS_ALTERNATIVE = const(0x0B)
@ -47,6 +48,9 @@ _MSK_CTRL_FWRITE = const(0b00001000)
ANGLE_OFFSET = 0
debug = Debug(__name__)
class TrackballHandlerKeyMeta:
def __init__(self, handler=0):
self.handler = handler
@ -250,7 +254,8 @@ class Trackball(Module):
try:
self.current_handler = self.handlers[handler]
except KeyError:
print(f'no handler found with id {handler}')
if debug.enabled:
debug(f'no handler found with id {handler}')
def next_handler(self):
next_index = self.handlers.index(self.current_handler) + 1