55 #endif |
55 #endif |
56 extern const char UNITMODE[5][8]; |
56 extern const char UNITMODE[5][8]; |
57 extern const char PROFSTATE[4][6]; |
57 extern const char PROFSTATE[4][6]; |
58 |
58 |
59 extern int sock; |
59 extern int sock; |
|
60 |
|
61 |
|
62 unsigned char degC[8] = { 0b01000, 0b10100, 0b01000, 0b00111, 0b01000, 0b01000, 0b01000, 0b00111 }; // [1] degree c sybmol |
|
63 unsigned char SP_Symbol[8] = { 0b11100, 0b10000, 0b11100, 0b00111, 0b11101, 0b00111, 0b00100, 0b00100 }; // [2] SP Symbol |
|
64 unsigned char CoolONOFF[8] = { 0b00000, 0b01110, 0b01000, 0b01000, 0b01000, 0b01000, 0b01110, 0b00000 }; // [3] Cool Symbol |
|
65 unsigned char RevCoolONOFF[8] = { 0b11111, 0b10001, 0b10111, 0b10111, 0b10111, 0b10111, 0b10001, 0b11111 }; // [4] Reverse Cool Symbol |
|
66 unsigned char HeatONOFF[8] = { 0b00000, 0b01010, 0b01010, 0b01110, 0b01110, 0b01010, 0b01010, 0b00000 }; // [5] HEAT symbol |
|
67 unsigned char RevHeatONOFF[8] = { 0b11111, 0b10101, 0b10101, 0b10001, 0b10001, 0b10101, 0b10101, 0b11111 }; // [6] reverse HEAT symbol |
60 |
68 |
61 |
69 |
62 int server(void); |
70 int server(void); |
63 void help(void); |
71 void help(void); |
64 void die(int); |
72 void die(int); |
855 if ((rc = initLCD (Config.lcd_cols, Config.lcd_rows))) { |
863 if ((rc = initLCD (Config.lcd_cols, Config.lcd_rows))) { |
856 fprintf(stderr, "Cannot initialize LCD display, rc=%d\n", rc); |
864 fprintf(stderr, "Cannot initialize LCD display, rc=%d\n", rc); |
857 return 1; |
865 return 1; |
858 } |
866 } |
859 |
867 |
|
868 #ifdef HAVE_WIRINGPI_H |
|
869 lcdCharDef(lcdHandle, 1, degC); |
|
870 lcdCharDef(lcdHandle, 2, SP_Symbol); |
|
871 lcdCharDef(lcdHandle, 3, CoolONOFF); |
|
872 lcdCharDef(lcdHandle, 4, RevCoolONOFF); |
|
873 lcdCharDef(lcdHandle, 5, HeatONOFF); |
|
874 lcdCharDef(lcdHandle, 6, RevHeatONOFF); |
|
875 #endif |
|
876 slcdCharDef(slcdHandle, 1, degC); |
|
877 slcdCharDef(slcdHandle, 2, SP_Symbol); |
|
878 slcdCharDef(slcdHandle, 3, CoolONOFF); |
|
879 slcdCharDef(slcdHandle, 4, RevCoolONOFF); |
|
880 slcdCharDef(slcdHandle, 5, HeatONOFF); |
|
881 slcdCharDef(slcdHandle, 6, RevHeatONOFF); |
|
882 |
860 if (debug) { |
883 if (debug) { |
861 /* |
884 /* |
862 * For debugging run in foreground. |
885 * For debugging run in foreground. |
863 */ |
886 */ |
864 rc = server(); |
887 rc = server(); |
1105 Config.temp_value = temp; |
1128 Config.temp_value = temp; |
1106 Config.temp_state = 0; |
1129 Config.temp_state = 0; |
1107 #ifdef HAVE_WIRINGPI_H |
1130 #ifdef HAVE_WIRINGPI_H |
1108 piLock(LOCK_LCD); |
1131 piLock(LOCK_LCD); |
1109 #endif |
1132 #endif |
1110 lcd_buf_write(row++, "Room temp %.1f %cC ", Config.temp_value / 1000.0, 0xdf); |
1133 lcd_buf_write(row++, "Room temp %.1f%c ", Config.temp_value / 1000.0, 0x01); |
1111 #ifdef HAVE_WIRINGPI_H |
1134 #ifdef HAVE_WIRINGPI_H |
1112 piUnlock(LOCK_LCD); |
1135 piUnlock(LOCK_LCD); |
1113 #endif |
1136 #endif |
1114 } else if (rc == DEVPRESENT_ERROR) { |
1137 } else if (rc == DEVPRESENT_ERROR) { |
1115 Config.temp_state = 1; |
1138 Config.temp_state = 1; |