Work out some bugs where I could get stuck on layers. Add more debugging output

This commit is contained in:
Josh Klar
2018-10-18 23:24:19 -07:00
parent 6c5a111d65
commit 9089106316
4 changed files with 40 additions and 34 deletions

View File

@@ -94,26 +94,28 @@ class Firmware:
print("Firin' lazers. Keyboard is booted.")
while True:
update = self.matrix.scan_for_pressed()
for update in self.matrix.scan_for_pressed():
if update is not None:
self._state.matrix_changed(
update[0],
update[1],
update[2],
)
if update is not None:
self._state.matrix_changed(
update[0],
update[1],
update[2],
)
if self._state.hid_pending:
self._send_hid()
if self._state.hid_pending:
self._send_hid()
for key in self._state.pending_keys:
self._send_key(key)
self._state.pending_key_handled()
if self._state.macro_pending:
for key in self._state.macro_pending(self):
for key in self._state.pending_keys:
self._send_key(key)
self._state.pending_key_handled()
self._state.resolve_macro()
if self._state.macro_pending:
for key in self._state.macro_pending(self):
self._send_key(key)
self._state.resolve_macro()
if self.debug_enabled:
print('New State: {}'.format(self._state._to_dict()))
gc.collect()