feat: SG Filter on/off 토글 추가 (Settings 패널)

- PiezoEchoAnalyzer.useSgFilter: true/false로 SG 필터 on/off
- OFF 시 raw ADC 그대로 low-echo detection에 사용
- Settings 패널에 Switch 토글 추가 (기본 ON)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-24 17:34:21 +09:00
parent 36da75b1f0
commit 7dea5b2eca
2 changed files with 23 additions and 2 deletions
@@ -213,9 +213,10 @@ class PiezoEchoAnalyzer private constructor() {
// ── Denoising Pipeline ── // ── Denoising Pipeline ──
/** SG 디노이징 (6ch 알고리즘: TVD 제거, SG만 사용) */ var useSgFilter: Boolean = true
fun denoise(signal: DoubleArray): DoubleArray { fun denoise(signal: DoubleArray): DoubleArray {
return sgSmooth(signal) return if (useSgFilter) sgSmooth(signal) else signal.copyOf()
} }
/** 1D Total Variation Denoising — Chambolle (2004) dual projected gradient */ /** 1D Total Variation Denoising — Chambolle (2004) dual projected gradient */
@@ -681,6 +681,26 @@ fun PiezoMonitoringView(appState: AppState) {
HorizontalDivider() HorizontalDivider()
// SG Filter toggle
var sgEnabled by remember { mutableStateOf(analyzer.useSgFilter) }
Row(
modifier = Modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically
) {
Text("SG Filter", fontSize = 14.sp, fontWeight = FontWeight.SemiBold)
Spacer(modifier = Modifier.weight(1f))
Switch(
checked = sgEnabled,
onCheckedChange = {
sgEnabled = it
analyzer.useSgFilter = it
},
colors = SwitchDefaults.colors(checkedTrackColor = MlPrimary)
)
}
HorizontalDivider()
Row { Row {
Text("Max Volume", fontSize = 14.sp, fontWeight = FontWeight.SemiBold) Text("Max Volume", fontSize = 14.sp, fontWeight = FontWeight.SemiBold)
Spacer(modifier = Modifier.weight(1f)) Spacer(modifier = Modifier.weight(1f))