fix: maa 이중 전송 방지 (BV_FAIL 근본 원인)
- isMeasuring=false를 handler.post로 메인 스레드 갱신 (Thread 내 설정 → Compose state 지연 → 다음 measure() 통과 → maa 이중 전송) - measure() 진입 시 isMeasuring 가드 추가 (중복 호출 방어) - 채널 수신 로그 추가 (RECEIVED N channels) - MTU 247 negotiation 추가 (reb: 208B 분할 전송 최소화) - Spot 6ch 필터 추가 (allChannelsReceived) - Auto Stop 시 값 유지 (재계산 안 함) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -701,7 +701,11 @@ class BleManager private constructor(private val context: Context) {
|
||||
.apply()
|
||||
} catch (_: Exception) {}
|
||||
|
||||
gatt.discoverServices()
|
||||
// MTU 247 요청 (reb: 208B 패킷 드롭 방지)
|
||||
// onMtuChanged 콜백에서 discoverServices 호출
|
||||
if (!gatt.requestMtu(247)) {
|
||||
gatt.discoverServices() // MTU 요청 실패 시 바로 진행
|
||||
}
|
||||
onConnectionStateChanged?.invoke(true)
|
||||
}
|
||||
BluetoothProfile.STATE_DISCONNECTED -> {
|
||||
@@ -732,6 +736,12 @@ class BleManager private constructor(private val context: Context) {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onMtuChanged(gatt: BluetoothGatt, mtu: Int, status: Int) {
|
||||
logd { "MTU changed: $mtu (status=$status)" }
|
||||
handler.post { debugLogger.info("MTU=$mtu") }
|
||||
gatt.discoverServices()
|
||||
}
|
||||
|
||||
override fun onServicesDiscovered(gatt: BluetoothGatt, status: Int) {
|
||||
logd { "onServicesDiscovered: status=$status" }
|
||||
if (status != BluetoothGatt.GATT_SUCCESS) {
|
||||
|
||||
Reference in New Issue
Block a user