summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libopie/odevice.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/libopie/odevice.cpp b/libopie/odevice.cpp
index c84312e..75426f9 100644
--- a/libopie/odevice.cpp
+++ b/libopie/odevice.cpp
@@ -638,25 +638,26 @@ bool iPAQ::setSoftSuspend ( bool soft )
bool iPAQ::setDisplayBrightness ( int bright )
{
bool res = false;
int fd;
if ( bright > 255 )
bright = 255;
if ( bright < 0 )
bright = 0;
// 128 is the maximum if you want a decent lifetime for the LCD
- bright = (int) (( ::pow ( 2, double( bright ) / 255.0 ) - 1 ) * 128.0 ); // logarithmic
+ if ( bright > 1 )
+ bright = (int) ( 0.5 + ( ::pow ( 2, double( bright ) / 255.0 ) - 1 ) * 128.0 ); // logarithmic
// bright = ( bright + 1 ) / 2;
if ((( fd = ::open ( "/dev/ts", O_WRONLY )) >= 0 ) ||
(( fd = ::open ( "/dev/h3600_ts", O_WRONLY )) >= 0 )) {
FLITE_IN bl;
bl. mode = 1;
bl. pwr = bright ? 1 : 0;
bl. brightness = bright;
res = ( ::ioctl ( fd, FLITE_ON, &bl ) == 0 );
::close ( fd );
}
return res;