比较提交

..
1 次代码提交
作者 SHA1 备注 提交日期
Guoguo a9a1899b49 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.
2026-07-28 18:43:01 -07:00
+4 -2
查看文件
@@ -251,7 +251,9 @@ function parseVendorStatus(buffer) {
for (var p = 0; p < 7; p++) {
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=故障。
var scanWaveCode = (bytes[16] >> 5) & 0x07
return {
@@ -259,7 +261,7 @@ function parseVendorStatus(buffer) {
is_heartbeat: false,
pd: pds19,
vbat: bytes[14] | (bytes[15] << 8),
fitting: bytes[16] & 0x1F,
fitting: bytes[16] !== 0 ? 1 : 0,
scan_wave: SCAN_WAVE_KEY[scanWaveCode] || null,
run_state: bytes[17],
is_fault: bytes[17] === 0xFF,