-rw-r--r-- | core/launcher/screensaver.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/core/launcher/screensaver.cpp b/core/launcher/screensaver.cpp index 088ed19..b9bb64c 100644 --- a/core/launcher/screensaver.cpp +++ b/core/launcher/screensaver.cpp | |||
@@ -133,9 +133,9 @@ void OpieScreenSaver::setIntervals ( int i1, int i2, int i3 ) | |||
133 | m_enable_suspend = ( i3 > 0 ); | 133 | m_enable_suspend = ( i3 > 0 ); |
134 | m_onlylcdoff = config.readBoolEntry ( "LcdOffOnly", false ); | 134 | m_onlylcdoff = config.readBoolEntry ( "LcdOffOnly", false ); |
135 | } | 135 | } |
136 | 136 | ||
137 | qDebug("screen saver intervals: %d %d %d", i1, i2, i3); | 137 | //qDebug("screen saver intervals: %d %d %d", i1, i2, i3); |
138 | 138 | ||
139 | v [ 0 ] = QMAX( 1000 * i1, 100 ); | 139 | v [ 0 ] = QMAX( 1000 * i1, 100 ); |
140 | v [ 1 ] = QMAX( 1000 * i2, 100 ); | 140 | v [ 1 ] = QMAX( 1000 * i2, 100 ); |
141 | v [ 2 ] = QMAX( 1000 * i3, 100 ); | 141 | v [ 2 ] = QMAX( 1000 * i3, 100 ); |
@@ -170,12 +170,12 @@ void OpieScreenSaver::setBacklight ( int bright ) | |||
170 | m_backlight_normal = config. readNumEntry ( "Brightness", m_on_ac ? 255 : 127 ); | 170 | m_backlight_normal = config. readNumEntry ( "Brightness", m_on_ac ? 255 : 127 ); |
171 | 171 | ||
172 | m_use_light_sensor = config. readBoolEntry ( "LightSensor", false ); | 172 | m_use_light_sensor = config. readBoolEntry ( "LightSensor", false ); |
173 | 173 | ||
174 | //qDebug ( "setBacklight: %d (ls: %d)", m_backlight_normal, m_use_light_sensor ? 1 : 0 ); | 174 | //qDebug ( "setBacklight: %d (norm: %d) (ls: %d)", bright, m_backlight_normal, m_use_light_sensor ? 1 : 0 ); |
175 | 175 | ||
176 | killTimers ( ); | 176 | killTimers ( ); |
177 | if ( m_use_light_sensor ) { | 177 | if (( bright < 0 ) && m_use_light_sensor ) { |
178 | QStringList sl = config. readListEntry ( "LightSensorData", ';' ); | 178 | QStringList sl = config. readListEntry ( "LightSensorData", ';' ); |
179 | 179 | ||
180 | m_sensordata [LS_SensorMin] = 40; | 180 | m_sensordata [LS_SensorMin] = 40; |
181 | m_sensordata [LS_SensorMax] = 215; | 181 | m_sensordata [LS_SensorMax] = 215; |
@@ -224,9 +224,9 @@ void OpieScreenSaver::setBacklightInternal ( int bright ) | |||
224 | 224 | ||
225 | 225 | ||
226 | void OpieScreenSaver::timerEvent ( QTimerEvent * ) | 226 | void OpieScreenSaver::timerEvent ( QTimerEvent * ) |
227 | { | 227 | { |
228 | int s = ODevice::inst ( )-> readLightSensor ( ); | 228 | int s = ODevice::inst ( )-> readLightSensor ( ) * 256 / ODevice::inst ( )-> lightSensorResolution ( ); |
229 | 229 | ||
230 | if ( s < m_sensordata [LS_SensorMin] ) | 230 | if ( s < m_sensordata [LS_SensorMin] ) |
231 | m_backlight_sensor = m_sensordata [LS_LightMax]; | 231 | m_backlight_sensor = m_sensordata [LS_LightMax]; |
232 | else if ( s >= m_sensordata [LS_SensorMax] ) | 232 | else if ( s >= m_sensordata [LS_SensorMax] ) |
@@ -238,12 +238,10 @@ void OpieScreenSaver::timerEvent ( QTimerEvent * ) | |||
238 | int stepno = ( s - m_sensordata [LS_SensorMin] ) * m_sensordata [LS_Steps] / dx; // dx is never 0 | 238 | int stepno = ( s - m_sensordata [LS_SensorMin] ) * m_sensordata [LS_Steps] / dx; // dx is never 0 |
239 | 239 | ||
240 | 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 ); |
241 | } | 241 | } |
242 | if ( !m_backlight_sensor ) | ||
243 | m_backlight_sensor = 1; | ||
244 | 242 | ||
245 | // qDebug ( "f(%d) = %d [%d - %d] -> [%d - %d] / %d", s, m_backlight_sensor, m_sensordata [LS_SensorMin], m_sensordata [LS_SensorMax], m_sensordata [LS_LightMin], m_sensordata [LS_LightMax], m_sensordata [LS_Steps] ); | 243 | //qDebug ( "f(%d) = %d [%d - %d] -> [%d - %d] / %d", s, m_backlight_sensor, m_sensordata [LS_SensorMin], m_sensordata [LS_SensorMax], m_sensordata [LS_LightMin], m_sensordata [LS_LightMax], m_sensordata [LS_Steps] ); |
246 | 244 | ||
247 | if ( m_level <= 0 ) | 245 | if ( m_level <= 0 ) |
248 | setBacklightInternal ( -1 ); | 246 | setBacklightInternal ( -1 ); |
249 | } | 247 | } |