Diffstat (limited to 'core/launcher/screensaver.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/launcher/screensaver.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/core/launcher/screensaver.cpp b/core/launcher/screensaver.cpp index 45da9ed..088ed19 100644 --- a/core/launcher/screensaver.cpp +++ b/core/launcher/screensaver.cpp | |||
@@ -189,4 +189,6 @@ void OpieScreenSaver::setBacklight ( int bright ) | |||
189 | m_sensordata [i] = sl [i]. toInt ( ); | 189 | m_sensordata [i] = sl [i]. toInt ( ); |
190 | } | 190 | } |
191 | if ( m_sensordata [LS_Steps] < 2 ) // sanity check to avoid SIGFPE | ||
192 | m_sensordata [LS_Steps] = 2; | ||
191 | 193 | ||
192 | timerEvent ( 0 ); | 194 | timerEvent ( 0 ); |
@@ -234,5 +236,5 @@ void OpieScreenSaver::timerEvent ( QTimerEvent * ) | |||
234 | int dy = m_sensordata [LS_LightMax] - m_sensordata [LS_LightMin]; | 236 | int dy = m_sensordata [LS_LightMax] - m_sensordata [LS_LightMin]; |
235 | 237 | ||
236 | int stepno = ( s - m_sensordata [LS_SensorMin] ) * m_sensordata [LS_Steps] / dx; | 238 | int stepno = ( s - m_sensordata [LS_SensorMin] ) * m_sensordata [LS_Steps] / dx; // dx is never 0 |
237 | 239 | ||
238 | m_backlight_sensor = m_sensordata [LS_LightMax] - dy * stepno / ( m_sensordata [LS_Steps] - 1 ); | 240 | m_backlight_sensor = m_sensordata [LS_LightMax] - dy * stepno / ( m_sensordata [LS_Steps] - 1 ); |