- 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
52 行
2.1 KiB
Plaintext
52 行
2.1 KiB
Plaintext
<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>
|