# HG changeset patch # User Michiel Broek # Date 1456427547 -3600 # Node ID 7362ebd40f26d3e74e72cae30347c8cde44f3376 # Parent d676eaec0ee53f68ad1eb472e3221b9c896e94a3 Use user defined characters for the LCD display just like in Arduino projects. diff -r d676eaec0ee5 -r 7362ebd40f26 thermferm/lcd-buffer.c --- a/thermferm/lcd-buffer.c Mon Feb 22 19:24:49 2016 +0100 +++ b/thermferm/lcd-buffer.c Thu Feb 25 20:12:27 2016 +0100 @@ -162,28 +162,6 @@ else tmp = my_lcd_rows; } - -#ifdef HAVE_WIRINGPI_H -// lcdPosition(lcdHandle, 0, r); -// lcdPuts(lcdHandle, tmp->row); -#endif -// slcdPosition(slcdHandle, 0, r); -// slcdPuts(slcdHandle, tmp->row); - -// r++; -// if (r < Config.lcd_rows) { -// if (tmp->next != NULL) -// tmp = tmp->next; -// else -// tmp = my_lcd_rows; -#ifdef HAVE_WIRINGPI_H -// lcdPosition(lcdHandle, 0, r); -// lcdPuts(lcdHandle, tmp->row); -#endif -// slcdPosition(slcdHandle, 0, r); -// slcdPuts(slcdHandle, tmp->row); -// } - } diff -r d676eaec0ee5 -r 7362ebd40f26 thermferm/slcd.c --- a/thermferm/slcd.c Mon Feb 22 19:24:49 2016 +0100 +++ b/thermferm/slcd.c Thu Feb 25 20:12:27 2016 +0100 @@ -136,9 +136,14 @@ -//void slcdCharDef(int fd, int index, unsigned char data[8]) -//{ -//} +void slcdCharDef(int fd, int index, unsigned char data[8]) +{ + int i; + + putLCDsocket(fd, SLCD_CGRAM | ((index & 7) << 3)); + for (i = 0 ; i < 8 ; ++i) + putLCDsocket(fd, data[i]); +} diff -r d676eaec0ee5 -r 7362ebd40f26 thermferm/slcd.h --- a/thermferm/slcd.h Mon Feb 22 19:24:49 2016 +0100 +++ b/thermferm/slcd.h Thu Feb 25 20:12:27 2016 +0100 @@ -6,6 +6,7 @@ void slcdLEDs(int fd); void slcdClear(int fd); void slcdPosition(int fd, int x, int y); +void slcdCharDef(int fd, int index, unsigned char data[8]); void slcdPutchar(int fd, unsigned char c); void slcdPuts(int fd, const char *string); int slcdInit(int fd, int cols, int rows); diff -r d676eaec0ee5 -r 7362ebd40f26 thermferm/thermferm.c --- a/thermferm/thermferm.c Mon Feb 22 19:24:49 2016 +0100 +++ b/thermferm/thermferm.c Thu Feb 25 20:12:27 2016 +0100 @@ -59,6 +59,14 @@ extern int sock; +unsigned char degC[8] = { 0b01000, 0b10100, 0b01000, 0b00111, 0b01000, 0b01000, 0b01000, 0b00111 }; // [1] degree c sybmol +unsigned char SP_Symbol[8] = { 0b11100, 0b10000, 0b11100, 0b00111, 0b11101, 0b00111, 0b00100, 0b00100 }; // [2] SP Symbol +unsigned char CoolONOFF[8] = { 0b00000, 0b01110, 0b01000, 0b01000, 0b01000, 0b01000, 0b01110, 0b00000 }; // [3] Cool Symbol +unsigned char RevCoolONOFF[8] = { 0b11111, 0b10001, 0b10111, 0b10111, 0b10111, 0b10111, 0b10001, 0b11111 }; // [4] Reverse Cool Symbol +unsigned char HeatONOFF[8] = { 0b00000, 0b01010, 0b01010, 0b01110, 0b01110, 0b01010, 0b01010, 0b00000 }; // [5] HEAT symbol +unsigned char RevHeatONOFF[8] = { 0b11111, 0b10101, 0b10101, 0b10001, 0b10001, 0b10101, 0b10101, 0b11111 }; // [6] reverse HEAT symbol + + int server(void); void help(void); void die(int); @@ -857,6 +865,21 @@ return 1; } +#ifdef HAVE_WIRINGPI_H + lcdCharDef(lcdHandle, 1, degC); + lcdCharDef(lcdHandle, 2, SP_Symbol); + lcdCharDef(lcdHandle, 3, CoolONOFF); + lcdCharDef(lcdHandle, 4, RevCoolONOFF); + lcdCharDef(lcdHandle, 5, HeatONOFF); + lcdCharDef(lcdHandle, 6, RevHeatONOFF); +#endif + slcdCharDef(slcdHandle, 1, degC); + slcdCharDef(slcdHandle, 2, SP_Symbol); + slcdCharDef(slcdHandle, 3, CoolONOFF); + slcdCharDef(slcdHandle, 4, RevCoolONOFF); + slcdCharDef(slcdHandle, 5, HeatONOFF); + slcdCharDef(slcdHandle, 6, RevHeatONOFF); + if (debug) { /* * For debugging run in foreground. @@ -1107,7 +1130,7 @@ #ifdef HAVE_WIRINGPI_H piLock(LOCK_LCD); #endif - lcd_buf_write(row++, "Room temp %.1f %cC ", Config.temp_value / 1000.0, 0xdf); + lcd_buf_write(row++, "Room temp %.1f%c ", Config.temp_value / 1000.0, 0x01); #ifdef HAVE_WIRINGPI_H piUnlock(LOCK_LCD); #endif