This commit is contained in:
vc4
2024-06-14 14:18:40 +08:00
parent b643b1037e
commit 5bb7f75fbc
2 changed files with 29 additions and 22 deletions

View File

@@ -78,7 +78,10 @@ class UIproc():
return self.wait_sendData return self.wait_sendData
def getSendDataLoop(self): def getSendDataLoop(self):
while True: while True:
self.getSendData(cache=False) try:
self.getSendData(cache=False)
except:
pass
time.sleep(1) time.sleep(1)
def dmesg(self, cate, data): def dmesg(self, cate, data):
_err = 0 _err = 0
@@ -99,7 +102,7 @@ class UIproc():
_i0,fg='end','black' _i0,fg='end','black'
if cate == 'send' and self.ckbtn_sendshow.var.get(): if cate == 'send' and self.ckbtn_sendshow.var.get():
text += MARK('> ') text += MARK('> ')
text += self.ckbtn_rhex.var.get() and tohex(data) or data.decode(encoding, 'ignore') text += self.ckbtn_shex.var.get() and tohex(data) or data.decode(encoding, 'ignore')
_i0 = self.text_recv.index('end') _i0 = self.text_recv.index('end')
self.text_recv.insert('end', '\n%s'%text.translate({0:'<00>'})) self.text_recv.insert('end', '\n%s'%text.translate({0:'<00>'}))
self.lastRecvTicks = 0 self.lastRecvTicks = 0

View File

@@ -2,43 +2,43 @@
"baud": "9600", "baud": "9600",
"btn-data01": { "btn-data01": {
"hex": 1, "hex": 1,
"title": "fan on", "title": "DOWN",
"value": "01 10 30 12 00 01 02 00 01 54 E1" "value": "55 AA 0A FC 01 10 01 01 10 02 01 00 05 EE EE"
}, },
"btn-data02": { "btn-data02": {
"hex": 1, "hex": 1,
"title": "fan off", "title": "UP",
"value": "01 10 30 12 00 01 02 00 02 14 E0" "value": "55 AA 0A FC 01 10 01 01 10 02 01 00 04 EE EE"
}, },
"btn-data03": { "btn-data03": {
"hex": 1, "hex": 1,
"title": "reboot", "title": "reboot",
"value": "01 10 30 11 00 01 02 00 01 54 D2" "value": "55 AA 0A FC 01 10 01 01 10 04 01 01 FF EE EE"
}, },
"btn-data04": { "btn-data04": {
"hex": 0, "hex": 0,
"title": "set RTS", "title": "DTR=1",
"value": "{\"rts\":0,\"text\":\"1B\",\"hex\":1}" "value": "{\"dtr\":0,\"rts\":0,\"hex\":\"18FF\"}"
}, },
"btn-data05": { "btn-data05": {
"hex": 0, "hex": 0,
"title": "reset RTS", "title": "DTR=0",
"value": "{\"rts\":1,\"text\":\"\"}" "value": "{\"dtr\":1,\"rts\":1,\"hex\":\"18FF\"}"
}, },
"btn-data06": { "btn-data06": {
"hex": 1, "hex": 0,
"title": "silent", "title": "random",
"value": "01 10 30 03 00 01 02 00 00 96 60" "value": "'%s'%__import__('random').random()"
}, },
"btn-data07": { "btn-data07": {
"hex": 1, "hex": 1,
"title": "read.cfg", "title": "wake",
"value": "01 03 30 00 00 16 5A EE" "value": "55 AA 0A FC 01 10 01 01 10 04 01 03 00 EE EE\n"
}, },
"btn-data08": { "btn-data08": {
"hex": 1, "hex": 1,
"title": "auto report", "title": "page1",
"value": "01 10 30 03 00 01 02 00 01 57 A0" "value": "55 AA 0A FC 01 10 01 01 10 04 01 02 01 EE EE\n"
}, },
"btn-unpack01": { "btn-unpack01": {
"title": "HEX print", "title": "HEX print",
@@ -52,12 +52,16 @@
"title": "hex2dec[-3:-2]", "title": "hex2dec[-3:-2]",
"value": "len(data)==26 and '\\t['+'%5d' % (data[-2]*256+data[-3])+']'" "value": "len(data)==26 and '\\t['+'%5d' % (data[-2]*256+data[-3])+']'"
}, },
"btn-unpack04": {
"title": "tc01-sens-data",
"value": "len(data)>=27 and data[2]==0x16 and '\\n\\ppbx10=%s\\nt=%s\\nad=%s\\nad0=%s\\nK=%s\\nadv=%s\\n' % (\nint16(data[5:]),\nuint16(data[7:]),\nuint16(data[11:]),\nuint16(data[13:]),\nuint16(data[15:]),\nuint16(data[21:]))\n"
},
"btn-unpack05": { "btn-unpack05": {
"title": "s17-eeprom", "title": "tc01-sens-cfg",
"value": "'\\nad0fix=%s\\n' % (uint16(data[17:]))" "value": "len(data)>=25 and data[2]==0x14 and '\\n\\K=%s\\nKuser=%s\\nad0fix=%s\\nmlevel=%s\\nfofactor=%s\\nKntc=%s\\n' % (\nuint16(data[9:]),\nuint16(data[11:]),\nuint16(data[13:]),\nuint16(data[15:]),\nuint16(data[17:]),\nuint16(data[19:]))\n\n"
}, },
"cycle": "100", "cycle": "100",
"encoding": "gbk", "encoding": "gbk",
"split": "500", "split": "100",
"uservar": "" "uservar": "HELLO"
} }