-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMenuPrincipal.ino
125 lines (110 loc) · 4.56 KB
/
MenuPrincipal.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
void menuPrincipal()
{
comando = PARAR;
menu = MANUALL;
encoder.setPosition(menu);
pos = encoder.getPosition();
desenhaTitulo();
escolheOpcao();
}
void desenhaTitulo()
{
tft.fillScreen(LBLUE); // limpa a tela
tft.drawRoundRect(143, 11, 200, 50, 6, tft.color565(0, 0, 0)); // (x, y, largura, altura, arredondamento)
tft.fillRoundRect(144, 12, 198, 48, 4, LGREEN);
showmsg(163, 50, 2, BLACK, &FreeSansBold12pt7b, "M");
showmsg(207, 50, 2, BLACK, &FreeSansBold12pt7b, "E");
showmsg(243, 50, 2, BLACK, &FreeSansBold12pt7b, "N");
showmsg(283, 50, 2, BLACK, &FreeSansBold12pt7b, "U");
//showmsg(167, 51, 1, GELO, &FreeSansBold24pt7b, "M");
//showmsg(212, 51, 1, GELO, &FreeSansBold24pt7b, "E");
//showmsg(248, 51, 1, GELO, &FreeSansBold24pt7b, "N");
//showmsg(288, 51, 1, GELO, &FreeSansBold24pt7b, "U");
imprimeMenu();
}
void imprimeMenu()
{
switch (menu)
{
case MANUALL: // CURSOR EM MODO MANUAL
tft.drawRoundRect(80, 80, 320, 60, 10, WHITE); // (x, y, largura, altura, arredondamento)
tft.fillRoundRect(81, 81, 318, 58, 8, DBLUE);
showmsg(112, 120, 1, GELO, &FreeSansBold18pt7b, "Modo MANUAL");
tft.drawFastHLine(112, 125, 258, GELO);
tft.fillRoundRect(81, 161, 318, 58, 8, GELO);
tft.drawRoundRect(80, 160, 320, 60, 10, tft.color565(0, 0, 0)); // (x, y, largura, altura, arredondamento)
//showmsg(140, 200, 1, BLACK, &FreeSansBold18pt7b, "Modo TCFM");
showmsg(112, 200, 1, BLACK, &FreeSansBold18pt7b, "Modo TCFM");
tft.fillRoundRect(81, 241, 318, 58, 8, GELO);
tft.drawRoundRect(80, 240, 320, 60, 10, tft.color565(0, 0, 0)); // (x, y, largura, altura, arredondamento)
//showmsg(155, 280, 1, BLACK, &FreeSansBold18pt7b, "Modo TFA");
showmsg(112, 280, 1, BLACK, &FreeSansBold18pt7b, "Modo TFA");
break;
case TCFM: // CURSOR EM MODO TCFM
tft.drawRoundRect(80, 160, 320, 60, 10, WHITE); // (x, y, largura, altura, arredondamento)
tft.fillRoundRect(81, 161, 318, 58, 8, DBLUE);
//showmsg(140, 200, 1, GELO, &FreeSansBold18pt7b, "Modo TCFM");
showmsg(112, 200, 1, GELO, &FreeSansBold18pt7b, "Modo TCFM");
//tft.drawFastHLine(140, 205, 205, GELO);
tft.drawFastHLine(112, 205, 205, GELO);
tft.fillRoundRect(81, 81, 318, 58, 8, GELO);
tft.drawRoundRect(80, 80, 320, 60, 10, tft.color565(0, 0, 0)); // (x, y, largura, altura, arredondamento)
showmsg(112, 120, 1, BLACK, &FreeSansBold18pt7b, "Modo MANUAL");
tft.fillRoundRect(81, 241, 318, 58, 8, GELO);
tft.drawRoundRect(80, 240, 320, 60, 10, tft.color565(0, 0, 0)); // (x, y, largura, altura, arredondamento)
//showmsg(155, 280, 1, BLACK, &FreeSansBold18pt7b, "Modo TFA");
showmsg(112, 280, 1, BLACK, &FreeSansBold18pt7b, "Modo TFA");
break;
case TFAA: // CURSOR EM MODO MANUAL TFA
tft.drawRoundRect(80, 240, 320, 60, 10, WHITE); // (x, y, largura, altura, arredondamento)
tft.fillRoundRect(81, 241, 318, 58, 8, DBLUE);
//showmsg(155, 280, 1, GELO, &FreeSansBold18pt7b, "Modo TFA");
showmsg(112, 280, 1, GELO, &FreeSansBold18pt7b, "Modo TFA");
//tft.drawFastHLine(155, 285, 176, GELO);
tft.drawFastHLine(112, 285, 176, GELO);
tft.fillRoundRect(81, 81, 318, 58, 8, GELO);
tft.drawRoundRect(80, 80, 320, 60, 10, tft.color565(0, 0, 0)); // (x, y, largura, altura, arredondamento)
showmsg(112, 120, 1, BLACK, &FreeSansBold18pt7b, "Modo MANUAL");
tft.fillRoundRect(81, 161, 318, 58, 8, GELO);
tft.drawRoundRect(80, 160, 320, 60, 10, tft.color565(0, 0, 0)); // (x, y, largura, altura, arredondamento)
//showmsg(140, 200, 1, BLACK, &FreeSansBold18pt7b, "Modo TCFM");
showmsg(112, 200, 1, BLACK, &FreeSansBold18pt7b, "Modo TCFM");
break;
}
}
void escolheOpcao()
{
unsigned char pos_atual_encoder = 0;
while (true)
{
// Lê a posição do encoder e compara com a anterior
encoder.tick();
newPos = encoder.getPosition();
if (pos != newPos)
{
// Limite maximo menu
if (newPos > 3)
{
encoder.setPosition(1);
newPos = 1;
}
// Limite minimo menu
if (newPos < 1)
{
encoder.setPosition(3);
newPos = 3;
}
pos = newPos;
if (pos == 1)
menu = MANUALL;
else if (pos == 2)
menu = TCFM;
else
menu = TFAA;
imprimeMenu();
}
if (enterPressed)
break;
}
enterPressed = false;
}