Only update the backlight setting if a change is necessary
This commit is contained in:
@@ -63,6 +63,7 @@ v.0.5dev (ongoing development)
|
|||||||
+ serialVFD driver: support Siemens/Wincor Nixdorf BA63/66 (Stefan Herdler)
|
+ serialVFD driver: support Siemens/Wincor Nixdorf BA63/66 (Stefan Herdler)
|
||||||
+ new client lcdident.pl (Ethan Dicks)
|
+ new client lcdident.pl (Ethan Dicks)
|
||||||
* server: prevent stalling if time goes backwards (M. Vallevand)
|
* server: prevent stalling if time goes backwards (M. Vallevand)
|
||||||
|
* hd44780 driver: update the backlight setting only on change
|
||||||
|
|
||||||
v.0.5.2
|
v.0.5.2
|
||||||
* fix switching on/off the Load screen in lcdproc client using the menu
|
* fix switching on/off the Load screen in lcdproc client using the menu
|
||||||
|
|||||||
@@ -195,6 +195,7 @@ typedef struct hd44780_private_data {
|
|||||||
int contrast; // Contrast setting (range 0 - 1000)
|
int contrast; // Contrast setting (range 0 - 1000)
|
||||||
int brightness; // Brightness when backlight is "on" (range 0 - 1000)
|
int brightness; // Brightness when backlight is "on" (range 0 - 1000)
|
||||||
int offbrightness; // Brightness when backlight is "off" (range 0 - 1000)
|
int offbrightness; // Brightness when backlight is "off" (range 0 - 1000)
|
||||||
|
int backlightstate; // Saves the last backlight state
|
||||||
} PrivateData;
|
} PrivateData;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -158,6 +158,7 @@ HD44780_init(Driver *drvthis)
|
|||||||
p->cellheight = 8; /* Do not change this !!! This is a controller property, not a display property !!! */
|
p->cellheight = 8; /* Do not change this !!! This is a controller property, not a display property !!! */
|
||||||
p->cellwidth = 5;
|
p->cellwidth = 5;
|
||||||
p->ccmode = standard;
|
p->ccmode = standard;
|
||||||
|
p->backlightstate = -1; // Init to invalid value
|
||||||
|
|
||||||
|
|
||||||
//// READ THE CONFIG FILE
|
//// READ THE CONFIG FILE
|
||||||
@@ -842,7 +843,9 @@ HD44780_set_brightness(Driver *drvthis, int state, int promille)
|
|||||||
else {
|
else {
|
||||||
p->offbrightness = promille;
|
p->offbrightness = promille;
|
||||||
}
|
}
|
||||||
//HD44780_backlight(drvthis, state);
|
|
||||||
|
// Make last backlight state invalid to force update on next rendering
|
||||||
|
p->backlightstate = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -856,13 +859,14 @@ HD44780_backlight(Driver *drvthis, int on)
|
|||||||
{
|
{
|
||||||
PrivateData *p = (PrivateData *) drvthis->private_data;
|
PrivateData *p = (PrivateData *) drvthis->private_data;
|
||||||
|
|
||||||
// not sure if this is the correct solution.
|
// Immediately return if no backlight is available or no change is necessary
|
||||||
// alternative: return immediately
|
if (!p->have_backlight || p->backlightstate == on)
|
||||||
if (!p->have_backlight)
|
return;
|
||||||
on = 0;
|
|
||||||
|
|
||||||
if (p->hd44780_functions->backlight != NULL)
|
if (p->hd44780_functions->backlight != NULL)
|
||||||
p->hd44780_functions->backlight(p, on);
|
p->hd44780_functions->backlight(p, on);
|
||||||
|
|
||||||
|
p->backlightstate = on;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user