feat: scan_id를 BLE 로그에도 추가 (CSV와 대조 가능)
- MEASUREMENT scan=3 vol=305.2ml lr=1.20 valid=4/6 - BV_SKIP scan=4 center=2/4 total=2/6 - BV_FAIL scan=5 no valid channels AdcCsvLogger.lastScanId 공개 → BleDebugLogger에서 참조 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -16,6 +16,8 @@ object AdcCsvLogger {
|
||||
|
||||
private val dayFmt = SimpleDateFormat("yyyy-MM-dd", Locale.US)
|
||||
private val timeFmt = SimpleDateFormat("HH:mm:ss.SSS", Locale.US)
|
||||
var lastScanId: Int = 0
|
||||
private set
|
||||
private var scanCounter = 0
|
||||
|
||||
private fun getDir(): File {
|
||||
@@ -47,6 +49,7 @@ object AdcCsvLogger {
|
||||
val file = getTodayFile()
|
||||
val isNew = !file.exists() || file.length() == 0L
|
||||
scanCounter++
|
||||
lastScanId = scanCounter
|
||||
|
||||
val timestamp = timeFmt.format(Date())
|
||||
val volStr = volumeMl?.let { "%.1f".format(it) } ?: ""
|
||||
|
||||
@@ -156,8 +156,10 @@ class BleDebugLogger private constructor(private val context: Context) {
|
||||
}
|
||||
|
||||
fun measurementResult(volumeMl: Double?, lrRatio: Double, validChannels: Int, urineLines: List<Int>) {
|
||||
val scanId = AdcCsvLogger.lastScanId
|
||||
val msg = buildString {
|
||||
append("MEASUREMENT vol=${volumeMl?.let { "%.1f".format(it) } ?: "null"}ml")
|
||||
append("MEASUREMENT scan=$scanId")
|
||||
append(" vol=${volumeMl?.let { "%.1f".format(it) } ?: "null"}ml")
|
||||
append(" lr=${"%.2f".format(lrRatio)}")
|
||||
append(" valid=$validChannels/6")
|
||||
append(" urine=[${urineLines.joinToString(",")}]")
|
||||
|
||||
Reference in New Issue
Block a user