feat: auto-detect device preset from BLE name

VBT260400xy → FLAT, VBT260402xy → NEW_CASE2, VBT260403xy → NEW_CASE1
2025MEDIP → LEGACY_5CH

Auto-called on BLE connect. Logged to debug.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
dwjang
2026-04-21 17:29:38 +09:00
parent 549a2c722e
commit 5a084ac5a9
2 changed files with 21 additions and 2 deletions
@@ -37,8 +37,24 @@ object PiezoHW {
NEW_CASE2
}
/** ★ 여기만 바꾸면 전체 적용 ★ */
val activePreset: DevicePreset = DevicePreset.FLAT
/** 현재 활성 preset — 기기 연결 시 자동 감지, 수동 변경도 가능 */
var activePreset: DevicePreset = DevicePreset.FLAT
/**
* BLE 기기 이름으로 preset 자동 감지.
* VBT26040x0y: x=0 → FLAT, x=2 → NEW_CASE2, x=3 → NEW_CASE1
*/
fun autoDetectPreset(deviceName: String) {
if (deviceName.startsWith("VBT2604") && deviceName.length >= 9) {
when (deviceName[7]) {
'0' -> activePreset = DevicePreset.FLAT
'2' -> activePreset = DevicePreset.NEW_CASE2
'3' -> activePreset = DevicePreset.NEW_CASE1
}
} else if (deviceName.startsWith("2025MEDIP")) {
activePreset = DevicePreset.LEGACY_5CH
}
}
// BV용 수직 채널 (CH0~CH3)
val sensorZMm: DoubleArray