-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Expand file tree
/
Copy pathRFMenu.cpp
More file actions
144 lines (134 loc) · 4.19 KB
/
RFMenu.cpp
File metadata and controls
144 lines (134 loc) · 4.19 KB
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
#include "RFMenu.h"
#include "core/display.h"
#include "core/settings.h"
#include "core/utils.h"
#include "modules/rf/record.h"
#include "modules/rf/rf_bruteforce.h"
#include "modules/rf/rf_chat.h" // ← RF Chat
#include "modules/rf/rf_jammer.h"
#include "modules/rf/rf_listen.h"
#include "modules/rf/rf_scan.h"
#include "modules/rf/rf_send.h"
#include "modules/rf/rf_spectrum.h"
#include "modules/rf/rf_waterfall.h"
void RFMenu::optionsMenu() {
options = {
{"Scan/copy", [=]() { RFScan(); } },
#if !defined(LITE_VERSION)
{"Record RAW", rf_raw_record }, // Pablo-Ortiz-Lopez
{"Custom SubGhz", sendCustomRF },
#endif
{"Spectrum", rf_spectrum },
#if !defined(LITE_VERSION)
{"RSSI Spectrum", rf_CC1101_rssi }, // @Pirata
{"SquareWave Spec", rf_SquareWave }, // @Pirata
{"Spectogram", rf_waterfall }, // dev_eclipse
#if defined(BUZZ_PIN) or defined(HAS_NS4168_SPKR) and defined(RF_LISTEN_H)
{"Listen", rf_listen }, // dev_eclipse
#endif
{"Bruteforce", rf_bruteforce }, // dev_eclipse
{"RF Chat", rf_chat }, // CC1101 p2p chat
{"Jammer Itmt", [=]() { RFJammer(false); }},
#endif
{"Jammer Full", [=]() { RFJammer(true); } },
{"Config", [this]() { configMenu(); }},
};
addOptionToMainMenu();
delay(200);
String txt = "Radio Frequency";
if (bruceConfigPins.rfModule == CC1101_SPI_MODULE) txt += " (CC1101)";
else txt += " Tx: " + String(bruceConfigPins.rfTx) + " Rx: " + String(bruceConfigPins.rfRx);
loopOptions(options, MENU_TYPE_SUBMENU, txt.c_str());
}
void RFMenu::configMenu() {
options = {
{"RF TX Pin", lambdaHelper(gsetRfTxPin, true)},
{"RF RX Pin", lambdaHelper(gsetRfRxPin, true)},
{"RF Module", setRFModuleMenu },
{"RF Frequency", setRFFreqMenu },
{"Chat Username", rf_chat_change_username }, // RF Chat nickname
{"Chat Frequency", rf_chat_change_freq }, // RF Chat frequency
{"Back", [this]() { optionsMenu(); } },
};
loopOptions(options, MENU_TYPE_SUBMENU, "RF Config");
}
void RFMenu::drawIcon(float scale) {
clearIconArea();
int radius = scale * 7;
int deltaRadius = scale * 10;
int triangleSize = scale * 30;
if (triangleSize % 2 != 0) triangleSize++;
// Body
tft.fillCircle(iconCenterX, iconCenterY - radius, radius, bruceConfig.priColor);
tft.fillTriangle(
iconCenterX,
iconCenterY,
iconCenterX - triangleSize / 2,
iconCenterY + triangleSize,
iconCenterX + triangleSize / 2,
iconCenterY + triangleSize,
bruceConfig.priColor
);
// Left Arcs
tft.drawArc(
iconCenterX,
iconCenterY - radius,
2.5 * radius,
2 * radius,
40,
140,
bruceConfig.priColor,
bruceConfig.bgColor
);
tft.drawArc(
iconCenterX,
iconCenterY - radius,
2.5 * radius + deltaRadius,
2 * radius + deltaRadius,
40,
140,
bruceConfig.priColor,
bruceConfig.bgColor
);
tft.drawArc(
iconCenterX,
iconCenterY - radius,
2.5 * radius + 2 * deltaRadius,
2 * radius + 2 * deltaRadius,
40,
140,
bruceConfig.priColor,
bruceConfig.bgColor
);
// Right Arcs
tft.drawArc(
iconCenterX,
iconCenterY - radius,
2.5 * radius,
2 * radius,
220,
320,
bruceConfig.priColor,
bruceConfig.bgColor
);
tft.drawArc(
iconCenterX,
iconCenterY - radius,
2.5 * radius + deltaRadius,
2 * radius + deltaRadius,
220,
320,
bruceConfig.priColor,
bruceConfig.bgColor
);
tft.drawArc(
iconCenterX,
iconCenterY - radius,
2.5 * radius + 2 * deltaRadius,
2 * radius + 2 * deltaRadius,
220,
320,
bruceConfig.priColor,
bruceConfig.bgColor
);
}