fix(posture): PlacementGuide / ClinicalLive DisposableEffect 정리도 제거

149e511 이후에도 사용자 실기 테스트에서 posture chip '감지 중' 지속.
Logcat 확인:
- LaunchedEffect start ✅
- rim: 15 samples parsed 매 초 정상 ✅
- POSTURE 로그 여전히 실종

원인: 149e511 은 PiezoMonitoringView 의 DisposableEffect 만 수정했으나
PlacementGuideView (line 173) / ClinicalLiveView (line 131) 에도
`imuCollector.onComplete = null` 이 있어, Compose 재구성 timing 에서
PiezoMonitoring 콜백 세팅 직후 이들의 onDispose 가 실행되면 여전히
null 로 덮임.

수정:
세 곳 모두 imuCollector.onComplete / piezoCollector.onMultiChannelComplete
null 정리를 제거. 다음 화면 진입 시 자기 LaunchedEffect 가 어차피
자기 콜백으로 덮어쓰므로 stale 콜백 실질 무해.
PlacementGuide 의 sendLedMode(0) 는 그대로 유지 (LED 실제 하드웨어 조작).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-07-07 17:32:20 +09:00
parent cdd8676a1d
commit b7aa8f73c2
2 changed files with 7 additions and 8 deletions
@@ -127,8 +127,8 @@ fun ClinicalLiveView(appState: AppState) {
pendingPiezo = null pendingPiezo = null
} }
onDispose { onDispose {
bleManager.piezoCollector.onMultiChannelComplete = null // 2026-07-07 fix: null 정리 제거 (PiezoMonitoringView posture chip stuck 이슈).
bleManager.imuCollector.onComplete = null // 다음 화면 진입 시 자기 콜백으로 어차피 덮어쓰므로 stale 콜백 무해.
} }
} }
@@ -162,15 +162,14 @@ fun PlacementGuideView(appState: AppState) {
sweepLastDetected = 0; sweepEverSawAll = false sweepLastDetected = 0; sweepEverSawAll = false
} }
// 화면 벗어날 때 LED OFF + 콜백 정리. // 화면 벗어날 때 LED OFF.
// 2026-07-07 fix: piezoCollector.onMultiChannelComplete / imuCollector.onComplete 는 // 2026-07-07 fix: imuCollector.onComplete / piezoCollector.onMultiChannelComplete
// PlacementGuide 진입 시 자기 콜백으로 덮어쓰는데, 이탈 시 정리하지 않으면 다음 // null 정리 제거. Compose 재구성 timing 문제로 PiezoMonitoringView 콜백 세팅 직후
// 화면 (PiezoMonitoring 등) 의 콜백과 stale reference 가 뒤엉킴. // 여기 onDispose 가 실행되어 null 로 덮어써 posture "감지 중" 무한 유지 발생.
// 다음 화면 진입 시 자기 LaunchedEffect 가 어차피 자기 콜백으로 덮어씀.
androidx.compose.runtime.DisposableEffect(Unit) { androidx.compose.runtime.DisposableEffect(Unit) {
onDispose { onDispose {
bleManager.sendLedMode(0) bleManager.sendLedMode(0)
bleManager.piezoCollector.onMultiChannelComplete = null
bleManager.imuCollector.onComplete = null
} }
} }