diff --git a/app/src/main/java/com/medithings/vesiscan/ui/views/monitoring/PiezoMonitoringView.kt b/app/src/main/java/com/medithings/vesiscan/ui/views/monitoring/PiezoMonitoringView.kt index 449c7f5..41dbdc7 100644 --- a/app/src/main/java/com/medithings/vesiscan/ui/views/monitoring/PiezoMonitoringView.kt +++ b/app/src/main/java/com/medithings/vesiscan/ui/views/monitoring/PiezoMonitoringView.kt @@ -779,9 +779,19 @@ fun PiezoMonitoringView(appState: AppState) { val isWalkingNow = walkSnap.isWalking // Composite posture — WALKING 이 UNKNOWN/NON_LYING 보다 우선 (자체 게이트 신뢰) + // 2026-07-03: acc gate 실패 (UNKNOWN) 시 tilt 로 tentative LYING/NON_LYING 결정. + // 왜: 걷기 임팩트로 acc mag > 1.2g → UNKNOWN → 걷는 초반 6초 (walking hold) + // 내내 "감지중" chip 이 뜨고, 그 후 갑자기 "걷는중" 으로 점프. + // tilt(=r.pitchDeg) 는 acc gate 와 무관하게 항상 계산되며, 걷기 중에도 + // 평균 tilt 는 유효 → 최소한 upright 여부 (NON_LYING vs LYING) 는 신뢰 가능. + // Walking 6초 build-up 동안 chip 은 "일어서 있음" (NON_LYING) → 6초 뒤 "걷는중" + // 으로 자연스럽게 전이 (감지중 flash 제거). + val tiltFallback = if (kotlin.math.abs(r.pitchDeg) > com.medithings.vesiscan.managers.GreenZoneConstants.pitchLyingThreshold) + com.medithings.vesiscan.managers.Posture.NON_LYING + else com.medithings.vesiscan.managers.Posture.LYING val composite = when { isWalkingNow -> com.medithings.vesiscan.managers.Posture.WALKING - r.posture == com.medithings.vesiscan.managers.Posture.UNKNOWN -> com.medithings.vesiscan.managers.Posture.UNKNOWN + r.posture == com.medithings.vesiscan.managers.Posture.UNKNOWN -> tiltFallback else -> r.posture // LYING or NON_LYING }