Skip to content

Commit

Permalink
add 33ms polling rate and move display to style tab (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
Danil0v3s authored Jan 26, 2025
1 parent e88a45e commit 74ebebd
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion HardwareMonitor/HardwareMonitor/Monitor/MonitorPoller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ ILogger<MonitorPoller> logger
private readonly PresentMonPoller _presentMonPoller = new(logger);

private short _pollingRate = 500;
private const short MinimalPollingRate = 50;
private const short MinimalPollingRate = 33;

protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,6 @@ private fun TabContent(
onCustomSensorSelect = { sensorType, sensorId ->
viewModel.onEvent(SettingsEvent.CustomSensorSelect(sensorType, sensorId))
},
onDisplaySelect = {
viewModel.onEvent(SettingsEvent.DisplaySelect(it))
},
onFpsApplicationSelect = {
viewModel.onEvent(SettingsEvent.FpsApplicationSelect(it))
},
Expand Down Expand Up @@ -249,6 +246,9 @@ private fun TabContent(
onOpacityChange = { viewModel.onEvent(SettingsEvent.OverlayOpacityChange(it)) },
onGraphTypeChange = { viewModel.onEvent(SettingsEvent.OverlayGraphChange(it)) },
onOverlayCustomPositionEnable = { viewModel.onEvent(SettingsEvent.OverlayCustomPositionEnable(it)) },
onDisplaySelect = {
viewModel.onEvent(SettingsEvent.DisplaySelect(it))
},
)

2 -> AppSettingsUi(overlaySettings = settingsState.overlaySettings!!, onEvent = viewModel::onEvent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ fun AppSettingsUi(
}

Section(title = "RECORDING") {
val options = listOf("50", "100", "250", "300", "350", "400", "500")
val options = listOf("33", "50", "100", "250", "300", "350", "400", "500")
DropdownMenu(
label = "Polling Rate:",
disclaimer = "The interval in milliseconds the app will update data. Be mindful, this can impact performance!",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ fun StatsUi(
onOptionsToggle: (CheckboxSectionOption) -> Unit,
onSectionSwitchToggle: (SectionType, Boolean) -> Unit,
onCustomSensorSelect: (SensorType, String) -> Unit,
onDisplaySelect: (Int) -> Unit,
onFpsApplicationSelect: (String) -> Unit,
getCpuSensorReadings: () -> List<HardwareMonitorData.Sensor>,
getGpuSensorReadings: () -> List<HardwareMonitorData.Sensor>,
Expand All @@ -45,7 +44,6 @@ fun StatsUi(
modifier = Modifier.padding(bottom = 8.dp, top = 20.dp).verticalScroll(rememberScrollState()),
verticalArrangement = Arrangement.spacedBy(16.dp)
) {
val screenDevices = remember { GraphicsEnvironment.getLocalGraphicsEnvironment().screenDevices }
val availableOptions = remember(overlaySettings) { checkboxSectionOptions(overlaySettings) }

KeyboardShortcutInfoLabel()
Expand Down Expand Up @@ -93,13 +91,6 @@ fun StatsUi(
getHardwareSensors = getHardwareSensors,
)

DropdownSection(
title = "MONITOR",
options = screenDevices.map { it.defaultConfiguration.device.iDstring },
selectedIndex = overlaySettings.selectedDisplayIndex,
onValueChanged = { onDisplaySelect(it) }
)

Text(
text = "May your frames be high, and temps be low.",
color = LocalColorScheme.current.text.disabled,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.dp
import app.cleanmeter.target.desktop.model.OverlaySettings
import app.cleanmeter.target.desktop.ui.components.section.DropdownSection
import java.awt.GraphicsEnvironment

@Composable
fun StyleUi(
Expand All @@ -20,11 +23,14 @@ fun StyleUi(
onOpacityChange: (Float) -> Unit,
onGraphTypeChange: (OverlaySettings.ProgressType) -> Unit,
onOverlayCustomPositionEnable: (Boolean) -> Unit,
onDisplaySelect: (Int) -> Unit,
getOverlayPosition: () -> IntOffset,
) = Column(
modifier = Modifier.padding(bottom = 8.dp, top = 20.dp).verticalScroll(rememberScrollState()),
verticalArrangement = Arrangement.spacedBy(16.dp)
) {
val screenDevices = remember { GraphicsEnvironment.getLocalGraphicsEnvironment().screenDevices }

Position(
overlaySettings = overlaySettings,
onOverlayPositionIndex = onOverlayPositionIndex,
Expand All @@ -47,4 +53,11 @@ fun StyleUi(
overlaySettings = overlaySettings,
onGraphTypeChange = onGraphTypeChange
)

DropdownSection(
title = "MONITOR",
options = screenDevices.map { it.defaultConfiguration.device.iDstring },
selectedIndex = overlaySettings.selectedDisplayIndex,
onValueChanged = { onDisplaySelect(it) }
)
}

0 comments on commit 74ebebd

Please sign in to comment.