From 7a2abfa65b3d96537f0e757b4c6df9160ddb2285 Mon Sep 17 00:00:00 2001 From: jjangddu Date: Fri, 3 Jul 2026 10:57:55 +0900 Subject: [PATCH] =?UTF-8?q?fix(ble):=20=EA=B8=B0=EA=B8=B0=20=EC=9D=91?= =?UTF-8?q?=EB=8B=B5=20=EC=97=86=EC=9D=8C=20=EB=B0=B0=EB=84=88=20tolerance?= =?UTF-8?q?=205=E2=86=9212=EC=B4=88=20(=ED=9D=94=EB=93=A4=EB=A6=BC=20false?= =?UTF-8?q?=20positive=20=EC=B0=A8=EB=8B=A8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## 문제 기기를 흔들면 "감지중" (posture UNKNOWN) 후 "기기 응답 없음" 배너 flap. ## 원인 FirmwareWarningBanner 의 deviceAlive 기준이 5초로 너무 타이트: 1. 흔들면 BLE 안테나 wobbling → 짧은 disconnect 2. onConnectionStateChange → firmwareVersion.value = "" reset 3. 재연결 후 mid/mfv 재요청 응답 지연 → 8초 후 timedOut=true 4. 동시에 mim? 응답 몇 개 놓쳐 5초 초과 → deviceAlive=false 5. showTimedOut = timedOut && !deviceAlive → 배너 표시 ## 수정 deviceAlive 5→12초. Watchdog 자체가 15초 timeout 이라, 12초 내 재개되는 transient 스톨은 배너로 알리지 않고 조용히 대기. 진짜 disconnect 는 watchdog 이 처리. ## 참고 "감지중" (posture UNKNOWN) 은 acc mag > 1.2g 정상 동작 (흔들 때 acc gate 초과 → classifier UNKNOWN). 이미 3연속 hysteresis 있어 순간 튐엔 반응 X. 수정 대상 아님. Co-Authored-By: Claude Opus 4.7 --- .../vesiscan/ui/components/FirmwareWarningBanner.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/medithings/vesiscan/ui/components/FirmwareWarningBanner.kt b/app/src/main/java/com/medithings/vesiscan/ui/components/FirmwareWarningBanner.kt index d00d3a7..2204273 100644 --- a/app/src/main/java/com/medithings/vesiscan/ui/components/FirmwareWarningBanner.kt +++ b/app/src/main/java/com/medithings/vesiscan/ui/components/FirmwareWarningBanner.kt @@ -69,8 +69,11 @@ fun FirmwareWarningBanner(bleManager: BleManager, modifier: Modifier = Modifier) } } @Suppress("UNUSED_EXPRESSION") tick - // 최근 5초 내 BLE 데이터 수신 있으면 기기 alive — "기기 응답 없음" false positive 차단. - val deviceAlive = lastRxAt > 0 && (System.currentTimeMillis() - lastRxAt) < 5_000 + // 최근 12초 내 BLE 데이터 수신 있으면 기기 alive — "기기 응답 없음" false positive 차단. + // 2026-07-03: 5→12초 완화. 기기를 흔들 때 BLE 안테나 wobbling 으로 3~5초 응답 스톨 시 + // 재연결 → firmwareVersion reset → 8초 후 timedOut → 배너 flap 현상. + // Watchdog 15초 timeout 이 진짜 disconnect 판정하므로 12초까지는 조용히 대기. + val deviceAlive = lastRxAt > 0 && (System.currentTimeMillis() - lastRxAt) < 12_000 val outdated = bleManager.isFirmwareOutdated val showTimedOut = timedOut && !deviceAlive