加入接收数据解析相关功能

This commit is contained in:
2025-09-29 11:12:18 +08:00
parent fdefb41989
commit 18ff4971ec
2 changed files with 6 additions and 2 deletions

View File

@@ -222,6 +222,10 @@ class UIProcessor:
else: # recv else: # recv
prefix = "< " if self.ckbtn_time.var.get() else "" prefix = "< " if self.ckbtn_time.var.get() else ""
content = human_string(data, self.ckbtn_rhex.var.get(), encoding) content = human_string(data, self.ckbtn_rhex.var.get(), encoding)
for cb in self.root.unpack.values():
try:
if cb: content += eval(cb['value'],{'data':data, 'uint16':uint16,'int16':int16}) or ''
except: pass
message = f"\n{timestamp}{prefix}{content}" message = f"\n{timestamp}{prefix}{content}"
self.text_handler.put_message(message) self.text_handler.put_message(message)

View File

@@ -31,9 +31,9 @@
"value": "5A A5 09 A1 A5 10 10 00 03 20 00 01 EE EE" "value": "5A A5 09 A1 A5 10 10 00 03 20 00 01 EE EE"
}, },
"btn-data07": { "btn-data07": {
"hex": 1,
"title": "获取状态", "title": "获取状态",
"value": "5A A5 07 A1 A5 10 10 00 01 11 EE EE" "value": "5A A5 07 A1 A5 10 10 00 01 11 EE EE",
"hex": 0
}, },
"btn-data08": { "btn-data08": {
"hex": 1, "hex": 1,