fix: audit fixes — dedupe run_state logs, stop device on scan exit
- Only log run_state when value changes (avoid flooding console) - Send stopTreatment on unload if scan is in progress (stop device LEDs)
这个提交包含在:
@@ -72,9 +72,13 @@ Page({
|
||||
}
|
||||
ble.on('adc', self._onAdc)
|
||||
|
||||
self._lastRunState = -1
|
||||
self._onRunState = function (data) {
|
||||
if (self._completed) return
|
||||
if (data.run_state !== self._lastRunState) {
|
||||
console.log('[SCAN] run_state:', data.run_state)
|
||||
self._lastRunState = data.run_state
|
||||
}
|
||||
if (data.run_state === 0x01) {
|
||||
self._seenScanning = true
|
||||
}
|
||||
@@ -158,6 +162,9 @@ Page({
|
||||
},
|
||||
|
||||
onUnload: function () {
|
||||
if (this.data.state === 'scanning' && !this._completed) {
|
||||
ble.stopTreatment().catch(function () {})
|
||||
}
|
||||
this._cleanup()
|
||||
}
|
||||
})
|
||||
|
||||
在新工单中引用
屏蔽一个用户