diff --git a/app/src/main/java/com/example/medilightv2android/managers/GreenZoneConstants.kt b/app/src/main/java/com/example/medilightv2android/managers/GreenZoneConstants.kt index cfc1f9a..330bf2b 100644 --- a/app/src/main/java/com/example/medilightv2android/managers/GreenZoneConstants.kt +++ b/app/src/main/java/com/example/medilightv2android/managers/GreenZoneConstants.kt @@ -31,6 +31,9 @@ object GreenZoneConstants { /** Posture pitch 임계값 (deg). |pitch| > 이 값 → LYING, ≤ 이 값 → NON_LYING. dev 모드에서 조정 가능. */ @Volatile var pitchLyingThreshold: Float = 25f + /** Posture polling 간격 (ms). PiezoMonitoring 에서 mtb 보내는 주기. dev 모드에서 조정 가능. */ + @Volatile var posturePollIntervalMs: Long = 3000L + // ═══════════════════════════════════════════════════════════ // 신호 범위 // ═══════════════════════════════════════════════════════════ diff --git a/app/src/main/java/com/example/medilightv2android/ui/views/monitoring/PiezoMonitoringView.kt b/app/src/main/java/com/example/medilightv2android/ui/views/monitoring/PiezoMonitoringView.kt index 5f95080..4e5673b 100644 --- a/app/src/main/java/com/example/medilightv2android/ui/views/monitoring/PiezoMonitoringView.kt +++ b/app/src/main/java/com/example/medilightv2android/ui/views/monitoring/PiezoMonitoringView.kt @@ -694,7 +694,7 @@ fun PiezoMonitoringView(appState: AppState) { } else { Log.d("ImuDbg", "skip (connected=$isConnected measuring=$isMeasuring auto=$isAutoMeasuring spot=$isSpotInProgress)") } - kotlinx.coroutines.delay(10000) + kotlinx.coroutines.delay(GreenZoneConstants.posturePollIntervalMs) } } @@ -1853,6 +1853,29 @@ fun PiezoMonitoringView(appState: AppState) { steps = 0, colors = SliderDefaults.colors(thumbColor = MlPrimary, activeTrackColor = MlPrimary) ) + + // Posture polling 주기 (자세 갱신 빈도) + var pollIntervalVal by remember { + mutableStateOf(GreenZoneConstants.posturePollIntervalMs / 1000f) + } + Row(verticalAlignment = Alignment.CenterVertically) { + Text("Poll Interval", fontSize = labelSize, fontWeight = FontWeight.SemiBold) + Spacer(modifier = Modifier.width(8.dp)) + Text("%.1f초".format(pollIntervalVal), + fontSize = 13.sp, fontWeight = FontWeight.Bold, color = MlPrimary) + Spacer(modifier = Modifier.weight(1f)) + Text("자세 갱신 주기", fontSize = 10.sp, color = MlSecondaryText) + } + Slider( + value = pollIntervalVal, + onValueChange = { + pollIntervalVal = it + GreenZoneConstants.posturePollIntervalMs = (it * 1000).toLong() + }, + valueRange = 1f..15f, // 1초 ~ 15초 + steps = 0, + colors = SliderDefaults.colors(thumbColor = MlPrimary, activeTrackColor = MlPrimary) + ) } HorizontalDivider(modifier = Modifier.padding(vertical = dividerPadding))