[mythtv] [patch] lcd backlight support

Leo Weppelman leo at wau.mis.ah.nl
Fri Aug 13 02:32:03 EDT 2004


The patch attached controls how the lcd backlight behaves. The current
situation is 'always on'. I don't like this blue lamp in my livingroom
to be always on ;-)
The patch adds an extra config option: 'LCD Backlight Always On' that
if tagged gives the current behaviour. If this option is not set, the
backlight is turned on when the mythfrontend has something important
to say on the display. The backlight is turned off when it falls back
to displaying the time or to displaying nothing at all.

Leo.
-------------- next part --------------
Index: mythtv/libs/libmyth/lcddevice.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmyth/lcddevice.cpp,v
retrieving revision 1.30
diff -u -r1.30 lcddevice.cpp
--- mythtv/libs/libmyth/lcddevice.cpp	7 Aug 2004 13:08:32 -0000	1.30
+++ mythtv/libs/libmyth/lcddevice.cpp	13 Aug 2004 06:16:32 -0000
@@ -313,6 +313,7 @@
     lcd_showgeneric=(gContext->GetSetting("LCDShowGeneric", "1")=="1");
     lcd_showvolume=(gContext->GetSetting("LCDShowVolume", "1")=="1");
     lcd_showmenu=(gContext->GetSetting("LCDShowMenu", "1")=="1");
+    lcd_backlighton=(gContext->GetSetting("LCDBacklightOn", "1")=="1");
 
     connected = TRUE;
 
@@ -329,6 +330,10 @@
     sendToServer("screen_add Time");
     sendToServer("widget_del Time heartbeat");
     sendToServer("screen_set Time priority 255");
+    if (lcd_backlighton)
+        sendToServer("screen_set Time backlight on");
+    else
+        sendToServer("screen_set Time backlight off");
     sendToServer("widget_add Time timeWidget string");
     sendToServer("widget_add Time topWidget string");
 
@@ -339,6 +344,7 @@
     sendToServer("screen_add Menu");
     sendToServer("widget_del Menu heartbeat");
     sendToServer("screen_set Menu priority 255");
+    sendToServer("screen_set Menu backlight on");
     sendToServer("widget_add Menu topWidget string");
     sendToServer("widget_add Menu menuWidget1 string");
     sendToServer("widget_add Menu menuWidget2 string");
@@ -351,6 +357,7 @@
     sendToServer("screen_add Music");
     sendToServer("widget_del Music heartbeat");
     sendToServer("screen_set Music priority 255");
+    sendToServer("screen_set Music backlight on");
     sendToServer("widget_add Music topWidget string");
     
     // Have to put in 10 bars for equalizer
@@ -368,6 +375,7 @@
     sendToServer("screen_add Channel");
     sendToServer("widget_del Channel heartbeat");
     sendToServer("screen_set Channel priority 255");
+    sendToServer("screen_set Channel backlight on");
     sendToServer("widget_add Channel topWidget string");
     sendToServer("widget_add Channel botWidget string");
     sendToServer("widget_add Channel progressBar hbar");
@@ -377,6 +385,7 @@
     sendToServer("screen_add Generic");
     sendToServer("widget_del Generic heartbeat");
     sendToServer("screen_set Generic priority 255");
+    sendToServer("screen_set Generic backlight on");
     sendToServer("widget_add Generic textWidget1 string");
     sendToServer("widget_add Generic textWidget2 string");
     sendToServer("widget_add Generic textWidget3 string");
@@ -387,14 +396,11 @@
     sendToServer("screen_add Volume");
     sendToServer("widget_del Volume heartbeat");
     sendToServer("screen_set Volume priority 255");
+    sendToServer("screen_set Volume backlight on");
     sendToServer("widget_add Volume topWidget string");
     sendToServer("widget_add Volume botWidget string");
     sendToServer("widget_add Volume progressBar hbar");
 
-    // Turn on the backlight
-
-    sendToServer("backlight 255");
-    
     lcd_ready = true;
  
     switchToTime();    // clock is on by default
@@ -512,8 +518,7 @@
 
 void LCD::startTime()
 {
-    if (lcd_showtime)
-        sendToServer("screen_set Time priority 128");
+    sendToServer("screen_set Time priority 128");
     timeTimer->start(1000, FALSE);
     outputTime();
     theMode = 0;    
@@ -1256,15 +1261,18 @@
     aString += " ";
     aString += QString::number(y);
     aString += " \"";
-    aString += QTime::currentTime().toString(timeformat).left(8) + "\"";
-    if (timeFlash)
-    {
-        aString = aString.replace(QRegExp(":"), " ");
-        timeFlash = false;
+    if (lcd_showtime) {
+        aString += QTime::currentTime().toString(timeformat).left(8) + "\"";
+        if (timeFlash)
+        {
+            aString = aString.replace(QRegExp(":"), " ");
+            timeFlash = false;
+        }
+        else
+            timeFlash = true;
     }
     else
-        timeFlash = true;
-
+        aString += " \"";
     sendToServer(aString);
 }
 
Index: mythtv/libs/libmyth/lcddevice.h
===================================================================
RCS file: /var/lib/mythcvs/mythtv/libs/libmyth/lcddevice.h,v
retrieving revision 1.15
diff -u -r1.15 lcddevice.h
--- mythtv/libs/libmyth/lcddevice.h	10 Apr 2004 19:31:56 -0000	1.15
+++ mythtv/libs/libmyth/lcddevice.h	13 Aug 2004 06:16:32 -0000
@@ -273,6 +273,7 @@
     bool lcd_showmusic;
     bool lcd_showchannel;
     bool lcd_showvolume;
+    bool lcd_backlighton;
 
     int (*GetLEDMask)(void);
 };
Index: mythtv/programs/mythfrontend/globalsettings.cpp
===================================================================
RCS file: /var/lib/mythcvs/mythtv/programs/mythfrontend/globalsettings.cpp,v
retrieving revision 1.183
diff -u -r1.183 globalsettings.cpp
--- mythtv/programs/mythfrontend/globalsettings.cpp	5 Aug 2004 08:27:59 -0000	1.183
+++ mythtv/programs/mythfrontend/globalsettings.cpp	13 Aug 2004 06:16:33 -0000
@@ -2527,6 +2527,17 @@
     };
 };
 
+class LCDBacklightOn: public CheckBoxSetting, public GlobalSetting {
+public:
+    LCDBacklightOn(): 
+        GlobalSetting("LCDBacklightOn") {
+        setLabel(QObject::tr("LCD Backlight Always On"));
+        setHelpText(QObject::tr("Turn on the backlight permanently. Need to "
+                    "restart mythfrontend to (de)activate it."));
+        setValue(true);
+    };
+};
+
 MainGeneralSettings::MainGeneralSettings()
 {
     AudioSettings *audio = new AudioSettings();
@@ -2780,6 +2791,7 @@
     lcdscreen->addChild(new LCDShowChannel());
     lcdscreen->addChild(new LCDShowVolume());
     lcdscreen->addChild(new LCDShowGeneric());
+    lcdscreen->addChild(new LCDBacklightOn());
     addChild(lcdscreen);
 #endif
 }


More information about the mythtv-dev mailing list