Only store valid sensor values

This commit is contained in:
BlackMark 2020-07-17 17:00:57 +02:00
parent fc49f1d779
commit 348631fedc

View File

@ -298,7 +298,9 @@ void MainWindow::updateState()
bool errorOccurred = false;
for(auto& monitor: m_monitors) {
monitor.brightness = monitor.manualOverride ? monitor.brightness : brightness;
if(!std::isnan(brightness) && !monitor.manualOverride) {
monitor.brightness = brightness;
}
if(!monitor.driver.setBrightness(monitor.brightness)) {
errorOccurred = true;
}
@ -306,7 +308,7 @@ void MainWindow::updateState()
return !errorOccurred;
};
auto brightness = 0.5f;
auto brightness = NAN;
if(!getAverageSensorValue(brightness)) {
enumSensors();