fix: ADC notifications no longer emit 'status' (prevents timer jump)
- ADC (17-byte) now emits 'adc' + 'battery' events, not 'status' - Fixes CRITICAL timer jump: remaining_ms:0 was resetting countdown - Drop ADC packets with bad XOR checksum - treating.js + index.js subscribe to 'battery' for live battery updates - onStatus only updates remaining_ms when > 0
这个提交包含在:
@@ -21,7 +21,9 @@ Page({
|
||||
this.setData({ devMode: config.__DEV__ || false })
|
||||
this.checkState()
|
||||
this._onStatus = this.onBleStatus.bind(this)
|
||||
this._onBattery = this.onBleBattery.bind(this)
|
||||
ble.on('status', this._onStatus)
|
||||
ble.on('battery', this._onBattery)
|
||||
},
|
||||
|
||||
_cleanup: function () {
|
||||
@@ -29,6 +31,10 @@ Page({
|
||||
ble.off('status', this._onStatus)
|
||||
this._onStatus = null
|
||||
}
|
||||
if (this._onBattery) {
|
||||
ble.off('battery', this._onBattery)
|
||||
this._onBattery = null
|
||||
}
|
||||
},
|
||||
|
||||
onHide: function () {
|
||||
@@ -78,6 +84,10 @@ Page({
|
||||
})
|
||||
},
|
||||
|
||||
onBleBattery: function (info) {
|
||||
this.setData({ battery: info.battery, connected: true })
|
||||
},
|
||||
|
||||
onConnectBle: function () {
|
||||
var self = this
|
||||
self.setData({ bleState: 'scanning' })
|
||||
|
||||
在新工单中引用
屏蔽一个用户