Use debug() for error messages
This commit is contained in:
parent
16d319359f
commit
e9af3e542a
@ -10,6 +10,7 @@ import struct
|
|||||||
from kmk.keys import AX, KC, make_argumented_key, make_key
|
from kmk.keys import AX, KC, make_argumented_key, make_key
|
||||||
from kmk.kmktime import PeriodicTimer
|
from kmk.kmktime import PeriodicTimer
|
||||||
from kmk.modules import Module
|
from kmk.modules import Module
|
||||||
|
from kmk.utils import Debug
|
||||||
|
|
||||||
_I2C_ADDRESS = const(0x0A)
|
_I2C_ADDRESS = const(0x0A)
|
||||||
_I2C_ADDRESS_ALTERNATIVE = const(0x0B)
|
_I2C_ADDRESS_ALTERNATIVE = const(0x0B)
|
||||||
@ -47,6 +48,9 @@ _MSK_CTRL_FWRITE = const(0b00001000)
|
|||||||
ANGLE_OFFSET = 0
|
ANGLE_OFFSET = 0
|
||||||
|
|
||||||
|
|
||||||
|
debug = Debug(__name__)
|
||||||
|
|
||||||
|
|
||||||
class TrackballHandlerKeyMeta:
|
class TrackballHandlerKeyMeta:
|
||||||
def __init__(self, handler=0):
|
def __init__(self, handler=0):
|
||||||
self.handler = handler
|
self.handler = handler
|
||||||
@ -250,7 +254,8 @@ class Trackball(Module):
|
|||||||
try:
|
try:
|
||||||
self.current_handler = self.handlers[handler]
|
self.current_handler = self.handlers[handler]
|
||||||
except KeyError:
|
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):
|
def next_handler(self):
|
||||||
next_index = self.handlers.index(self.current_handler) + 1
|
next_index = self.handlers.index(self.current_handler) + 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user