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