增加消息队列及重连
This commit is contained in:
+6
-6
@@ -190,7 +190,7 @@ export default {
|
||||
this.startRS485()
|
||||
this.startRS232()
|
||||
// 启动心跳检测
|
||||
this.startHeartbeat()
|
||||
// this.startHeartbeat()
|
||||
} catch (e) {
|
||||
// console.log(e)
|
||||
uni.showToast({
|
||||
@@ -377,11 +377,11 @@ export default {
|
||||
this.readData()
|
||||
|
||||
// 串口打开成功后,重置重连计数器和时间戳
|
||||
this.reconnectCount = 0
|
||||
this.last485DataTime = Date.now()
|
||||
// this.reconnectCount = 0
|
||||
// this.last485DataTime = Date.now()
|
||||
|
||||
// 记录通信恢复日志
|
||||
this.addLog('485通信', '通信已恢复(重连成功)')
|
||||
// this.addLog('485通信', '通信已恢复(重连成功)')
|
||||
}
|
||||
},
|
||||
async startRS232() {
|
||||
@@ -526,9 +526,9 @@ export default {
|
||||
|
||||
readData() {
|
||||
this.timer = setInterval(async () => {
|
||||
cmd.getTemp()
|
||||
await cmd.getTemp()
|
||||
await delay(1000)
|
||||
cmd.getPressure()
|
||||
await cmd.getPressure()
|
||||
}, 5000)
|
||||
},
|
||||
async handle485HexData(hex) {
|
||||
|
||||
Reference in New Issue
Block a user