提交图
157 次代码提交
作者 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
Guoguo edf15eb32a docs: fix stale region-layout comments to match measured mapping 2026-07-28 07:26:29 -07:00
Guoguo 21dccd2274 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
2026-07-28 07:22:36 -07:00
Guoguo 74b0c5fa86 feat(debug): temporary BLE debug page for on-device verification
- entry in profile menu, visible only while a device is connected
- live FFE4 readout: 7x PD, VBAT, fitting, scan wave marker, run state
- tap a face-map region to fire a 2s single-region treat command
  (verifies region-to-IO mapping on the physical mask)
- wavelength selector (red/ir/uv/yellow) to verify color byte order
- scan command / full-face 2s / stop buttons, hex log of every write
- intentionally not i18n'd; remove page before release
2026-07-28 06:58:03 -07:00
Guoguo c0de0b03a2 fix(ui): show manual care entry only when smart mode is selected 2026-07-28 06:47:36 -07:00
Guoguo 431d4058a8 feat(ui): use face-map layout for report zones and manual region picker; restrict manual care to smart mode
- scan-report: replace zone card grid with the same oval face-map layout as
  treatment-setup, zones tinted by recommended light with mode label; restore
  the per-light legend under the map
- manual-treatment: region picker now uses the same face-map layout
- manual care mode selection is smart-mode only: entry link hidden for
  non-subscribers and the page itself checks subscription (free mode passes
  since the backend reports it as active)
2026-07-28 06:44:34 -07:00
Guoguo 39177e5ff4 ui: 报告分区/手动区域选择改用「使用设置」同款卡片栅格布局(弃面罩大矩形);修复使用设置脸型图label-idx错位 2026-07-28 06:35:37 -07:00
Guoguo 9745b6d7b8 chore: 版本号 v0.2.0 → v0.2.1 2026-07-28 06:24:21 -07:00
Guoguo 88ca7dec6b feat: 治疗亮度全路径统一204(80%)——手动模式140与普通模式200一并对齐 2026-07-28 05:01:05 -07:00
Guoguo dff82a6a82 feat(diagnosis): 回填固件确认的PD区域映射(左PD1/中上PD2/中PD3,6,7/中下PD4/右PD5) 2026-07-28 04:58:48 -07:00
Guoguo a67a7357cf chore(sql): 增量迁移脚本 scan_reports建表+diagnosis_config新种子(幂等) 2026-07-28 04:48:24 -07:00
Guoguo 6b91ebe35d feat(diagnosis): 按新协议实现多光谱诊断算法+分区差异化下发+报告面罩图
- 新协议《协议简述-添加扫描时光色》落地: FFE4 Byte17 高3位=扫描光色(1红/2红外/3紫外/4暖黄),
  低5位保留贴合状态; Byte18=0xFF 故障; auto-scan 按光色分桶采集(旧固件无标识归 red 桶降级)
- diagnosis.js 重写: PD极性(值大=吸收多,固件已确认) NR=本区/本色5区平均-1;
  每区4色argmax>0.10判定; 3路PD区几何平均+MAD剔奇异(3σ对n=3失效,审计实证);
  严重度0.05/0.15/0.30仅展示; 全参数走 diagnosis_config 热调(极性/阈值/PD映射/亮度)
- buildVendorCommand 支持 plan 多区多色单命令下发(每IO独立 红/红外/紫外/暖黄);
  builder层安全硬上限 治疗亮度≤204(80%) 时长≤600s
- 区域映射修正: 掩码=IO纵列 左0x01/中上0x02/中0x04/中下0x08/右0x10,
  修复 treatment-setup/manual/treating/getRegionName/i18n 共7处标签错位, FULL_FACE 0x7F→0x1F
- 扫描报告页: 新增分区面罩示意图(5区按推荐光着色+模式名+严重度,点击跳光疗介绍),
  推荐护理改一条命令多色下发(亮度204); 扫描中设备故障即时中止
