fix: maa 1초 throttle — BLE 계층에서 이중 전송 물리 차단

handler.post로 isMeasuring 갱신해도 Compose state 레이스 해결 안 됨.
BleManager에서 lastMaaSentMs 타임스탬프로 1초 이내 재전송 무조건 차단.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-08 12:27:58 +09:00
parent 54bca199af
commit 414ce940a2
@@ -396,6 +396,13 @@ class BleManager private constructor(private val context: Context) {
}
fun sendAllChannels(mode: Int = 0) {
val now = System.currentTimeMillis()
if (now - lastMaaSentMs < 1000) {
android.util.Log.w("BleManager", "maa THROTTLED — ${now - lastMaaSentMs}ms since last")
debugLogger.warn("maa THROTTLED ${now - lastMaaSentMs}ms")
return
}
lastMaaSentMs = now
piezoCollector.startMultiChannel(6)
sendRaw(CRC16.buildCommandASCII("maa", " "))
}
@@ -446,8 +453,16 @@ class BleManager private constructor(private val context: Context) {
sendRaw(CRC16.buildCommandASCII("mbb", " "))
}
/** 6채널 측정만 (maa) */
/** 6채널 측정만 (maa) — 최소 1초 간격 throttle */
private var lastMaaSentMs = 0L
fun sendChannelsOnly() {
val now = System.currentTimeMillis()
if (now - lastMaaSentMs < 1000) {
android.util.Log.w("BleManager", "maa THROTTLED — ${now - lastMaaSentMs}ms since last")
debugLogger.warn("maa THROTTLED ${now - lastMaaSentMs}ms")
return
}
lastMaaSentMs = now
piezoCollector.startMultiChannel(6)
sendRaw(CRC16.buildCommandASCII("maa", " "))
}