code cleanup to pass lint and some for flake8
This commit is contained in:
parent
ad3430eeb6
commit
1751cce299
@ -25,6 +25,7 @@ import kmk.util # isort:skip
|
|||||||
import busio # isort:skip
|
import busio # isort:skip
|
||||||
|
|
||||||
import supervisor # isort:skip
|
import supervisor # isort:skip
|
||||||
|
from kmk import rgb # isort:skip
|
||||||
from kmk.consts import LeaderMode, UnicodeMode # isort:skip
|
from kmk.consts import LeaderMode, UnicodeMode # isort:skip
|
||||||
from kmk.hid import USB_HID # isort:skip
|
from kmk.hid import USB_HID # isort:skip
|
||||||
from kmk.internal_state import InternalState # isort:skip
|
from kmk.internal_state import InternalState # isort:skip
|
||||||
@ -42,9 +43,7 @@ import kmk.matrix # isort:skip
|
|||||||
import kmk.hid # isort:skip
|
import kmk.hid # isort:skip
|
||||||
import kmk.internal_state # isort:skip
|
import kmk.internal_state # isort:skip
|
||||||
|
|
||||||
# GC runs automatically after CircuitPython imports. If we ever go back to
|
# GC runs automatically after CircuitPython imports.
|
||||||
# supporting MicroPython, we'll need a GC here (and probably after each
|
|
||||||
# chunk of the above)
|
|
||||||
|
|
||||||
# Thanks for sticking around. Now let's do real work, starting below
|
# Thanks for sticking around. Now let's do real work, starting below
|
||||||
|
|
||||||
@ -142,10 +141,10 @@ class Firmware:
|
|||||||
self._send_hid()
|
self._send_hid()
|
||||||
|
|
||||||
def _handle_matrix_report(self, update=None):
|
def _handle_matrix_report(self, update=None):
|
||||||
'''
|
"""
|
||||||
Bulk processing of update code for each cycle
|
Bulk processing of update code for each cycle
|
||||||
:param update:
|
:param update:
|
||||||
'''
|
"""
|
||||||
if update is not None:
|
if update is not None:
|
||||||
self._state.matrix_changed(
|
self._state.matrix_changed(
|
||||||
update[0],
|
update[0],
|
||||||
@ -166,7 +165,6 @@ class Firmware:
|
|||||||
update = bytearray(self.uart.read(3))
|
update = bytearray(self.uart.read(3))
|
||||||
# Built in debug mode switch
|
# Built in debug mode switch
|
||||||
if update == b'DEB':
|
if update == b'DEB':
|
||||||
# TODO Pretty up output
|
|
||||||
print(self.uart.readline())
|
print(self.uart.readline())
|
||||||
return None
|
return None
|
||||||
return update
|
return update
|
||||||
@ -174,11 +172,11 @@ class Firmware:
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
def _send_debug(self, message):
|
def _send_debug(self, message):
|
||||||
'''
|
"""
|
||||||
Prepends DEB and appends a newline to allow debug messages to
|
Prepends DEB and appends a newline to allow debug messages to
|
||||||
be detected and handled differently than typical keypresses.
|
be detected and handled differently than typical keypresses.
|
||||||
:param message: Debug message
|
:param message: Debug message
|
||||||
'''
|
"""
|
||||||
if self.uart is not None:
|
if self.uart is not None:
|
||||||
self.uart.write('DEB')
|
self.uart.write('DEB')
|
||||||
self.uart.write(message, '\n')
|
self.uart.write(message, '\n')
|
||||||
@ -202,7 +200,6 @@ class Firmware:
|
|||||||
else:
|
else:
|
||||||
return busio.UART(tx=pin, rx=None, timeout=timeout)
|
return busio.UART(tx=pin, rx=None, timeout=timeout)
|
||||||
|
|
||||||
|
|
||||||
def go(self):
|
def go(self):
|
||||||
assert self.keymap, 'must define a keymap with at least one row'
|
assert self.keymap, 'must define a keymap with at least one row'
|
||||||
assert self.row_pins, 'no GPIO pins defined for matrix rows'
|
assert self.row_pins, 'no GPIO pins defined for matrix rows'
|
||||||
@ -228,7 +225,7 @@ class Firmware:
|
|||||||
self.hue_step, self.sat_step, self.val_step,
|
self.hue_step, self.sat_step, self.val_step,
|
||||||
self.hue_default, self.sat_default, self.val_default,
|
self.hue_default, self.sat_default, self.val_default,
|
||||||
self.breathe_center, self.knight_effect_length,
|
self.breathe_center, self.knight_effect_length,
|
||||||
self.val_limit, self.animation_mode, self.animation_speed
|
self.val_limit, self.animation_mode, self.animation_speed,
|
||||||
)
|
)
|
||||||
|
|
||||||
self.matrix = MatrixScanner(
|
self.matrix = MatrixScanner(
|
||||||
@ -292,5 +289,4 @@ class Firmware:
|
|||||||
if self.pixels.animation_mode is not None:
|
if self.pixels.animation_mode is not None:
|
||||||
self.pixels = self.pixels.animate()
|
self.pixels = self.pixels.animate()
|
||||||
|
|
||||||
|
|
||||||
gc.collect()
|
gc.collect()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user