-
Notifications
You must be signed in to change notification settings - Fork 0
/
displays.ino
192 lines (174 loc) · 4.32 KB
/
displays.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
void display_mem()
{
tft.setCursor(memx +75, memy+5); //(185, 12);
tft.setTextSize(3);
tft.setTextColor(GREEN, GREY);
if (memCh < 10)
tft.print("0");
tft.print(memCh);
if (memCh < 100)
tft.print(" ");
if (!xch_M)
read_ch();
else
xch_M = 0;
if (vfo_M_sel)
{
vfo = vfo_M;
bfo = bfo_M;
display_bfo();
set_bfo();
sideband = sb_M;
display_sideband();
display_frequency();
}
else
display_frequency2();
}
void display_mem_msg(String msg)
{
tft.setCursor(memx +10, memy+5); //(185, 12);
tft.setTextSize(3);
tft.setTextColor(RED, GREY);
tft.print(msg);
}
void displ_rx()
{
tft.drawRoundRect(txrx, txry, txrwd, txrht, roundness, RED); // TxRx box outline
tft.fillRoundRect(txrx+2, txry+2, txrwd-4, txrht-4, roundness -4, GREEN); //TxRx box
tft.setCursor(txrx+10, txry+5);
tft.setTextSize(3);
tft.setTextColor(BLUE);
tft.print("Rx");
}
void displ_tx()
{
tft.drawRoundRect(txrx, txry, txrwd, txrht, roundness, RED); // TxRx box outline
tft.fillRoundRect(txrx+2, txry+2, txrwd-4, txrht-4, roundness -4, RED); //TxRx box
tft.setCursor(txrx+10, txry+5);
tft.setTextSize(3);
tft.setTextColor(BLUE);
tft.print("Tx");
}
void display_vfo()
{
tft.setCursor(vfoABMx,vfoABMy); //(25, 50);
tft.setTextSize(4);
tft.setTextColor(WHITE, BLACK);
old_band = bnd_count;
if (vfo_M_sel)
tft.print("M"); // Mem ....
else if (vfo_A_sel)
tft.print("A"); // VFO A or B ....
else
tft.print("B"); // VFO A or B ....
display_frequency2(); // 2nd line of display only when vfos changed
set_band(); // select and display band according to frequency displayed
display_band();
}
void display_frequency()
{
tft.setTextSize(4);
tft.setTextColor(WHITE, BLACK);
tft.setCursor(frqx+20, frqy+8); //(70, 50);
if (vfo < 10000000)
tft.print(" ");
tft.print(vfo / 1000.0, 3);
}
void display_frequency2()
{
//other 2 vfo's displayed below
tft.setTextSize(2);
tft.setTextColor(WHITE, BLACK);
tft.setCursor(frq2x1, frq2y); //(25, 93);
if (vfo_A_sel)
{
tft.print("B ");
tft.print(vfo_B / 1000.0, 3);
tft.setCursor(frq2x2, frq2y); // (170, 93);
tft.print("M ");
tft.print(vfo_M / 1000.0, 3);
tft.print(" "); // takes care of previous leftover digit
}
if (vfo_B_sel)
{ tft.print("A ");
tft.print(vfo_A / 1000.0, 3);
tft.setCursor( frq2x2, frq2y); //(170, 93);
tft.print("M ");
tft.print(vfo_M / 1000.0, 3);
tft.print(" ");
}
if (vfo_M_sel)
{
tft.print("A ");
tft.print(vfo_A / 1000.0, 3);
tft.setCursor(frq2x2, frq2y); //(170, 93);
tft.print("B ");
tft.print(vfo_B / 1000.0, 3);
tft.print(" ");
}
} // end of display_frequency2()
void set_band() // from frequecy determine band and activate corresponding relay
{
for (int i = MAX_BANDS; i >= 0; i--)
{
if ((vfo >= F_MIN_T[i]) && (vfo <= F_MAX_T[i]))
{
bnd_count = i ;
break;
}
}
digitalWrite(band_cntrl[old_band], LOW); // deactivate old band relay
digitalWrite(band_cntrl[bnd_count], HIGH); // activate new selected band
}
void display_band()
{
tft.setCursor(bandx+2, bandy+10); //22, 125);
tft.setTextSize(2);
tft.setTextColor(WHITE, GREY);
// changed_f = 1; // ???? why here
tft.print(B_NAME_T[bnd_count]);
} // end of Display-band()
void change_band() {
display_band();
F_MIN = F_MIN_T[bnd_count];
F_MAX = F_MAX_T[bnd_count];
vfo = VFO_T[bnd_count];
// set_band();
changed_f = 1;
} // end of change_band()
// Displays the frequency change step
void display_step()
{ tft.setCursor(stpx+3, stpy+10); // (117, 125);
tft.setTextSize(2);
tft.setTextColor(WHITE, GREY);
tft.print(step_sz_txt[step_index]);
}
void display_sideband() {
tft.setCursor(sbx+18, sby+10); //(261, 125);
tft.setTextSize(2);
tft.setTextColor(RED, GREEN);
if (sideband == LSB)
{
tft.print("LSB");
}
else if (sideband == USB)
{
tft.print("USB");
}
}
void display_bfo()
{
tft.setTextSize(2);
tft.setTextColor(WHITE, GREY);
tft.setCursor(bfox+16, bfoy+10); //(130, 164); // also in setup_vfo_screen
if (bfo < 10000000)
tft.print(" ");
tft.print(bfo);
}
void display_msg(int xposn, String msg)
{ tft.setTextSize(2); // may setp some soft buttons here
tft.setCursor(xposn, boty); //223);
tft.setTextColor(WHITE, BLUE);
tft.println(msg);
}