fix(ble): treat Byte17 != 0 as fitting-ok (matches firmware semantics)
Firmware reports fitting via 'Byte17 != 0', not a dedicated bit — during scan Byte17 carries the wave marker (0x20/0x40/0x60/0x80), all non-zero, so it also signals fitting-ok. The old 'byte17 & 0x1F == 1' test never matched (low 5 bits are 0 when the wave marker occupies the high 3), so auto-scan waited forever on fitting==1 and then mis-fired '未贴合失败'. Verified against real-device frames: scan now collects and buckets all four wavelengths.
这个提交包含在:
@@ -251,7 +251,9 @@ function parseVendorStatus(buffer) {
|
|||||||
for (var p = 0; p < 7; p++) {
|
for (var p = 0; p < 7; p++) {
|
||||||
pds19.push(bytes[p * 2] | (bytes[p * 2 + 1] << 8))
|
pds19.push(bytes[p * 2] | (bytes[p * 2 + 1] << 8))
|
||||||
}
|
}
|
||||||
// Byte17 复用:低位=贴合状态(0/1),高三位=扫描时光色指示(0 表示无标识/非扫描态或旧固件)。
|
// Byte17 复用:固件约定「非 0 即贴合通过」;高三位另表扫描光色(001红/010红外/011紫外/100暖黄)。
|
||||||
|
// 扫描态 Byte17 = 0x20/0x40/0x60/0x80(有光色→非0→贴合);检测启动但未贴合时 = 0。
|
||||||
|
// 注意:贴合与光色共用一字节,固件当前无独立贴合位(已反馈,待其拆分)。
|
||||||
// Byte18 运行状态:0=IDLE 1=检测 2=治疗 0xFF=故障。
|
// Byte18 运行状态:0=IDLE 1=检测 2=治疗 0xFF=故障。
|
||||||
var scanWaveCode = (bytes[16] >> 5) & 0x07
|
var scanWaveCode = (bytes[16] >> 5) & 0x07
|
||||||
return {
|
return {
|
||||||
@@ -259,7 +261,7 @@ function parseVendorStatus(buffer) {
|
|||||||
is_heartbeat: false,
|
is_heartbeat: false,
|
||||||
pd: pds19,
|
pd: pds19,
|
||||||
vbat: bytes[14] | (bytes[15] << 8),
|
vbat: bytes[14] | (bytes[15] << 8),
|
||||||
fitting: bytes[16] & 0x1F,
|
fitting: bytes[16] !== 0 ? 1 : 0,
|
||||||
scan_wave: SCAN_WAVE_KEY[scanWaveCode] || null,
|
scan_wave: SCAN_WAVE_KEY[scanWaveCode] || null,
|
||||||
run_state: bytes[17],
|
run_state: bytes[17],
|
||||||
is_fault: bytes[17] === 0xFF,
|
is_fault: bytes[17] === 0xFF,
|
||||||
|
|||||||
在新工单中引用
屏蔽一个用户