fix: critical code review — thread safety, state management
CRITICAL fixes: - #1: lastMultiChannelResult 변경을 handler.post로 (메인 스레드 보장) - #3: measureDoneSignal var=remember → val mutableStateOf (recomposition 안전) - #34,35: BleManager bluetoothGatt/tx/rxCharacteristic/lastRxTimestamp @Volatile - #66: GreenZoneConstants 모든 mutable var @Volatile - #56: PiezoHW.distancePerSample @Volatile - nested handler.post 제거 (불필요한 프레임 지연) - maa throttle deadlock 방지 (Boolean 반환 + state 리셋) - Plot/Log 불일치 수정 (channelLogs를 allWalls 기준으로 통일) - Placement 센서 위치/화살표 조정, gradient dead zone, CV relaxation - 개발자 모드 CV 표시, 가이드 상자 항상 표시 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -18,11 +18,11 @@ enum class BvMethod { FRUSTUM, V41 }
|
||||
|
||||
object GreenZoneConstants {
|
||||
|
||||
var postMaxIdx: Int = 80 // 후벽 탐색 최대 sample index (이 이상 peak 무시)
|
||||
@Volatile var postMaxIdx: Int = 80 // 후벽 탐색 최대 sample index (이 이상 peak 무시)
|
||||
|
||||
var detectionMethod: DetectionMethod = DetectionMethod.METHOD_C
|
||||
var bvMethod: BvMethod = BvMethod.V41
|
||||
var placementGuideMode: PlacementGuideMode = PlacementGuideMode.SIMPLE
|
||||
@Volatile var detectionMethod: DetectionMethod = DetectionMethod.METHOD_C
|
||||
@Volatile var bvMethod: BvMethod = BvMethod.V41
|
||||
@Volatile var placementGuideMode: PlacementGuideMode = PlacementGuideMode.SIMPLE
|
||||
|
||||
// ═══════════════════════════════════════════════════════════
|
||||
// 신호 범위
|
||||
@@ -48,7 +48,7 @@ object GreenZoneConstants {
|
||||
* UrinAI의 liquidThrLoose(raw 기준)와 다름 — 여기는 TVD+SG 적용 후 신호 기준.
|
||||
* Python 원본: 1150 (low_echo_detection_method_b.py LOW_ECHO_AMP, 6ch 버전)
|
||||
* 영향: PiezoEchoAnalyzer → low-echo span 탐지, 벽 찾기의 기반 */
|
||||
var lowEchoAmp: Float = 1250f
|
||||
@Volatile var lowEchoAmp: Float = 1250f
|
||||
|
||||
/** 구조 이진화 임계값: raw < 이 값 → 액체(liquid), ≥ → 조직(tissue).
|
||||
* 낮출수록 엄격 (더 확실한 액체만 인정), 높일수록 관대.
|
||||
|
||||
@@ -96,7 +96,7 @@ object PiezoHW {
|
||||
val degreeLR: DoubleArray get() = centerCh.map { degreeLRAll[it] }.toDoubleArray()
|
||||
|
||||
/** Acoustic calibration (런타임 조절 가능) */
|
||||
var distancePerSample: Double = 1.968 // mm/sample
|
||||
@Volatile var distancePerSample: Double = 1.968 // mm/sample
|
||||
const val delayOffsetMm: Double = 6.85
|
||||
|
||||
/** Volume model */
|
||||
|
||||
Reference in New Issue
Block a user