From 9470ca7dbfb3416b644935865b5e31c6884a82e0 Mon Sep 17 00:00:00 2001 From: jjangddu Date: Mon, 3 Aug 2026 16:28:01 +0900 Subject: [PATCH] =?UTF-8?q?feat(hw):=20PiezoHW=20R100/R200/R300=20preset?= =?UTF-8?q?=203=EC=A2=85=20=EC=B6=94=EA=B0=80=20(cloud-mvp=204fbba01=20?= =?UTF-8?q?=EC=9D=B4=EC=8B=9D)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 이번에 새로 만든 실리콘 렌즈 타입 목업 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 --- .../vesiscan/managers/PiezoBVEstimator.kt | 52 +++++++++++++++---- 1 file changed, 41 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/com/medithings/vesiscan/managers/PiezoBVEstimator.kt b/app/src/main/java/com/medithings/vesiscan/managers/PiezoBVEstimator.kt index 2c9424d..f8ef100 100644 --- a/app/src/main/java/com/medithings/vesiscan/managers/PiezoBVEstimator.kt +++ b/app/src/main/java/com/medithings/vesiscan/managers/PiezoBVEstimator.kt @@ -29,23 +29,37 @@ object PiezoHW { enum class DevicePreset { LEGACY_5CH, - V0, // All 0° (BLE 테스트용) - V1, // Max 20° housing → Snell's law refraction - V2 // Max 30° housing → Snell's law refraction + V0, // All 0° (BLE 테스트용) + V1, // Max 20° housing → Snell + 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 fun autoDetectPreset(deviceName: String) { if (deviceName.startsWith("VBT") && deviceName.length >= 4) { - // VBT...n0x → 뒤에서 3번째 글자(n)가 각도 타입 - // n=0 → V0, n=2 → V1, n=3 → V2 - val n = deviceName[deviceName.length - 3] - activePreset = when (n) { - '0' -> DevicePreset.V0 - '2' -> DevicePreset.V1 - '3' -> DevicePreset.V2 - else -> DevicePreset.V1 // 알 수 없으면 V1 기본 + // 2026-08-03: R\d{3} 패턴 우선 매칭 (VBT2607R100 · R200 · R300 등). + val rMatch = Regex("""R(\d)(\d{2})$""").find(deviceName) + if (rMatch != null) { + activePreset = when (rMatch.groupValues[1]) { + "1" -> DevicePreset.R100 + "2" -> DevicePreset.R200 + "3" -> DevicePreset.R300 + 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")) { 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.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) + // 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 좌표 @@ -80,6 +97,13 @@ object PiezoHW { 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.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 굴절 후) @@ -89,6 +113,9 @@ object PiezoHW { 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.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) @@ -130,6 +157,9 @@ object PiezoHW { DevicePreset.V0 -> "V0 (all 0°)" DevicePreset.V1 -> "V1 (max 20°, 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)" } }