fix(mapping): correct region↔IO mapping per on-device measurement

Measured on real hardware: IO1=right IO2=left IO3=top IO4=middle IO5=bottom
(0x01=right 0x02=left 0x04=top 0x08=middle 0x10=bottom). The earlier verbal
'left=IO1/upper=IO2...' spec was wrong; this reverts to the original Phase-1
mapping, which the measurement confirms.

- protocol.js REGION constants + getRegionName + REGION_NAMES
- CRITICAL: buildVendorCommand ioMasks was built from REGION.* constants whose
  values just flipped, scrambling IO slot order; pin to literal [0x01..0x10]
- diagnosis.js REGION_DEFS key↔mask; pd_region_map values unchanged (PD is
  keyed by orientation, which is stable) — right=PD5 left=PD1 top=PD2
  middle=PD3,6,7 bottom=PD4
- common.js region labels back to right/left/top/middle/bottom (上/中/下)
- treatment-setup / manual-treatment / treating / scan-report / ble-debug
  face-map bindings and REGION_MAP realigned
- verified: mock pipeline lands left→IO2, middle→IO4 correctly
这个提交包含在:
Guoguo
2026-07-28 07:22:36 -07:00
父节点 74b0c5fa86
当前提交 21dccd2274
修改 11 个文件,包含 75 行新增73 行删除
+10 -10
查看文件
@@ -9,7 +9,7 @@
// PD ADC 值越大 = 反射光越弱 = 皮肤吸收越多。故 NR = zone/avg 1(吸收多→NR 高)。
// config.polarity = 'direct' 可切回"值大=光强"的旧假设(备用开关,标定时救急)。
//
// PD↔区域映射已由固件确认(2026-07-28,果果转达):左=PD1 上=PD2 中=PD3/6/7 下=PD4 右=PD5。
// PD↔区域映射果果转达):左=PD1 上=PD2 中=PD3/6/7 下=PD4 右=PD5(方位与实测 IO 表一致)
// 仍待定:3 路 PD 区的聚合——文档 7.1 自相矛盾(几何平均 vs 取最小),按更细的几何平均+MAD剔异常实现。
// 所有阈值/亮度/映射均可被服务端 diagnosis_config 覆盖,标定后免发版调参。
@@ -20,13 +20,13 @@ var WAVE_PROBLEM = { red: 'aging', uv: 'acne', yellow: 'pigment', ir: 'deep' }
// 波长 key -> 下发命令编码。
var WAVE_KEY_CODE = { red: 2, uv: 3, yellow: 4, ir: 1 }
// 5 区 = IO 纵列布局(果果定案):=IO1 中上=IO2 中=IO3=IO4 右=IO5
// 5 区 = IO↔物理位置(果果 2026-07-28 实测):=IO1(0x01) 左=IO2(0x02) 上=IO3(0x04) 中=IO4(0x08) 下=IO5(0x10)
var REGION_DEFS = [
{ key: 'left', mask: 0x01 },
{ key: 'top', mask: 0x02 },
{ key: 'middle', mask: 0x04 },
{ key: 'bottom', mask: 0x08 },
{ key: 'right', mask: 0x10 }
{ key: 'right', mask: 0x01 },
{ key: 'left', mask: 0x02 },
{ key: 'top', mask: 0x04 },
{ key: 'middle', mask: 0x08 },
{ key: 'bottom', mask: 0x10 }
]
var DEFAULT_CONFIG = {
@@ -35,8 +35,8 @@ var DEFAULT_CONFIG = {
th: 0.10, // 判定阈值(文档建议初始值,需临床标定)
severity: { low: 0.05, mid: 0.15, high: 0.30 }, // 轻/中/重分级,仅报告展示
brightness: 204, // 治疗强度 80%(果果定案),仅用于推荐方案下发
// PD↔区域映射(固件 2026-07-28 确认):左=PD1 上=PD2 中=PD3/6/7 下=PD4 右=PD5(下标 0 基)。
pd_region_map: { left: [0], top: [1], middle: [2, 5, 6], bottom: [3], right: [4] },
// PD↔区域映射(果果 2026-07-28 确认):左=PD1 上=PD2 中=PD3/6/7 下=PD4 右=PD5(下标 0 基)。
pd_region_map: { right: [4], left: [0], top: [1], middle: [2, 5, 6], bottom: [3] },
problem_wavelength: PROBLEM_WAVELENGTH
}
@@ -217,7 +217,7 @@ function mockReport() {
scanned_at: 0,
region_mask: 0x1F,
waves: {
// 下标: 0=PD1 1=中上PD2 2=PD3 3=中下PD4 4=PD5 5=PD6 6=PD7
// 下标: 0=PD1 1=PD2 2=PD3 3=PD4 4=PD5 5=PD6 6=PD7
red: [1350, 920, 900, 910, 905, 890, 940],
uv: [2050, 2020, 2600, 2010, 2080, 2560, 2620],
yellow: [1500, 1520, 1490, 1505, 1495, 1530, 1510],