fix: Auto Stop 최종 trimmedMean 반영 + Placement 채널소실 멘트

- Auto Stop 시 윈도우 전체 trimmed mean 계산 후 표시
- LATERAL/GREEN 중 center 채널 소실 → "Start over from above the pubic bone"

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-07 18:04:24 +09:00
parent e5b252b314
commit b1ca5bfd66
2 changed files with 14 additions and 3 deletions
@@ -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()
}
@@ -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)
}