-
Notifications
You must be signed in to change notification settings - Fork 0
/
k1-sigen.ino
79 lines (59 loc) · 1.47 KB
/
k1-sigen.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
/***************************************************
* Multi-instrumento
*
* Author: Pavel Milanes Costa
* Email: [email protected]
****************************************************/
// draw the VFO box
void vfobox() {
// draw vfo box
drawMainVFObox();
// main vfo
mainFreqPrint();
// Step
stepPrint();
// sub vfo
subFreqPrint(true);
}
// update the main freq
void mainFreqPrint() {
// set and prepare
tft.setCursor(6, 30);
tft.setTextColor(ILI9340_YELLOW, ILI9340_BLACK);
tft.setTextSize(4);
// prep freq for print
prepFreq4Print(*mainFreq, true);
// print it
tft.print(f);
}
// update the sub freq
void subFreqPrint(bool main) {
// set and prepare
tft.setCursor(142, 66);
tft.setTextColor(ILI9340_CYAN, ILI9340_BLACK);
tft.setTextSize(2);
// prep freq for print
if (main) prepFreq4Print(*subFreq, true);
else prepFreq4Print(*mainFreq, true);
// print it
tft.print(f);
}
// update the step
void stepPrint() {
tft.setCursor(10, 66);
tft.setTextColor(ILI9340_BLUE, ILI9340_BLACK);
tft.setTextSize(2);
tft.print(stepLabels[step]);
}
// move the VFO
void moveVFO(char dir, bool print) {
// move
*mainFreq += getStep() * dir;
// limit check
if (*mainFreq < LIMI_LOW) *mainFreq = LIMI_HIGH;
if (*mainFreq > LIMI_HIGH) *mainFreq = getStep();
// update freq
setFreq(*mainFreq);
// update the LCD
if (print) mainFreqPrint();
}