This repository has been archived by the owner on Oct 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_30_display.ino
130 lines (106 loc) · 3.27 KB
/
_30_display.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
// 最後に取得した温度
extern float lastTemp;
extern float lastHumidity;
extern float lastPressure;
extern float lastLuxFull;
extern float lastLuxIr;
extern int lastPpm;
int display_last_ppm; // センサーがエラーの時でも値をホールドする変数
int MAX_BAR = 22; // reconfigure 待ちの bar本数
void showStartupScreen(String product_long) {
display.init();
if (needFlip) {
display.flipScreenVertically();
}
display.setFont(ArialMT_Plain_16);
display.clear();
display.setTextAlignment(TEXT_ALIGN_LEFT);
display.drawString(0, 0, "ziomatrix corp.");
display.drawString(0, 16, product_long);
display.drawString(0, 32, "initializing.");
display.drawString(0, 48, "Please wait");
display.display();
delay(1000);
}
void showWifiInfo(String ip, String mDNS) {
display.init();
if (needFlip) {
display.flipScreenVertically();
}
display.clear();
display.setTextAlignment(TEXT_ALIGN_LEFT);
display.setFont(ArialMT_Plain_10);
display.setFont(ArialMT_Plain_16);
display.drawString(0, 0, ssid);
display.drawString(0, 16, ip);
display.drawString(0, 32, mDNS);
display.drawString(0, 48, "Starting up...");
display.display();
delay(1000);
}
void showWiFiErrorScreen() {
// display init and show initial screen
display.init();
if (needFlip) {
display.flipScreenVertically();
}
display.setFont(ArialMT_Plain_16);
display.clear();
display.setTextAlignment(TEXT_ALIGN_LEFT);
display.drawString(0, 0, product + " *HALT*");
display.drawString(0, 16, "* Please Restart *");
display.drawString(0, 32, "WiFi connect err");
display.drawString(0, 48, "Check Settings");
display.display();
}
void showWaitForReconfig() {
display.init();
if (needFlip) {
display.flipScreenVertically();
}
display.clear();
display.setTextAlignment(TEXT_ALIGN_LEFT);
display.setFont(ArialMT_Plain_16);
display.drawString(0, 0, "Wait for re-config");
display.drawString(0, 32, "Power off now");
display.drawString(0, 48, " to re-configure");
for (int i = 0; i < MAX_BAR; i++) {
String bar = "*";
for(int j = 0; j < MAX_BAR; j++) {
bar = bar + ( (j <= i) ? "-" : " ");
}
display.drawString(0, 16, bar);
display.display();
delay(150);
}
}
void show_main(String ip, String mdns) {
display.clear();
display.setTextAlignment(TEXT_ALIGN_RIGHT);
display.setFont(ArialMT_Plain_10);
display.drawString(127, 0, "IP:" + ip);
display.drawString(127, 9, mDNS);
display.setTextAlignment(TEXT_ALIGN_LEFT);
display.drawString(0, 0, product);
display.setFont(ArialMT_Plain_16);
display.drawString(0, 19, "T:" + String(lastTemp, 1) + "c" + " " + "H:" + String(lastHumidity, 1) + "%" );
// LINE2
String line2 = "P:" + String(lastPressure, 1);
if (lastLuxFull >= 0) {
line2 = line2 + " " + "L:" + String(lastLuxFull, 0) + "lx";
} else {
line2 = line2 + " " + "L: -";
}
display.drawString(0, 34, line2);
if (lastPpm > 0) {
display.drawString(0, 49, String("CO2:") + String(lastPpm) + "ppm" );
display_last_ppm = lastPpm;
} else {
if (display_last_ppm > 0) {
display.drawString(0, 49, String("CO2:") + "** " + String(display_last_ppm) + "ppm" );
} else {
display.drawString(0, 49, String("CO2:") + "-" );
}
}
display.display();
}