feat(detection): 데모 METHOD_D dispatch — 사용자앱 (d354a61) 동기화

DetectionMethod.METHOD_D enum 추가 + when 분기 + UI 4-버튼.
detection + BV 둘 다 Method D 가능. appshare Python pipeline 일치.

- enum DetectionMethod: METHOD_C → +METHOD_D
- when (method) METHOD_D 분기: MethodDRunner.detectMultichannel → allWalls
- BV path: detectionIsMethodD 일 때 recompute 생략
- Dev panel Detection toggle 3-button → 4-button (D 보라색)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-06-30 15:17:18 +09:00
parent b2546d14ca
commit a2d111dc5d
2 changed files with 25 additions and 5 deletions
@@ -12,7 +12,7 @@ package com.example.medilightv2android.managers
* ⚠ 미세 조정 시 이 파일만 수정하면 전체 파이프라인에 반영됨.
* 각 상수의 의미와 영향 범위를 아래 주석 참고.
*/
enum class DetectionMethod { METHOD_A, METHOD_B, METHOD_C }
enum class DetectionMethod { METHOD_A, METHOD_B, METHOD_C, METHOD_D }
enum class PlacementGuideMode { SIMPLE, BOUNDARY, SWEEP }
/**
* BV 계산 방법.
@@ -407,6 +407,23 @@ fun PiezoMonitoringView(appState: AppState) {
if (ch.isValid && ch.result != null) Log.d("PiezoMonitor", " CH${ch.channel}[A]: ant=${ch.result.ant} post=${ch.result.post} urine=${ch.result.urineLen}")
}
}
com.example.medilightv2android.managers.DetectionMethod.METHOD_D -> {
// 2026-06-30: Detection + BV 통합. MethodDRunner 로 6채널 raw → walls.
methodLabel = "D"
val signals = (0..5).map { ch ->
val cd = channels.find { it.channel == ch }
cd?.buffer?.map { it.toDouble() }?.toDoubleArray() ?: DoubleArray(0)
}
val dets = com.example.medilightv2android.walldetect.MethodDRunner
.detectMultichannel(signals)
for (i in 0..5) {
val r = dets.getOrNull(i)
if (r != null) allWalls[i] = Pair(r.ant, r.post)
}
dets.forEachIndexed { i, r ->
if (r != null) Log.d("PiezoMonitor", " CH$i[D]: ant=${r.ant} post=${r.post} urine=${r.urineLen}")
}
}
else -> {
methodLabel = "B"
val channelResults = analyzer.analyzeMultiChannelWithTgc(validChannels)
@@ -453,9 +470,11 @@ fun PiezoMonitoringView(appState: AppState) {
com.example.medilightv2android.managers.PiezoHW.distancePerSample).toInt()
else 0
// 2026-06-30 (사용자앱 동기화): BvMethod.METHOD_D 선택 시 Method D walls 사용.
// 2026-06-30: BvMethod.METHOD_D 시 Method D walls 사용. 단 detection 이
// 이미 METHOD_D 면 allWalls 가 곧 Method D → recompute 생략.
val useMethodDBv = bvMethodSetting == com.example.medilightv2android.managers.BvMethod.METHOD_D
val sourceAllWalls: List<Pair<Int, Int>?> = if (useMethodDBv) {
val detectionIsMethodD = method == com.example.medilightv2android.managers.DetectionMethod.METHOD_D
val sourceAllWalls: List<Pair<Int, Int>?> = if (useMethodDBv && !detectionIsMethodD) {
val signals = (0..5).map { ch ->
val cd = channels.find { it.channel == ch }
cd?.buffer?.map { it.toDouble() }?.toDoubleArray() ?: DoubleArray(0)
@@ -1829,9 +1848,10 @@ fun PiezoMonitoringView(appState: AppState) {
val methods = listOf(
com.example.medilightv2android.managers.DetectionMethod.METHOD_A to "A",
com.example.medilightv2android.managers.DetectionMethod.METHOD_B to "B",
com.example.medilightv2android.managers.DetectionMethod.METHOD_C to "C"
com.example.medilightv2android.managers.DetectionMethod.METHOD_C to "C",
com.example.medilightv2android.managers.DetectionMethod.METHOD_D to "D"
)
val colors = listOf(Color(0xFF9C27B0), MlPrimary, Color(0xFFFF5722))
val colors = listOf(Color(0xFF9C27B0), MlPrimary, Color(0xFFFF5722), Color(0xFF7C3AED))
Row(horizontalArrangement = Arrangement.spacedBy(4.dp)) {
methods.forEachIndexed { idx, (m, label) ->
val sel = selectedMethod == m