diff --git a/miniprogram/services/ble/protocol.js b/miniprogram/services/ble/protocol.js index 892c6a1..08b62ff 100644 --- a/miniprogram/services/ble/protocol.js +++ b/miniprogram/services/ble/protocol.js @@ -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,