Browse Source

Added custom sensor character

master
Robin Thoni 4 years ago
parent
commit
5c7e97c1e3
Signed by: Robin THONI <robin@rthoni.com> GPG Key ID: 4E09DEF46B99E61E
1 changed files with 14 additions and 1 deletions
  1. 14
    1
      main.ino

+ 14
- 1
main.ino View File

@@ -4,6 +4,7 @@
4 4
 
5 5
 #define HIBERNATE_DELAY 5000
6 6
 #define TEMP_TRIGGER 10
7
+#define LCD_CHAR_SENSOR 1
7 8
 
8 9
 #define PIN_BTN_MODE 11
9 10
 #define PIN_BTN_MINUS 10
@@ -16,6 +17,17 @@
16 17
 #define PIN_LCD_D2 3
17 18
 #define PIN_LCD_D3 2
18 19
 
20
+byte g_sensorChar[8] = {
21
+        B00100,
22
+        B01110,
23
+        B01110,
24
+        B01110,
25
+        B01110,
26
+        B11111,
27
+        B11111,
28
+        B01110,
29
+};
30
+
19 31
 Button g_btnMode(PIN_BTN_MODE);
20 32
 Button g_btnMinus(PIN_BTN_MINUS);
21 33
 Button g_btnPlus(PIN_BTN_PLUS);
@@ -50,7 +62,7 @@ void printStateLine(char prefix, const BoilerLineState& boilerLineState, bool is
50 62
     char curTmp[5], setTmp[5], tmp[17];
51 63
     dtostrf(boilerLineState.current / 2.0f, 2, 1, curTmp);
52 64
     dtostrf(boilerLineState.setting / 2.0f, 2, 1, setTmp);
53
-    int count = snprintf(tmp, sizeof(tmp), "%c: %s [%s]%c%c", prefix, curTmp, setTmp, isModifying ? '<' : ' ', isActive ? 'o' : ' ');
65
+    int count = snprintf(tmp, sizeof(tmp), "%c: %s [%s]%c%c", prefix, curTmp, setTmp, isModifying ? '<' : ' ', isActive ? LCD_CHAR_SENSOR : ' ');
54 66
     for (; count < 17; ++count)
55 67
     {
56 68
         tmp[count] = ' ';
@@ -78,6 +90,7 @@ void setup()
78 90
     digitalWrite(PIN_LCD_LED, 1);
79 91
 
80 92
     g_lcd.begin(16, 2);
93
+    g_lcd.createChar(LCD_CHAR_SENSOR, g_sensorChar);
81 94
     printState(g_boilerState, g_lcd);
82 95
 
83 96
     Serial.begin(9600);

Loading…
Cancel
Save