From 8e5a1b6434fc992d72816b48a045f024a4f6e4ae Mon Sep 17 00:00:00 2001 From: Pim van den Berg Date: Mon, 5 Jun 2023 21:35:34 +0200 Subject: [PATCH] WIP: add getconfig support --- itho-wpu.py | 1 + itho_i2c.py | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/itho-wpu.py b/itho-wpu.py index 7c277ef..d163449 100755 --- a/itho-wpu.py +++ b/itho-wpu.py @@ -23,6 +23,7 @@ actions = { "getserial": [0x90, 0xE1], "getdatatype": [0xA4, 0x00], "getdatalog": [0xA4, 0x01], + "getconfig": [0xC0, 0x30], } diff --git a/itho_i2c.py b/itho_i2c.py index 00dfd6f..7ec1912 100644 --- a/itho_i2c.py +++ b/itho_i2c.py @@ -12,6 +12,7 @@ actions = { "getserial": [0x90, 0xE1], "getdatatype": [0xA4, 0x00], "getdatalog": [0xA4, 0x01], + "getconfig": [0xC0, 0x30], } @@ -46,8 +47,11 @@ class I2CMaster: self.queue = queue def compose_request(self, action): - # 0x80 = source, 0x04 = msg_type, 0x00 = length - request = [0x80] + actions[action] + [0x04, 0x00] + if action == "getconfig": + request = [0x80] + actions[action] + [0x04, 0x04, 0x00, 0x00, 0x00, 0x0C] + else: + # 0x80 = source, 0x04 = msg_type, 0x00 = length + request = [0x80] + actions[action] + [0x04, 0x00] request.append(self.calculate_checksum(request)) return request