-
Notifications
You must be signed in to change notification settings - Fork 4
/
menu.ino
67 lines (57 loc) · 1.62 KB
/
menu.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
//boolean bSetupMode = false;
unsigned long setupTimer;
int setupStage = -1;
bool checkMenu() {
// if (setupStage == -1) {
bool somethingPressed = false;
if (digitalRead(BUTTON_C) == false) {
somethingPressed = true;
if (millis() - setupTimer > 3000) {
setupTimer = millis();
setupStage = 1;
scd30.forceRecalibrationWithReference(400);
// display.clearDisplay();
// display.setTextSize(1);
// display.setCursor(0, 0);
// display.print("setup #");
// display.setCursor(500, 0);
// display.print(setupStage);
// display.display();
// }
}
//
}
if (setupStage == 1) {
unsigned long temp_diff = millis() - setupTimer;
if (temp_diff > 3000) {
somethingPressed = false;
setupStage = -1;
} else {
somethingPressed = true;
display.clearDisplay();
display.setTextSize(1);
display.setCursor(0, 0);
display.print("setting CO2");
display.setCursor(0, 10);
display.print("to 400 ppm");
// display.setCursor(60, 0);
// display.print(setupStage);
// display.setCursor(0, 0);
// display.print("setup #");
// display.setCursor(60, 0);
// display.print(setupStage);
display.setCursor(0, 20);
display.print( (3000 - temp_diff) );
display.display();
}
}
if (somethingPressed == false) {
setupTimer = millis();
}
if (setupStage != -1 || somethingPressed == true) {
return true;
} else {
return false;
}
// display.display();
}