feat(hw): PiezoHW R100/R200/R300 preset 3종 추가 (cloud-mvp 4fbba01 이식)
이번에 새로 만든 실리콘 렌즈 타입 목업 3종 (VBT2607R100/R200/R300) 을
demo-final 앱 알고리즘도 인식하도록 DevicePreset 확장.
목업 사양 (Firmware Zephyr · 피부내 초음파 입사각):
R1: raw 0/7/14/21° → Snell 0/-4.4/-8.7/-13.0°
R2: raw -5/4/12/21° → Snell 3.1/-2.5/-7.5/-13.0° (CH0 위쪽 +3.1)
R3: raw 0/9/18/27° → Snell 0/-5.6/-11.2/-16.6° (최대 27°)
lateral CH4/CH5: 아래 10° · 좌우 5°
DevicePreset: LEGACY_5CH · V0/V1/V2 유지 + R100/R200/R300 신규
autoDetectPreset: R\d{3} 패턴 우선 매칭 · fallback 은 옛 naming
각 preset: sensor_z V2 동일 · degree Snell 값 · degree_lr V1/V2 동일
Note: 안테나 변경으로 RSSI 저하 · GATT status=8 발생 관찰됨. HW 이슈 · 앱과
무관 · Firmware/HW 팀 안테나 튜닝 개선 필요.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -29,23 +29,37 @@ object PiezoHW {
|
|||||||
|
|
||||||
enum class DevicePreset {
|
enum class DevicePreset {
|
||||||
LEGACY_5CH,
|
LEGACY_5CH,
|
||||||
V0, // All 0° (BLE 테스트용)
|
V0, // All 0° (BLE 테스트용)
|
||||||
V1, // Max 20° housing → Snell's law refraction
|
V1, // Max 20° housing → Snell
|
||||||
V2 // Max 30° housing → Snell's law refraction
|
V2, // Max 30° housing → Snell
|
||||||
|
// 2026-08-03: 실리콘 렌즈 타입 목업 3종 (piezophantomtest r100/r200/r300).
|
||||||
|
R100, // R1: raw 0/7/14/21° → Snell 0/-4.4/-8.7/-13.0°
|
||||||
|
R200, // R2: raw -5/4/12/21° → Snell 3.1/-2.5/-7.5/-13.0°
|
||||||
|
R300, // R3: raw 0/9/18/27° → Snell 0/-5.6/-11.2/-16.6°
|
||||||
}
|
}
|
||||||
|
|
||||||
var activePreset: DevicePreset = DevicePreset.V0
|
var activePreset: DevicePreset = DevicePreset.V0
|
||||||
|
|
||||||
fun autoDetectPreset(deviceName: String) {
|
fun autoDetectPreset(deviceName: String) {
|
||||||
if (deviceName.startsWith("VBT") && deviceName.length >= 4) {
|
if (deviceName.startsWith("VBT") && deviceName.length >= 4) {
|
||||||
// VBT...n0x → 뒤에서 3번째 글자(n)가 각도 타입
|
// 2026-08-03: R\d{3} 패턴 우선 매칭 (VBT2607R100 · R200 · R300 등).
|
||||||
// n=0 → V0, n=2 → V1, n=3 → V2
|
val rMatch = Regex("""R(\d)(\d{2})$""").find(deviceName)
|
||||||
val n = deviceName[deviceName.length - 3]
|
if (rMatch != null) {
|
||||||
activePreset = when (n) {
|
activePreset = when (rMatch.groupValues[1]) {
|
||||||
'0' -> DevicePreset.V0
|
"1" -> DevicePreset.R100
|
||||||
'2' -> DevicePreset.V1
|
"2" -> DevicePreset.R200
|
||||||
'3' -> DevicePreset.V2
|
"3" -> DevicePreset.R300
|
||||||
else -> DevicePreset.V1 // 알 수 없으면 V1 기본
|
else -> DevicePreset.R100
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 옛 naming: VBT...n0x → 뒤에서 3번째 글자(n) 가 각도 타입
|
||||||
|
val n = deviceName[deviceName.length - 3]
|
||||||
|
activePreset = when (n) {
|
||||||
|
'0' -> DevicePreset.V0
|
||||||
|
'2' -> DevicePreset.V1
|
||||||
|
'3' -> DevicePreset.V2
|
||||||
|
else -> DevicePreset.V1 // 알 수 없으면 V1 기본
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else if (deviceName.startsWith("2025MEDIP")) {
|
} else if (deviceName.startsWith("2025MEDIP")) {
|
||||||
activePreset = DevicePreset.LEGACY_5CH
|
activePreset = DevicePreset.LEGACY_5CH
|
||||||
@@ -64,6 +78,9 @@ object PiezoHW {
|
|||||||
DevicePreset.V0 -> doubleArrayOf(21.0, 14.0, 7.0, 0.0, 10.5, 10.5)
|
DevicePreset.V0 -> doubleArrayOf(21.0, 14.0, 7.0, 0.0, 10.5, 10.5)
|
||||||
DevicePreset.V1 -> doubleArrayOf(20.1, 12.8, 7.0, 0.0, 9.9, 9.9)
|
DevicePreset.V1 -> doubleArrayOf(20.1, 12.8, 7.0, 0.0, 9.9, 9.9)
|
||||||
DevicePreset.V2 -> doubleArrayOf(19.3, 13.0, 6.7, 0.0, 9.85, 9.85)
|
DevicePreset.V2 -> doubleArrayOf(19.3, 13.0, 6.7, 0.0, 9.85, 9.85)
|
||||||
|
// R 시리즈 (실리콘 렌즈 목업) — V2 와 동일한 sensor_z.
|
||||||
|
DevicePreset.R100, DevicePreset.R200, DevicePreset.R300 ->
|
||||||
|
doubleArrayOf(19.3, 13.0, 6.7, 0.0, 9.85, 9.85)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 6채널 전체 x 좌표
|
// 6채널 전체 x 좌표
|
||||||
@@ -80,6 +97,13 @@ object PiezoHW {
|
|||||||
DevicePreset.V0 -> doubleArrayOf(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
|
DevicePreset.V0 -> doubleArrayOf(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
|
||||||
DevicePreset.V1 -> doubleArrayOf(6.89, 0.0, -6.89, -13.66, -6.87, -6.87)
|
DevicePreset.V1 -> doubleArrayOf(6.89, 0.0, -6.89, -13.66, -6.87, -6.87)
|
||||||
DevicePreset.V2 -> doubleArrayOf(0.0, -6.89, -13.66, -20.20, -6.87, -6.87)
|
DevicePreset.V2 -> doubleArrayOf(0.0, -6.89, -13.66, -20.20, -6.87, -6.87)
|
||||||
|
// 2026-08-03 실리콘 렌즈 목업 3종 (raw 각도 → Snell 후 · lateral 아래10°→-6.87):
|
||||||
|
// R1 raw 0/7/14/21 → Snell 0/-4.4/-8.7/-13.0
|
||||||
|
// R2 raw -5/4/12/21 → Snell 3.1/-2.5/-7.5/-13.0
|
||||||
|
// R3 raw 0/9/18/27 → Snell 0/-5.6/-11.2/-16.6
|
||||||
|
DevicePreset.R100 -> doubleArrayOf(0.0, -4.4, -8.7, -13.0, -6.87, -6.87)
|
||||||
|
DevicePreset.R200 -> doubleArrayOf(3.1, -2.5, -7.5, -13.0, -6.87, -6.87)
|
||||||
|
DevicePreset.R300 -> doubleArrayOf(0.0, -5.6, -11.2, -16.6, -6.87, -6.87)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 6채널 전체 LR 빔 각도 (Snell's law 굴절 후)
|
// 6채널 전체 LR 빔 각도 (Snell's law 굴절 후)
|
||||||
@@ -89,6 +113,9 @@ object PiezoHW {
|
|||||||
DevicePreset.V0 -> doubleArrayOf(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
|
DevicePreset.V0 -> doubleArrayOf(0.0, 0.0, 0.0, 0.0, 0.0, 0.0)
|
||||||
DevicePreset.V1 -> doubleArrayOf(0.0, 0.0, 0.0, 0.0, -3.42, 3.42)
|
DevicePreset.V1 -> doubleArrayOf(0.0, 0.0, 0.0, 0.0, -3.42, 3.42)
|
||||||
DevicePreset.V2 -> doubleArrayOf(0.0, 0.0, 0.0, 0.0, -3.42, 3.42)
|
DevicePreset.V2 -> doubleArrayOf(0.0, 0.0, 0.0, 0.0, -3.42, 3.42)
|
||||||
|
// R 시리즈: raw 좌우 5° → Snell -3.42° (V1/V2 와 동일).
|
||||||
|
DevicePreset.R100, DevicePreset.R200, DevicePreset.R300 ->
|
||||||
|
doubleArrayOf(0.0, 0.0, 0.0, 0.0, -3.42, 3.42)
|
||||||
}
|
}
|
||||||
|
|
||||||
// BV용 center 채널만 (CH0~CH3)
|
// BV용 center 채널만 (CH0~CH3)
|
||||||
@@ -130,6 +157,9 @@ object PiezoHW {
|
|||||||
DevicePreset.V0 -> "V0 (all 0°)"
|
DevicePreset.V0 -> "V0 (all 0°)"
|
||||||
DevicePreset.V1 -> "V1 (max 20°, Snell)"
|
DevicePreset.V1 -> "V1 (max 20°, Snell)"
|
||||||
DevicePreset.V2 -> "V2 (max 30°, Snell)"
|
DevicePreset.V2 -> "V2 (max 30°, Snell)"
|
||||||
|
DevicePreset.R100 -> "R100 (raw 0/7/14/21°, Snell)"
|
||||||
|
DevicePreset.R200 -> "R200 (raw -5/4/12/21°, Snell)"
|
||||||
|
DevicePreset.R300 -> "R300 (raw 0/9/18/27°, Snell)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user