diff -r c51265b518ce -r e54611453d29 thermferm/lcd-pcf8574.c --- a/thermferm/lcd-pcf8574.c Thu Nov 19 20:45:09 2015 +0100 +++ b/thermferm/lcd-pcf8574.c Thu Nov 19 21:17:26 2015 +0100 @@ -44,20 +44,26 @@ extern struct lcdDataStruct *lcds [MAX_LCDS]; #endif extern sys_config Config; - +extern uint16_t leds; /* * setBacklight: ********************************************************************************* */ -#ifdef HAVE_WIRINGPI_H -void setBacklight (int value) +void setBacklight(int value) { - pinMode (AF_BACKLIGHT, OUTPUT) ; - digitalWrite (AF_BACKLIGHT, (value & 1)) ; +#ifdef HAVE_WIRINGPI_H + pinMode (AF_BACKLIGHT, OUTPUT) ; + digitalWrite (AF_BACKLIGHT, (value & 1)) ; +#endif + if (value) { + leds |= SLED_LCD; + } else { + leds &= ~SLED_LCD; + } + slcdLEDs(slcdHandle); } -#endif /* @@ -65,7 +71,7 @@ ********************************************************************************* */ -int initLCD (int cols, int rows) +int initLCD(int cols, int rows) { if (!((rows == 1) || (rows == 2) || (rows == 4))) { fprintf (stderr, "rows must be 1, 2 or 4\n") ; @@ -92,7 +98,6 @@ } lcdClear (lcdHandle) ; - setBacklight (1) ; #endif slcdHandle = slcdInit(0, rows, cols); @@ -101,6 +106,7 @@ return -1; } slcdClear(slcdHandle); + setBacklight(1); return 0 ; }