Only store valid sensor values
This commit is contained in:
parent
fc49f1d779
commit
348631fedc
@ -298,7 +298,9 @@ void MainWindow::updateState()
|
|||||||
|
|
||||||
bool errorOccurred = false;
|
bool errorOccurred = false;
|
||||||
for(auto& monitor: m_monitors) {
|
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)) {
|
if(!monitor.driver.setBrightness(monitor.brightness)) {
|
||||||
errorOccurred = true;
|
errorOccurred = true;
|
||||||
}
|
}
|
||||||
@ -306,7 +308,7 @@ void MainWindow::updateState()
|
|||||||
return !errorOccurred;
|
return !errorOccurred;
|
||||||
};
|
};
|
||||||
|
|
||||||
auto brightness = 0.5f;
|
auto brightness = NAN;
|
||||||
|
|
||||||
if(!getAverageSensorValue(brightness)) {
|
if(!getAverageSensorValue(brightness)) {
|
||||||
enumSensors();
|
enumSensors();
|
||||||
|
Loading…
Reference in New Issue
Block a user