fix: address audit findings — fitting trigger, race guards, state conflicts

wear-check:
- Send weak pulse light (brightness=26) to trigger FFE4 fitting report
- Timeout degrades to pass (backward compat with 17-byte firmware)
- Sync _resolved flag prevents double-resolve

treating:
- Only treat run_state=0x00 as completion after seeing run_state=0x02
  (prevents false completion on startup)
- Sync _finishing flag replaces async data.completed for race prevention
- onStatus preserves paused state during fitting loss (|| fittingLost)
- Remove dead _fittingTimer reference from onUnload

auto-scan:
- Sync _completed flag in _scanComplete prevents double-build
这个提交包含在:
Guoguo
2026-06-22 06:28:25 -07:00
父节点 c5a9e89bd9
当前提交 4c674e5c23
修改 3 个文件,包含 31 行新增8 行删除
+3
查看文件
@@ -43,6 +43,7 @@ Page({
startScan: function () {
var self = this
self._scanResults = []
self._completed = false
if (!ble.isConnected()) {
self.setData({ scanning: false, error: '设备未连接,请先连接设备' })
@@ -110,6 +111,8 @@ Page({
},
_scanComplete: function () {
if (this._completed) return
this._completed = true
this._cleanup()
this.setData({ scanning: false, scanProgress: 100 })
this._buildDisplay()