fix(posture): IMU polling 을 msp → mtb 로 변경 (alignment 명령 우회)

증상: msp 명령이 펌웨어에서 rsp: 응답 안 보내는 듯 — adb logcat 에 rsp/POSTURE
      로그 한 줄도 안 보임. msp 자체가 작동 안 함.

수정: msp 대신 mtb (alignment 모드, rim: 응답 보장) 로 polling.

  PiezoPacketCollector:
    var skipNextComplete: Boolean = false 추가
    raa: complete 시 skipNextComplete 가 true 면 onComplete invoke 건너뛰고
    flag reset. 자동 1회 use.

  PiezoMonitoringView LaunchedEffect:
    - msp(5초) → mtb(10초) 로 전환
    - mtb 전에 piezoCollector.skipNextComplete = true 설정 → user 의
      측정 callback 가 posture poll 때문에 spurious fire 되는 거 차단
    - sendMtb() throttled 면 (canSendMaa fail) flag rollback
    - 측정 중 (isMeasuring/isAutoMeasuring/isSpotInProgress) 일 땐 skip
      → 사용자 측정과 충돌 방지

trade-off: BLE 트래픽 ↑ (10초마다 mtb = piezo 6ch + IMU). msp 보다 무거움.
          하지만 msp 미작동이라 다른 선택지 없음.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-06-23 15:04:06 +09:00
parent 33b072c336
commit a17c6dac69
2 changed files with 23 additions and 7 deletions
@@ -43,6 +43,9 @@ class PiezoPacketCollector {
// Callbacks
var onComplete: ((PiezoEchoResult) -> Unit)? = null
var onMultiChannelComplete: ((List<PiezoChannelData>) -> Unit)? = null
/** true 면 다음 onMultiChannelComplete 1회 skip (자동 reset).
* posture polling 으로 mtb 보낼 때 측정 callback 가 spurious fire 되는 거 차단용. */
var skipNextComplete: Boolean = false
var onLog: ((String) -> Unit)? = null
private var recursionDepth = 0
@@ -228,7 +231,12 @@ class PiezoPacketCollector {
else -> {
val validChannels = channelResults.filterNotNull()
onLog?.invoke("raa: session=$currentSetSession complete — ${validChannels.size} channels")
onMultiChannelComplete?.invoke(validChannels)
if (skipNextComplete) {
skipNextComplete = false
onLog?.invoke("raa: skip onComplete (posture poll)")
} else {
onMultiChannelComplete?.invoke(validChannels)
}
}
}
// 다음 set을 위해 reset (isMultiChannel/onComplete 등 유지)