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
这个提交包含在:
@@ -1,45 +1,51 @@
|
||||
<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">{{scanning ? '正在采集数据 (' + spectrumIndex + '/4)...' : '扫描完成'}}</view>
|
||||
<view class="page-header-title">智能检测</view>
|
||||
<view class="page-header-subtitle">{{state === 'ready' ? '准备就绪' : state === 'scanning' ? '检测中 (' + frameCount + '帧)...' : '检测完成'}}</view>
|
||||
</view>
|
||||
|
||||
<view class="page-content">
|
||||
<view class="scan-container" wx:if="{{scanning}}">
|
||||
<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">固件序贯扫描中:红光 → 紫外光 → 黄光 → 红外光</view>
|
||||
<!-- 待开始 -->
|
||||
<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 class="scan-result" wx:if="{{!scanning && spectrumData.length > 0}}">
|
||||
<view class="spectrum-group" wx:for="{{spectrumData}}" wx:key="name">
|
||||
<view class="spectrum-title">{{item.name}} (第{{index + 1}}组)</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="{{item.items}}" wx:for-item="pd" wx:key="label">
|
||||
<view class="pd-region">{{pd.label}}</view>
|
||||
<view class="pd-value">{{pd.value}}</view>
|
||||
<view class="pd-bar-bg" wx:if="{{pd.value > 0}}">
|
||||
<view class="pd-bar-fill" style="width: {{pd.barWidth}}%"></view>
|
||||
<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>
|
||||
<view class="vbat-info" wx:if="{{vbat > 0}}">
|
||||
电池电压: {{vbat}}mV ({{battery}}%)
|
||||
</view>
|
||||
<button class="btn-primary mt-30" bindtap="onNext">开始使用</button>
|
||||
</view>
|
||||
|
||||
<view class="scan-result" wx:if="{{!scanning && spectrumData.length === 0 && !error}}">
|
||||
<view class="empty-hint">未收到扫描数据</view>
|
||||
</view>
|
||||
|
||||
<view class="scan-error" wx:if="{{!scanning && error}}">{{error}}</view>
|
||||
|
||||
<button class="btn-primary mt-30" wx:if="{{!scanning}}" bindtap="onNext">下一步</button>
|
||||
<view class="scan-error" wx:if="{{error}}">{{error}}</view>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
在新工单中引用
屏蔽一个用户