keyboard_comm: fix macro buffer size retrieval, fix unit tests

main
Ilya Zhuravlev 2020-12-25 12:58:04 -05:00
parent 464228cb4b
commit dfc37b143f
2 changed files with 5 additions and 1 deletions

View File

@ -170,7 +170,7 @@ class Keyboard:
""" Loads macro information from the keyboard """
data = self.usb_send(self.dev, struct.pack("B", CMD_VIA_MACRO_GET_COUNT))
self.macro_count = data[1]
data = self.usb_send(self.dev, struct.pack(">H", CMD_VIA_MACRO_GET_BUFFER_SIZE))
data = self.usb_send(self.dev, struct.pack("B", CMD_VIA_MACRO_GET_BUFFER_SIZE))
self.macro_memory = struct.unpack(">H", data[1:3])[0]
def set_key(self, layer, row, col, code):

View File

@ -95,6 +95,10 @@ class TestKeyboard(unittest.TestCase):
dev.expect_encoders(encoders)
# layout options
dev.expect("0202", "020200000000")
# macro count
dev.expect("0C", "0C00")
# macro buffer size
dev.expect("0D", "0D0000")
kb = Keyboard(dev, dev.sim_send)
# simulate old VIA keymap retrieval in tests for now