feat: CSV에 threshold, dps, sg_filter 컬럼 추가
scan_id,timestamp,volume_ml,lr_ratio,threshold,dps,sg_filter,channel,s0,... 1,14:30:12,305.2,1.20,1150,1.771,ON,CH0,1823,... 매 측정 시점의 설정값이 ADC와 함께 기록되어 추후 분석 시 어떤 파라미터로 측정했는지 추적 가능 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -54,11 +54,14 @@ object AdcCsvLogger {
|
|||||||
val timestamp = timeFmt.format(Date())
|
val timestamp = timeFmt.format(Date())
|
||||||
val volStr = volumeMl?.let { "%.1f".format(it) } ?: ""
|
val volStr = volumeMl?.let { "%.1f".format(it) } ?: ""
|
||||||
val lrStr = "%.2f".format(lrRatio)
|
val lrStr = "%.2f".format(lrRatio)
|
||||||
|
val thrStr = "%.0f".format(com.example.medilightv2android.managers.GreenZoneConstants.lowEchoAmp)
|
||||||
|
val dpsStr = "%.3f".format(com.example.medilightv2android.managers.PiezoHW.distancePerSample)
|
||||||
|
val sgStr = if (com.example.medilightv2android.managers.PiezoEchoAnalyzer.shared.useSgFilter) "ON" else "OFF"
|
||||||
|
|
||||||
java.io.FileWriter(file, !isNew).buffered().use { writer ->
|
java.io.FileWriter(file, !isNew).buffered().use { writer ->
|
||||||
if (isNew) {
|
if (isNew) {
|
||||||
val header = buildString {
|
val header = buildString {
|
||||||
append("scan_id,timestamp,volume_ml,lr_ratio,channel")
|
append("scan_id,timestamp,volume_ml,lr_ratio,threshold,dps,sg_filter,channel")
|
||||||
for (i in 0 until 100) append(",s$i")
|
for (i in 0 until 100) append(",s$i")
|
||||||
}
|
}
|
||||||
writer.write(header)
|
writer.write(header)
|
||||||
@@ -67,7 +70,7 @@ object AdcCsvLogger {
|
|||||||
|
|
||||||
for ((chIdx, buffer) in channels.withIndex()) {
|
for ((chIdx, buffer) in channels.withIndex()) {
|
||||||
val row = buildString {
|
val row = buildString {
|
||||||
append("$scanCounter,$timestamp,$volStr,$lrStr,CH$chIdx")
|
append("$scanCounter,$timestamp,$volStr,$lrStr,$thrStr,$dpsStr,$sgStr,CH$chIdx")
|
||||||
for (sample in buffer) {
|
for (sample in buffer) {
|
||||||
append(",${sample.toInt()}")
|
append(",${sample.toInt()}")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user