This repository has been archived by the owner on Mar 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathupdateLCD.ino
101 lines (88 loc) · 2.64 KB
/
updateLCD.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
void updateLCD() {
time_t t = now();
if (errorFlag == true) { //if error, skip normal display sequence
LCDmsgType = 0;
lcd.clear();
lcd.setCursor(0,0);
lcd.print("ESD triggered.");
lcd.setCursor(0,1);
lcd.print("Auto resets: ");
lcd.print(ESDresets);
} else if (millis() - LCDlastRefresh > 3000) {
//check what type of message was last displayed, and alternate
switch (LCDmsgType) {
case 1: //displays todays volume of water added
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Volume Today(L)");
lcd.setCursor(0,1);
lcd.print(totalVolume);
LCDmsgType ++;
break;
case 2: //displays instantaneous flow rate
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Flowrate(L/min)");
lcd.setCursor(0,1);
lcd.print(flowRate);
LCDmsgType ++;
break;
case 3: //displays yesterdays volume
lcd.clear();
lcd.setCursor(0,0);
lcd.print("Volume Yday(L)");
lcd.setCursor(0,1);
lcd.print(YDayVolume);
LCDmsgType ++;
break;
case 4: //displays current time and operating mode
lcd.clear();
lcd.setCursor(0,0);
//print hour
lcd.print(hour(t));
lcd.print(":");
//format and print minute
if (minute(t)<10) {
lcd.print("0");
}
lcd.print(minute(t));
//print seconds
lcd.print(":");
lcd.print(second(t));
lcd.setCursor(0,1);
switch (opMode) {
case 0:
lcd.print("Disabled");
break;
case 1:
lcd.print("Continuous Mode");
break;
case 2:
lcd.print("Daily Volume");
break;
case 3:
lcd.print("Top-Off Only");
break;
case 4:
lcd.print("Daily Timer");
break;
}
LCDmsgType ++;
break;
case 5:
lcd.clear();
if (checkInletPressure() == false) {
lcd.setCursor(0,0);
lcd.print("Inlet Press. Low");
lcd.setCursor(0,1);
lcd.print("Waiting to fill");
}
LCDmsgType = 1 ;
break;
default:
//do not update LCD
break;
}
LCDlastRefresh = millis();
}
}