- schema.sql diagnosis_config 种子更新(新结构); i18n 清理死键,中英对齐25/24键
2026-07-28 04:36:51 -07:00
Guoguo b5416f56af chore: 版本号 v0.1.8 → v0.2.0 2026-07-19 06:12:35 -07:00
Guoguo 4466c53c7b feat(i18n): 剩余15页全量接入中英(登录/注册/扫码/绑定/佩戴/扫描/治疗/订阅/帮助等)
- 3 个并行 agent 各管 5 页,互不重叠命名空间
- 全 App 18 页均 i18n.bind,22 命名空间/400 键中英对齐
- 动态文案(时长/天数/价格/区域)JS 内 i18n.t 计算;区域标签复用 common.regions
2026-07-19 06:00:04 -07:00
Guoguo f5eaf05067 chore(i18n): 为剩余15页预建命名空间 stub 并注册(并行 retrofit 脚手架) 2026-07-19 05:45:09 -07:00
Guoguo 28c711cd00 fix: onPageNotFound 兜底防空页崩溃 + 首页/记录页接入 i18n(语言切换覆盖全部3个tab) 2026-07-19 05:31:19 -07:00
Guoguo 8e11b2da10 fix: 报告 device_id 用 ble.getDeviceId()(修 P2 空归属)+手动入口接入 i18n(P3) 2026-07-18 20:25:57 -07:00
Guoguo a7299708e2 feat(server): 扫描报告存储(scan_reports)+诊断阈值配置(diagnosis_config)+admin 编辑
- scan_reports 表+dao+3个报告接口(POST/latest/:id,requireUser)
- GET /treatment/diagnosis-config 下发实时阈值(免发版调参)
- admin SettingsView 加 diagnosis_config JSON 编辑器
- 注意: schema.sql 变更需手动 TencentDB 迁移
2026-07-18 20:17:09 -07:00
Guoguo f2ee086cc8 feat: 扫描报告页+手动选波长护理+光疗功效介绍页+诊断框架(占位阈值)
- services/diagnosis.js: 诊断流水线框架,阈值/PD映射为占位待标定,支持单波长降级
- auto-scan: 扫描完成改为出报告让用户选择护理(替代原自动开始治疗)
- 新增 scan-report/manual-treatment/light-info 三页,全部接入 i18n
- api.js: 新增 report/diagnosis-config 接口(对接后端契约)
2026-07-18 20:17:09 -07:00
Guoguo d8eb6677c6 feat(i18n): 中英文框架(命名空间字典+语言切换)+profile 接入参考+注册3个新页面 2026-07-18 20:07:13 -07:00
Guoguo cc5159ebb7 feat: hide trial/subscription text on bind-success when smart_mode_free 2026-07-02 06:43:09 -07:00
Guoguo cdc6348ac4 feat: hide subscription card and menu on profile page when smart_mode_free 2026-07-02 06:42:12 -07:00
Guoguo a53e6c521c feat: hide subscription entry on index page when smart_mode_free 2026-07-02 06:41:39 -07:00
Guoguo 5775568cd6 feat: add loading animation on reconnect button, 5s timeout 2026-07-02 06:06:11 -07:00
Guoguo dae50a74fd fix: remove scan duration hint text from auto-scan page 2026-07-02 06:05:29 -07:00
Guoguo 0341e62726 feat: add smart_mode_free toggle — all users get smart mode when enabled
Server: subscription API returns active when smart_mode_free is true.
Admin console: add toggle switch in settings page under feature flags.
Default: true (free for all users during promotion period).
2026-07-02 06:05:04 -07:00
Guoguo 94c9af146a chore: bump version to v0.1.8 2026-07-01 05:43:36 -07:00
Guoguo 784af52b7a fix: require seenRunState1 before judging fitting failure, prevent initial frame false trigger 2026-07-01 05:34:05 -07:00
Guoguo 06e8c9831c fix: skip fitting/run_state monitoring in normal mode (mode=0) 2026-07-01 05:29:22 -07:00
Guoguo 515153f134 feat: auto-scan 3-phase state machine with proper PD collection timing
- Phase 1 (waiting_fit): after sending control=0x01, wait for fitting=1
- Phase 2 (collecting): once fitting=1 AND run_state=1, start PD accumulation
- Phase 3 (done): run_state 1→0, calculate averages, auto-send treatment
- Check start-collecting in BOTH fitting and run_state handlers
- fitting=0 + run_state 1→0 = fitting failure, prompt retry
- Timeout 3 minutes (was 30s), auto-start treatment on completion
2026-06-29 05:36:12 -07:00
Guoguo b7b76a675d chore: remove dead regions param from wear-check 2026-06-29 05:29:51 -07:00
Guoguo f85925ecd1 fix: correct page flow — wear-check before mode select, smart mode to auto-scan
- wear-check onNext → treatment-setup (was auto-scan)
- treatment-setup smart mode → auto-scan (was wear-check)
Flow: index → wear-check → treatment-setup → normal: treat / smart: auto-scan → treat
2026-06-29 05:28:05 -07:00
Guoguo 74591d4da2 fix: audit fixes — dedupe run_state logs, stop device on scan exit
- Only log run_state when value changes (avoid flooding console)
- Send stopTreatment on unload if scan is in progress (stop device LEDs)
2026-06-29 04:02:16 -07:00
Guoguo f5cd882986 feat: redesign auto-scan as detection page with manual trigger and PD averaging
- Add "start detection" button (not auto-start on page load)
- Send control=0x01 only when user clicks button
- Accumulate PD values across all ADC frames during scan
- Monitor run_state: wait for 0x01→0x00 transition as completion signal
- Calculate PD averages on completion
- Send treatment command (control=0x02) on "next" with calculated params
- TODO: plug in full NR diagnosis algorithm when PD→region mapping confirmed
2026-06-29 03:58:40 -07:00
Guoguo 2995b0ee02 fix: smart mode goes to wear-check first instead of directly to auto-scan 2026-06-29 03:57:31 -07:00
Guoguo f9141b25d0 refactor: wear-check is now pure manual confirm, no BLE commands
Remove all fitting detection logic (setParams, fitting event listener,
timeout). User manually confirms wearing, then proceeds to detection
page. No BLE commands sent on this page.
2026-06-29 03:57:05 -07:00
Guoguo 52f3ef971b fix: auto-scan onNext goes directly to treating instead of looping back to setup 2026-06-24 19:38:16 -07:00
Guoguo c5afce59d5 fix: restore fitting check control to 0x01 (scan/detect mode) 2026-06-24 18:55:27 -07:00
Guoguo 5cd3dc1e5d fix: fitting check uses control=IDLE to avoid triggering scan sequence 2026-06-24 18:49:17 -07:00
Guoguo bf83adcd28 chore: bump version to v0.1.7 2026-06-24 05:21:19 -07:00
Guoguo ec5b8584ec refactor: remove 17-byte FFE4 and 33-byte FFE1 legacy compat code
- Remove parseVendorStatus 17-byte branch (FFE4 is now 19 bytes)
- Remove parseVendorStatus 33-byte branch (FFE1 is now 34 bytes)
- Remove buildVendorCommand33 deprecated alias
- Remove fitting/run_state !== -1 guards in connection.js
- Update commands.js to use buildVendorCommand directly
2026-06-24 05:13:36 -07:00
Guoguo 29975c6043 fix: restore fitting timeout to 10s for hardware detection delay 2026-06-24 04:12:50 -07:00
Guoguo ca1b9b4377 debug: log FFE1 command hex on every writeRawCommand 2026-06-24 04:10:58 -07:00
Guoguo a5dacef4a7 debug: log stopTreatment success/failure on stop button 2026-06-24 03:53:31 -07:00
Guoguo 229e5f4ed5 fix: default gain to 0 instead of brightness per protocol examples 2026-06-24 03:16:19 -07:00
Guoguo da307e32c8 fix: reduce fitting timeout from 10s to 3s (firmware not yet reporting fitting) 2026-06-24 03:11:32 -07:00
Guoguo c6d958d2ea debug: log FFE4 frame length and type on receive 2026-06-24 02:31:23 -07:00
Guoguo 4c674e5c23 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
2026-06-22 06:28:25 -07:00
Guoguo c5a9e89bd9 feat: treating page monitors fitting/run_state and handles safety events
- Listen for 'fitting' event: detect skin detachment, pause on loss,
  resume on re-attach
- Listen for 'run_state' event: detect device fault (0xFF) and IDLE
  completion (0x00)
- Low battery warnings: toast at <=10%, force stop at <=5%
- Guard finishAsComplete against double-completion
- Proper cleanup of all new event listeners on unload
2026-06-22 06:21:59 -07:00
Guoguo f4e74e9460 feat: auto-scan receives 4 sequential ADC sets for multi-spectrum scan
Firmware does R→UV→Y→IR sequential scan autonomously. Miniprogram
now listens for 4 consecutive ADC notifications, storing each as a
separate spectrum group. Also listens for run_state=IDLE as scan
completion signal. Displays all 4 spectrum groups with PD1-PD7 bars.
Stores full scan data in globalData.lastScanData for diagnosis phase.
2026-06-22 06:20:53 -07:00