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 5c2dbc8..e067388 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 @@ -379,6 +379,17 @@ fun PiezoMonitoringView(appState: AppState) { fun stopAutoMeasure() { isAutoMeasuring = false autoTickCount = 0 + // 종료 시 최종 trimmed mean 반영 + if (autoVolumeWindow.size >= 3) { + val finalVol = trimmedMean(autoVolumeWindow.toList()) + lastVolumeMl = finalVol + maxVolumeMl = maxOf(maxVolumeMl, finalVol) + val maxVol = appState.piezoSettings.maxVolume.toDouble() + val pct = if (maxVol > 0) (finalVol / maxVol).coerceAtMost(1.0) else 0.0 + val level = (pct * BladderLevel.MAX_LEVEL).toInt().coerceIn(1, BladderLevel.MAX_LEVEL) + appState.bladderLevel = appState.bladderLevel.copy(currentLevel = level) + Log.d("PiezoMonitor", "AUTO STOP finalTrimmedMean=${"%.1f".format(finalVol)}ml from ${autoVolumeWindow.size} samples") + } autoVolumeWindow.clear() } diff --git a/app/src/main/java/com/example/medilightv2android/ui/views/monitoring/PlacementGuideView.kt b/app/src/main/java/com/example/medilightv2android/ui/views/monitoring/PlacementGuideView.kt index 488108d..b0908b1 100644 --- a/app/src/main/java/com/example/medilightv2android/ui/views/monitoring/PlacementGuideView.kt +++ b/app/src/main/java/com/example/medilightv2android/ui/views/monitoring/PlacementGuideView.kt @@ -1286,9 +1286,9 @@ private fun computePlacementGuide( val ch4det = detected.getOrElse(4) { false } val ch5det = detected.getOrElse(5) { false } - // 상하 유지 확인 — gradient 재계산 + // 상하 유지 확인 — 좌우 이동 중 center 채널 소실 if (centerDetected < 2) { - return PlacementGuideResult("Readjust vertically", "arrow.up", 20, + return PlacementGuideResult("Start over from above the pubic bone", "arrow.up", 10, phase = PlacementPhase.LATERAL, nextPhase = PlacementPhase.VERTICAL) } @@ -1375,7 +1375,7 @@ private fun computePlacementGuide( } if (depths.size < 2) { - return PlacementGuideResult("Readjust position", "exclamationmark.triangle", 30, + return PlacementGuideResult("Start over from above the pubic bone", "arrow.up", 10, phase = PlacementPhase.GREEN, nextPhase = PlacementPhase.VERTICAL) }