文件
jw-beauty/miniprogram/pages/auto-scan/auto-scan.wxml
T
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

52 行
2.1 KiB
Plaintext
原始文件 Blame 文件历史

此文件含有模棱两可的 Unicode 字符
此文件含有可能会与其他字符混淆的 Unicode 字符。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。
<view class="page">
<view class="page-header page-header-pink" style="padding-top: {{statusBarHeight + 24}}px;">
<view class="nav-back" bindtap="onBack"> 返回</view>
<view class="page-header-title">智能检测</view>
<view class="page-header-subtitle">{{state === 'ready' ? '准备就绪' : state === 'scanning' ? '检测中 (' + frameCount + '帧)...' : '检测完成'}}</view>
</view>
<view class="page-content">
<!-- 待开始 -->
<view wx:if="{{state === 'ready'}}">
<view class="scan-hint">设备已佩戴,点击下方按钮开始智能检测</view>
<view class="scan-hint sub-hint">检测过程中请保持设备贴合</view>
<button class="btn-primary mt-30" bindtap="onStartScan">开始检测</button>
</view>
<!-- 检测中 -->
<view wx:if="{{state === 'scanning'}}">
<view class="scan-container">
<view class="face-outline">
<view class="scan-line"></view>
</view>
<view class="scan-progress-bar">
<view class="scan-progress-fill" style="width: {{scanProgress}}%"></view>
</view>
<view class="scan-status">正在采集数据,已收到 {{frameCount}} 帧...</view>
</view>
</view>
<!-- 检测完成 -->
<view wx:if="{{state === 'done'}}">
<view class="scan-result">
<view class="result-title">PD 平均值 (共 {{frameCount}} 帧)</view>
<view class="pd-list">
<view class="pd-item" wx:for="{{pdAvg}}" wx:key="*this">
<view class="pd-region">PD{{index + 1}}</view>
<view class="pd-value">{{item}}</view>
<view class="pd-bar-bg" wx:if="{{item > 0}}">
<view class="pd-bar-fill" style="width: {{item > 4095 ? 100 : item / 40.95}}%"></view>
</view>
</view>
</view>
<view class="vbat-info" wx:if="{{vbat > 0}}">
电池电压: {{vbat}}mV ({{battery}}%)
</view>
</view>
<button class="btn-primary mt-30" bindtap="onNext">开始使用</button>
</view>
<view class="scan-error" wx:if="{{error}}">{{error}}</view>
</view>
</view>