From 0185d55f4be4e0e4cab4e18e7c7b8f162a8db5bb Mon Sep 17 00:00:00 2001 From: jjangddu Date: Thu, 4 Jun 2026 12:39:55 +0900 Subject: [PATCH] =?UTF-8?q?PiezoMonitoring=20fix:=20=EB=8F=84=EB=84=9B=20?= =?UTF-8?q?=EC=83=89=EA=B9=94(urgency)=EC=9D=84=20=ED=91=9C=EC=8B=9C?= =?UTF-8?q?=EA=B0=92=EA=B3=BC=20=EB=8F=99=EC=9D=BC=ED=95=9C=20maxVolumeMl?= =?UTF-8?q?=20=EA=B8=B0=EC=A4=80=EC=9C=BC=EB=A1=9C=20=ED=86=B5=EC=9D=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 증상: Single scan 309ml(노란색) 후 Auto scan에서 trimmed mean 280s가 잡히면 도넛 표시값은 maxVolumeMl=309로 유지되는데 색깔만 초록색으로 떨어지는 불일치. 원인: 도넛 progress/표시값은 maxVolumeMl(세션 최대) 기준이고 PiezoMonitoringView 1098 코멘트도 그렇게 명시하는데, bladderLevel.currentLevel(=urgency=색깔)만 lastVolumeMl(가장 최근 trimmed mean) 기반으로 업데이트되어 source mismatch. 수정: bladderLevel 업데이트도 maxVolumeMl 기반으로 통일. 한 번 도달한 충만도 색깔은 auto scan 노이즈로 인한 작은 측정값 변동에 영향받지 않고 유지됨. resetLevel(카테터 처치) / 화면 재진입 시에만 초기화되는 기존 동작은 유지. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../ui/views/monitoring/PiezoMonitoringView.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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) }