Remove GC. Not needed on newer Cpy versions
This commit is contained in:
parent
026308bbeb
commit
1a4e81a2e5
@ -4,8 +4,16 @@ from kmk.kmk_keyboard import KMKKeyboard as _KMKKeyboard
|
||||
from kmk.matrix import DiodeOrientation
|
||||
from kmk.matrix import intify_coordinate as ic
|
||||
|
||||
|
||||
class KMKKeyboard(_KMKKeyboard):
|
||||
col_pins = (board.P0_31, board.P0_29, board.P0_02, board.P1_15, board.P1_13, board.P1_11)
|
||||
col_pins = (
|
||||
board.P0_31,
|
||||
board.P0_29,
|
||||
board.P0_02,
|
||||
board.P1_15,
|
||||
board.P1_13,
|
||||
board.P1_11,
|
||||
)
|
||||
row_pins = (board.P0_22, board.P0_24, board.P1_00, board.P0_11)
|
||||
diode_orientation = DiodeOrientation.COLUMNS
|
||||
|
||||
|
@ -1,5 +1,3 @@
|
||||
import gc
|
||||
|
||||
import kmk.handlers.layers as layers
|
||||
import kmk.handlers.modtap as modtap
|
||||
import kmk.handlers.stock as handlers
|
||||
@ -305,9 +303,7 @@ def make_key(code=None, names=tuple(), type=KEY_SIMPLE, **kwargs): # NOQA
|
||||
|
||||
key = constructor(code=code, **kwargs)
|
||||
|
||||
gc.collect()
|
||||
register_key_names(key, names)
|
||||
gc.collect()
|
||||
|
||||
return key
|
||||
|
||||
|
@ -108,22 +108,6 @@ class KMKKeyboard:
|
||||
self.uart_pin,
|
||||
)
|
||||
|
||||
def _print_debug_cycle(self, init=False):
|
||||
pre_alloc = gc.mem_alloc()
|
||||
pre_free = gc.mem_free()
|
||||
|
||||
if self.debug_enabled:
|
||||
if init:
|
||||
print('KMKInit(release={})'.format(KMK_RELEASE))
|
||||
|
||||
print(self)
|
||||
print(self._state)
|
||||
print(
|
||||
'GCStats(pre_alloc={} pre_free={} alloc={} free={})'.format(
|
||||
pre_alloc, pre_free, gc.mem_alloc(), gc.mem_free()
|
||||
)
|
||||
)
|
||||
|
||||
def _send_hid(self):
|
||||
self._hid_helper_inst.create_report(self._state.keys_pressed).send()
|
||||
self._state.resolve_hid()
|
||||
@ -223,6 +207,7 @@ class KMKKeyboard:
|
||||
elif hid_type == HIDModes.USB:
|
||||
try:
|
||||
from kmk.hid import USBHID
|
||||
|
||||
self.hid_helper = USBHID
|
||||
except ImportError:
|
||||
self.hid_helper = AbstractHID
|
||||
@ -230,12 +215,12 @@ class KMKKeyboard:
|
||||
elif hid_type == HIDModes.BLE:
|
||||
try:
|
||||
from kmk.ble import BLEHID
|
||||
|
||||
self.hid_helper = BLEHID
|
||||
except ImportError:
|
||||
self.hid_helper = AbstractHID
|
||||
print('Bluetooth is unsupported ')
|
||||
|
||||
|
||||
self._hid_helper_inst = self.hid_helper(**kwargs)
|
||||
|
||||
# Split keyboard Init
|
||||
@ -293,9 +278,6 @@ class KMKKeyboard:
|
||||
if not isinstance(k, tuple):
|
||||
del self.leader_dictionary[k]
|
||||
|
||||
gc.collect()
|
||||
self._print_debug_cycle(init=True)
|
||||
|
||||
while True:
|
||||
state_changed = False
|
||||
|
||||
@ -336,6 +318,3 @@ class KMKKeyboard:
|
||||
|
||||
if self.led and self.led.enabled and self.led.animation_mode:
|
||||
self.led = self.led.animate()
|
||||
|
||||
if state_changed:
|
||||
self._print_debug_cycle()
|
||||
|
@ -1,5 +1,4 @@
|
||||
import digitalio
|
||||
import gc
|
||||
|
||||
|
||||
def intify_coordinate(row, col):
|
||||
@ -37,7 +36,6 @@ class MatrixScanner:
|
||||
len(unique_pins) == self.len_cols + self.len_rows
|
||||
), 'Cannot use a pin as both a column and row'
|
||||
del unique_pins
|
||||
gc.collect()
|
||||
|
||||
self.diode_orientation = diode_orientation
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user