fix: Spot 측정 mbb→maa 복원 (rbb 헤더가 collector 혼동 유발)
mbb 응답(rbb:→reb:×6→raa:)에서 rbb: 헤더가 piezoCollector를 혼동시켜 그래프가 안 뜨는 문제 발생. - Spot 단일 측정: sendChannelsOnly(maa) 사용 - 자동 측정 10초째: measure()→maa 사용 (mbb는 파싱 검증 후 전환) - IMU 전송 시 isMeasuring 체크 추가 (측정 중 충돌 방지) - sendChannelsOnly() 함수 추가 (기존 sendAllChannels와 동일) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -367,6 +367,12 @@ class BleManager private constructor(private val context: Context) {
|
||||
sendRaw(CRC16.buildCommand("mbb"))
|
||||
}
|
||||
|
||||
/** 6채널 측정만 (maa, rbb 헤더 없이 바로 reb×6→raa) */
|
||||
fun sendChannelsOnly() {
|
||||
piezoCollector.startMultiChannel(6)
|
||||
sendRaw(CRC16.buildCommand("maa", intArrayOf(0)))
|
||||
}
|
||||
|
||||
fun startBatteryPolling() {
|
||||
batteryTimer?.let { handler.removeCallbacks(it) }
|
||||
sendBatteryQuery()
|
||||
|
||||
+4
-4
@@ -181,7 +181,7 @@ fun PiezoMonitoringView(appState: AppState) {
|
||||
}
|
||||
bleManager.piezoCollector.onLog = { msg -> Log.d("PiezoCollector", msg) }
|
||||
|
||||
bleManager.sendFullMeasurement()
|
||||
bleManager.sendChannelsOnly()
|
||||
|
||||
// Timeout with auto-retry (15s)
|
||||
handler.postDelayed({
|
||||
@@ -190,7 +190,7 @@ fun PiezoMonitoringView(appState: AppState) {
|
||||
measureRetryCount++
|
||||
Log.w("PiezoMonitor", "Timeout — auto-retry $measureRetryCount/$maxMeasureRetries")
|
||||
bleManager.piezoCollector.reset()
|
||||
bleManager.sendFullMeasurement()
|
||||
bleManager.sendChannelsOnly()
|
||||
// Second timeout for retry
|
||||
handler.postDelayed({
|
||||
if (!isMeasuring) return@postDelayed
|
||||
@@ -236,11 +236,11 @@ fun PiezoMonitoringView(appState: AppState) {
|
||||
autoTickCount++
|
||||
|
||||
if (autoTickCount % 10 == 0) {
|
||||
// 10초째: 전체 측정 (mbb → rbb + reb×6 + raa)
|
||||
// 10초째: 6ch 측정
|
||||
if (!isMeasuring) measure()
|
||||
} else {
|
||||
// 1~9초: IMU 쿼리 (msp → rsp)
|
||||
bleManager.sendImuQuery()
|
||||
if (!isMeasuring) bleManager.sendImuQuery()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user