fix: BV 측정 최소 center 3채널 이상 요구 + 실패 시 사용자 안내
- center 채널 3개 미만이면 BV 계산 스킵 (신뢰도 부족 방지) - 1~2채널: "측정 부족 (N/4채널) — 센서 위치를 조절해주세요" - 0채널: "방광이 감지되지 않았습니다. 센서 접촉을 확인해주세요." - BleDebugLogger에 BV_SKIP/BV_FAIL 기록 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
+25
-11
@@ -120,25 +120,39 @@ fun PiezoMonitoringView(appState: AppState) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 6ch BV estimation (center 4ch + lateral lr_ratio)
|
// Count valid center channels (CH0~CH3)
|
||||||
val bvResult = estimateBladderVolume6ch(allWalls)
|
val centerWallCount = (0..3).count { allWalls[it] != null }
|
||||||
if (bvResult != null) {
|
val totalWallCount = allWalls.count { it != null }
|
||||||
lastVolumeMl = bvResult.volumeMl
|
|
||||||
maxVolumeMl = maxOf(maxVolumeMl, bvResult.volumeMl)
|
|
||||||
Log.d("PiezoMonitor", "BV: ${"%.1f".format(bvResult.volumeMl)}ml (6ch, lr=${
|
|
||||||
"%.2f".format(bvResult.lrRatio)}, ${bvResult.validChannels.size}ch)")
|
|
||||||
} else {
|
|
||||||
Log.d("PiezoMonitor", "BV: estimation failed (< 2 valid channels)")
|
|
||||||
}
|
|
||||||
|
|
||||||
// Log per-channel detail
|
|
||||||
for (ch in analysisResult.channels) {
|
for (ch in analysisResult.channels) {
|
||||||
if (ch.isValid && ch.result != null) {
|
if (ch.isValid && ch.result != null) {
|
||||||
Log.d("PiezoMonitor", " CH${ch.channel}: ant=${ch.result.ant} post=${ch.result.post} urine=${ch.result.urineLen} score=${"%.1f".format(ch.result.score)}")
|
Log.d("PiezoMonitor", " CH${ch.channel}: ant=${ch.result.ant} post=${ch.result.post} urine=${ch.result.urineLen} score=${"%.1f".format(ch.result.score)}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (centerWallCount >= 3) {
|
||||||
|
// 6ch BV estimation (center 4ch + lateral lr_ratio)
|
||||||
|
val bvResult = estimateBladderVolume6ch(allWalls)
|
||||||
|
if (bvResult != null) {
|
||||||
|
lastVolumeMl = bvResult.volumeMl
|
||||||
|
maxVolumeMl = maxOf(maxVolumeMl, bvResult.volumeMl)
|
||||||
|
Log.d("PiezoMonitor", "BV: ${"%.1f".format(bvResult.volumeMl)}ml (6ch, lr=${"%.2f".format(bvResult.lrRatio)}, center=${centerWallCount}/4)")
|
||||||
|
bleManager.debugLogger.measurementResult(bvResult.volumeMl, bvResult.lrRatio, totalWallCount,
|
||||||
|
(0..5).map { allWalls[it]?.let { w -> w.second - w.first } ?: 0 })
|
||||||
|
}
|
||||||
|
} else if (centerWallCount > 0) {
|
||||||
|
Log.w("PiezoMonitor", "Insufficient center channels: $centerWallCount/4 (need 3+)")
|
||||||
|
bleManager.debugLogger.warn("BV_SKIP center=$centerWallCount/4 total=$totalWallCount/6")
|
||||||
|
android.widget.Toast.makeText(context,
|
||||||
|
"측정 부족 (${centerWallCount}/4채널) — 센서 위치를 조절해주세요",
|
||||||
|
android.widget.Toast.LENGTH_SHORT).show()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.d("PiezoMonitor", "No valid channels — volume unchanged")
|
Log.d("PiezoMonitor", "No valid channels — volume unchanged")
|
||||||
|
bleManager.debugLogger.warn("BV_FAIL no valid channels")
|
||||||
|
android.widget.Toast.makeText(context,
|
||||||
|
"방광이 감지되지 않았습니다. 센서 접촉을 확인해주세요.",
|
||||||
|
android.widget.Toast.LENGTH_SHORT).show()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update level based on measured volume
|
// Update level based on measured volume
|
||||||
|
|||||||
Reference in New Issue
Block a user