fix non working invert of oled display
authorghost <andreas.monzner@multimedia-labs.de>
Fri, 7 Nov 2008 19:35:57 +0000 (20:35 +0100)
committerghost <andreas.monzner@multimedia-labs.de>
Fri, 7 Nov 2008 19:35:57 +0000 (20:35 +0100)
add non working standby slider in display setup

lib/gdi/lcd.cpp
lib/python/Components/Lcd.py
lib/python/Components/config.py

index 3911719..ecc19b5 100644 (file)
@@ -166,8 +166,14 @@ void eDBoxLCD::update()
                memset(raw, 0, 64*64);
                for (y=0; y<64; y++)
                {
+                       int pix=0;
                        for (x=0; x<128 / 2; x++)
-                               raw[y*64+x] = (_buffer[y*132 + x * 2 + 2] & 0xF0) |(_buffer[y*132 + x * 2 + 1 + 2] >> 4);
+                       {
+                               pix = (_buffer[y*132 + x * 2 + 2] & 0xF0) |(_buffer[y*132 + x * 2 + 1 + 2] >> 4);
+                               if (inverted)
+                                       pix = 0xFF - pix;
+                               raw[y*64+x] = pix;
+                       }
                }
                if (lcdfd >= 0)
                        write(lcdfd, raw, 64*64);
index 0471843..0e50123 100644 (file)
@@ -44,9 +44,14 @@ def InitLcd():
 
                ilcd = LCD()
 
-               config.lcd.bright = ConfigSlider(default=10, limits=(0, 10))
+               config.lcd.standby = ConfigSlider(default=0, limits=(0, 10))
+               config.lcd.standby.addNotifier(setLCDbright);
+               config.lcd.standby.apply = lambda : setLCDbright(config.lcd.standby)
+
+               config.lcd.bright = ConfigSlider(default=5, limits=(0, 10))
                config.lcd.bright.addNotifier(setLCDbright);
                config.lcd.bright.apply = lambda : setLCDbright(config.lcd.bright)
+               config.lcd.bright.callNotifiersOnSaveAndCancel = True
 
                if not ilcd.isOled():
                        config.lcd.contrast = ConfigSlider(default=5, limits=(0, 20))
@@ -54,9 +59,6 @@ def InitLcd():
                else:
                        config.lcd.contrast = ConfigNothing()
 
-               config.lcd.standby = ConfigSlider(default=0, limits=(0, 10))
-               config.lcd.standby.apply = lambda : setLCDbright(config.lcd.standby)
-
                config.lcd.invert = ConfigYesNo(default=False)
                config.lcd.invert.addNotifier(setLCDinverted);
        else:
index c21a919..4ddcabe 100755 (executable)
@@ -34,6 +34,7 @@ class ConfigElement(object):
                self.save_disabled = False
                self.notifiers = []
                self.enabled = True
+               self.callNotifiersOnSaveAndCancel = False
 
        # you need to override this to do input validation
        def setValue(self, value):
@@ -66,9 +67,13 @@ class ConfigElement(object):
                        self.saved_value = None
                else:
                        self.saved_value = self.tostring(self.value)
+               if self.callNotifiersOnSaveAndCancel:
+                       self.changed()
 
        def cancel(self):
                self.load()
+               if self.callNotifiersOnSaveAndCancel:
+                       self.changed()
 
        def isChanged(self):
                sv = self.saved_value