summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/screensaver.cpp12
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
@@ -134,7 +134,7 @@ void OpieScreenSaver::setIntervals ( int i1, int i2, int i3 )
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 );
@@ -171,10 +171,10 @@ void OpieScreenSaver::setBacklight ( int bright )
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;
@@ -225,7 +225,7 @@ void OpieScreenSaver::setBacklightInternal ( int bright )
225 225
226void OpieScreenSaver::timerEvent ( QTimerEvent * ) 226void 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];
@@ -239,10 +239,8 @@ void OpieScreenSaver::timerEvent ( QTimerEvent * )
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 );