From a2d111dc5dbfb1a3fdb58194e2ff613c4369e02b Mon Sep 17 00:00:00 2001 From: jjangddu Date: Tue, 30 Jun 2026 15:17:18 +0900 Subject: [PATCH] =?UTF-8?q?feat(detection):=20=EB=8D=B0=EB=AA=A8=20METHOD?= =?UTF-8?q?=5FD=20dispatch=20=E2=80=94=20=EC=82=AC=EC=9A=A9=EC=9E=90?= =?UTF-8?q?=EC=95=B1=20(d354a61)=20=EB=8F=99=EA=B8=B0=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../managers/GreenZoneConstants.kt | 2 +- .../views/monitoring/PiezoMonitoringView.kt | 28 ++++++++++++++++--- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/example/medilightv2android/managers/GreenZoneConstants.kt b/app/src/main/java/com/example/medilightv2android/managers/GreenZoneConstants.kt index 93b3f62..75d6757 100644 --- a/app/src/main/java/com/example/medilightv2android/managers/GreenZoneConstants.kt +++ b/app/src/main/java/com/example/medilightv2android/managers/GreenZoneConstants.kt @@ -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 계산 방법. diff --git a/app/src/main/java/com/example/medilightv2android/ui/views/monitoring/PiezoMonitoringView.kt b/app/src/main/java/com/example/medilightv2android/ui/views/monitoring/PiezoMonitoringView.kt index 578fa5e..ee32b4d 100644 --- a/app/src/main/java/com/example/medilightv2android/ui/views/monitoring/PiezoMonitoringView.kt +++ b/app/src/main/java/com/example/medilightv2android/ui/views/monitoring/PiezoMonitoringView.kt @@ -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?> = if (useMethodDBv) { + val detectionIsMethodD = method == com.example.medilightv2android.managers.DetectionMethod.METHOD_D + val sourceAllWalls: List?> = 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