diff --git a/pyproject.toml b/pyproject.toml index 26ac1ea..355a085 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "infuse_iot" -version = "0.2.1" +version = "0.3.0" authors = [{name = "Embeint Holdings Pty Ltd", email = "support@embeint.com"}] description = "Infuse-IoT Platform python package" classifiers = [ diff --git a/src/infuse_iot/cpatch.py b/src/infuse_iot/cpatch.py index 6f90d40..e032c5b 100644 --- a/src/infuse_iot/cpatch.py +++ b/src/infuse_iot/cpatch.py @@ -591,7 +591,6 @@ def _cleanup_jumps(cls, old: bytes, instructions: list[Instr]) -> list[Instr]: if len(instructions) >= 2 and isinstance(instructions[1], SetAddrInstr): # ADDR, COPY, ADRR if instr.shift == -instructions[1].shift: - print(copy.length) # Replace with a write instead merged.append(WriteInstr(old[instr.new : instr.new + copy.length])) replaced = True diff --git a/src/infuse_iot/generated/rpc_definitions.py b/src/infuse_iot/generated/rpc_definitions.py index 64ca756..ff7da25 100644 --- a/src/infuse_iot/generated/rpc_definitions.py +++ b/src/infuse_iot/generated/rpc_definitions.py @@ -477,6 +477,7 @@ class response(VLACompatLittleEndianStruct): ("param_2", ctypes.c_uint32), ("thread", 8 * ctypes.c_char), ] + vla_field = ("esf", 0 * ctypes.c_uint32) _pack_ = 1 diff --git a/src/infuse_iot/generated/tdf_base.py b/src/infuse_iot/generated/tdf_base.py index 2505877..74dab5d 100644 --- a/src/infuse_iot/generated/tdf_base.py +++ b/src/infuse_iot/generated/tdf_base.py @@ -28,7 +28,10 @@ def name(self) -> str: return self.field def val_fmt(self) -> str: - return self._display_fmt.format(self.val) + if isinstance(self.val, list) and self._display_fmt != "{}": + return ",".join([self._display_fmt.format(v) for v in self.val]) + else: + return self._display_fmt.format(self.val) class TdfStructBase(ctypes.LittleEndianStructure): diff --git a/src/infuse_iot/generated/tdf_definitions.py b/src/infuse_iot/generated/tdf_definitions.py index 05e7615..b0dacd2 100644 --- a/src/infuse_iot/generated/tdf_definitions.py +++ b/src/infuse_iot/generated/tdf_definitions.py @@ -1356,14 +1356,14 @@ class lora_rx(TdfReadingBase): ] _pack_ = 1 _postfix_ = { - "snr": "", - "rssi": "", + "snr": "dB", + "rssi": "dBm", "payload": "", } _display_fmt_ = { "snr": "{}", "rssi": "{}", - "payload": "{}", + "payload": "0x{:02x}", } class lora_tx(TdfReadingBase): @@ -1379,7 +1379,7 @@ class lora_tx(TdfReadingBase): "payload": "", } _display_fmt_ = { - "payload": "{}", + "payload": "0x{:02x}", } class idx_array_freq(TdfReadingBase): @@ -1394,7 +1394,7 @@ class idx_array_freq(TdfReadingBase): _pack_ = 1 _postfix_ = { "tdf_id": "", - "frequency": "", + "frequency": "Hz", } _display_fmt_ = { "tdf_id": "{}", @@ -1413,7 +1413,7 @@ class idx_array_period(TdfReadingBase): _pack_ = 1 _postfix_ = { "tdf_id": "", - "period": "", + "period": "ns", } _display_fmt_ = { "tdf_id": "{}", @@ -1500,7 +1500,7 @@ class exception_stack_frame(TdfReadingBase): "frame": "", } _display_fmt_ = { - "frame": "{}", + "frame": "0x{:08x}", } diff --git a/src/infuse_iot/rpc_wrappers/last_reboot.py b/src/infuse_iot/rpc_wrappers/last_reboot.py index 5bc0f62..13814b4 100644 --- a/src/infuse_iot/rpc_wrappers/last_reboot.py +++ b/src/infuse_iot/rpc_wrappers/last_reboot.py @@ -36,3 +36,5 @@ def handle_response(self, return_code, response): print(f"\t Param 1: 0x{response.param_1:08x}") print(f"\t Param 2: 0x{response.param_2:08x}") print(f"\t Thread: {response.thread.decode('utf-8')}") + for idx, val in enumerate(response.esf): + print(f"\t ESF[{idx:2d}]: 0x{val:08x}")