From a90424c0dc460b587898b65f6a89a564399ab551 Mon Sep 17 00:00:00 2001 From: ghost Date: Fri, 7 Nov 2008 20:35:57 +0100 Subject: [PATCH] fix non working invert of oled display add non working standby slider in display setup --- lib/gdi/lcd.cpp | 8 +++++++- lib/python/Components/Lcd.py | 10 ++++++---- lib/python/Components/config.py | 5 +++++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/lib/gdi/lcd.cpp b/lib/gdi/lcd.cpp index 39117194..ecc19b53 100644 --- a/lib/gdi/lcd.cpp +++ b/lib/gdi/lcd.cpp @@ -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); diff --git a/lib/python/Components/Lcd.py b/lib/python/Components/Lcd.py index 0471843c..0e501237 100644 --- a/lib/python/Components/Lcd.py +++ b/lib/python/Components/Lcd.py @@ -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: diff --git a/lib/python/Components/config.py b/lib/python/Components/config.py index c21a9192..4ddcabec 100755 --- a/lib/python/Components/config.py +++ b/lib/python/Components/config.py @@ -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 -- 2.30.2