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 edf1084..290125a 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 @@ -435,9 +435,12 @@ fun PiezoMonitoringView(appState: AppState) { lastMaxUpdateMs = nowMs } - if (lastVolumeMl > 0 && !isSpotInProgress) { + // bladderLevel(=urgency=도넛 색깔)은 도넛 표시값과 동일하게 maxVolumeMl(세션 최대) 기준. + // lastVolumeMl 기반으로 두면 auto scan trimmed mean이 max보다 낮을 때 색깔만 초록색으로 + // 떨어지고 표시값(309)은 그대로 유지되는 불일치 발생. + if (maxVolumeMl > 0 && !isSpotInProgress) { val maxVol = appState.piezoSettings.maxVolume.toDouble() - val pct = if (maxVol > 0) (lastVolumeMl / maxVol).coerceAtMost(1.0) else 0.0 + val pct = if (maxVol > 0) (maxVolumeMl / 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) }