diff --git a/.idea/appInsightsSettings.xml b/.idea/appInsightsSettings.xml
new file mode 100644
index 0000000..371f2e2
--- /dev/null
+++ b/.idea/appInsightsSettings.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/planningMode.xml b/.idea/planningMode.xml
index 0982938..8b57a96 100644
--- a/.idea/planningMode.xml
+++ b/.idea/planningMode.xml
@@ -4,6 +4,7 @@
diff --git a/app/src/main/java/com/example/esp32aldldashboard/ui/main/MainScreenViewModel.kt b/app/src/main/java/com/example/esp32aldldashboard/ui/main/MainScreenViewModel.kt
index 3478e2d..0b4a4ab 100644
--- a/app/src/main/java/com/example/esp32aldldashboard/ui/main/MainScreenViewModel.kt
+++ b/app/src/main/java/com/example/esp32aldldashboard/ui/main/MainScreenViewModel.kt
@@ -6,7 +6,9 @@ import com.example.esp32aldldashboard.bluetooth.ConnectionState
import com.example.esp32aldldashboard.parser.ALDLFrame
import com.example.esp32aldldashboard.repository.SettingsRepository
import com.example.esp32aldldashboard.repository.TelemetryRepository
+import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.StateFlow
+import kotlinx.coroutines.flow.stateIn
import kotlinx.coroutines.launch
class MainScreenViewModel(
@@ -24,10 +26,11 @@ class MainScreenViewModel(
val currentFrameRate: StateFlow = telemetryRepository.currentFrameRate
val isCelsius: StateFlow = settingsRepository.isCelsiusFlow
+ .stateIn(viewModelScope, SharingStarted.WhileSubscribed(5000), false)
fun toggleTemperatureUnit() {
viewModelScope.launch {
- val currentValue = settingsRepository.isCelsiusFlow.value
+ val currentValue = isCelsius.value
settingsRepository.setIsCelsius(!currentValue)
}
}