LUA: show protocol2 only on receivers with serial1_TX or PWM pins defined (#2999)
[ExpressLRS.git] / src / lib / SCREEN / display.cpp
blobb284dbd8bc300cb286ca8be61552a319c2debbfb
1 #include "display.h"
2 #include "helpers.h"
4 extern bool OtaIsFullRes;
6 const char *Display::message_string[] = {
7 "ExpressLRS",
8 "[ Connected ]",
9 "[ ! Armed ! ]",
10 "[ Mismatch! ]"
13 const char *Display::main_menu_strings[][2] = {
14 {"PACKET", "RATE"},
15 {"SWITCH", "MODE"},
16 {"ANTENNA", "MODE"},
17 {"TX", "POWER"},
18 {"TELEM", "RATIO"},
19 {"MOTION", "DETECT"},
20 {"FAN", "CONTROL"},
21 {"BLE", "GAMEPAD"},
22 {"BIND", "MODE"},
23 {"WIFI", "ADMIN"},
24 {"VTX", "ADMIN"},
26 {"MAX", "POWER"},
27 {"DYNAMIC", "POWER"},
29 {"VTX", "BAND"},
30 {"VTX", "CHANNEL"},
31 {"VTX", "POWER"},
32 {"VTX", "PITMODE"},
33 {"VTX", "SEND"},
35 {"TX", "WIFI"},
36 {"RX", "WIFI"},
37 {"BACKPAC", "WIFI"},
38 {"VRX", "WIFI"},
41 #if defined(RADIO_SX128X)
42 const char *rate_string[] = {
43 "F1000Hz",
44 "F500Hz",
45 "D500Hz",
46 "D250Hz",
47 "500Hz",
48 "333 Full",
49 "250Hz",
50 "150Hz",
51 "100 Full",
52 "50Hz"
54 #elif defined(RADIO_LR1121)
55 static const char *rate_string[] = {
56 // 900
57 "200Hz",
58 "100 Full",
59 "100Hz",
60 "50Hz",
61 // 2.4
62 "500Hz",
63 "333 Full",
64 "250Hz",
65 "150Hz",
66 "100 Full",
67 "50Hz",
68 // Dual
69 "X150Hz",
70 "X100 Full",
71 // 900
72 "250Hz",
73 "200 Full",
75 #else
76 static const char *rate_string[] = {
77 "200Hz",
78 "100 Full",
79 "100Hz",
80 "50Hz",
81 "25Hz",
82 "D50Hz"
84 #endif
86 static const char *switch_mode[] = {
87 "Wide",
88 "Hybrid",
91 static const char *switch_mode_full[] = {
92 "8Ch",
93 "16Ch /2",
94 "12Ch Mix"
97 static const char *antenna_mode[] = {
98 "Gemini",
99 "Ant 1",
100 "Ant 2",
101 "Switch",
104 static const char *power_string[] = {
105 "10mW",
106 "25mW",
107 "50mW",
108 "100mW",
109 "250mW",
110 "500mW",
111 "1000mW",
112 "2000mW"
115 static const char *dynamic_string[] = {
116 "OFF",
117 "ON",
118 "AUX9",
119 "AUX10",
120 "AUX11",
121 "AUX12"
124 static const char *ratio_string[] = {
125 "Std",
126 "Off",
127 "1:128",
128 "1:64",
129 "1:32",
130 "1:16",
131 "1:8",
132 "1:4",
133 "1:2",
134 "Race"
137 static const char *ratio_curr_string[] = {
138 "Off",
139 "1:2",
140 "1:4",
141 "1:8",
142 "1:16",
143 "1:32",
144 "1:64",
145 "1:128"
148 static const char *powersaving_string[] = {
149 "OFF",
150 "ON"
153 static const char *smartfan_string[] = {
154 "AUTO",
155 "ON",
156 "OFF"
159 static const char *band_string[] = {
160 "OFF",
161 "A",
162 "B",
163 "E",
164 "F",
165 "R",
169 static const char *channel_string[] = {
170 "1",
171 "2",
172 "3",
173 "4",
174 "5",
175 "6",
176 "7",
180 static const char *vtx_power_string[] = {
181 "-",
182 "1",
183 "2",
184 "3",
185 "4",
186 "5",
187 "6",
188 "7",
192 static const char *pitmode_string[] = {
193 "OFF", "ON",
194 "AUX1 !+", "AUX1 !-",
195 "AUX2 !+", "AUX2 !-",
196 "AUX3 !+", "AUX3 !-",
197 "AUX4 !+", "AUX4 !-",
198 "AUX5 !+", "AUX5 !-",
199 "AUX6 !+", "AUX6 !-",
200 "AUX7 !+", "AUX7 !-",
201 "AUX8 !+", "AUX8 !-",
202 "AUX9 !+", "AUX9 !-",
203 "AUX10 !+", "AUX10 !-"
206 int Display::getValueCount(menu_item_t menu)
208 switch (menu)
210 case STATE_PACKET:
211 return ARRAY_SIZE(rate_string);
212 case STATE_SWITCH:
213 if (OtaIsFullRes)
215 return ARRAY_SIZE(switch_mode_full);
217 return ARRAY_SIZE(switch_mode);
218 case STATE_ANTENNA:
219 return ARRAY_SIZE(antenna_mode);
220 case STATE_TELEMETRY:
221 return ARRAY_SIZE(ratio_string);
222 case STATE_POWERSAVE:
223 return ARRAY_SIZE(powersaving_string);
224 case STATE_SMARTFAN:
225 return ARRAY_SIZE(smartfan_string);
227 case STATE_POWER:
228 case STATE_POWER_MAX:
229 return ARRAY_SIZE(power_string);
230 case STATE_POWER_DYNAMIC:
231 return ARRAY_SIZE(dynamic_string);
233 case STATE_VTX_BAND:
234 return ARRAY_SIZE(band_string);
235 case STATE_VTX_CHANNEL:
236 return ARRAY_SIZE(channel_string);
237 case STATE_VTX_POWER:
238 return ARRAY_SIZE(vtx_power_string);
239 case STATE_VTX_PITMODE:
240 return ARRAY_SIZE(pitmode_string);
241 default:
242 return 0;
246 const char *Display::getValue(menu_item_t menu, uint8_t value_index)
248 switch (menu)
250 case STATE_PACKET:
251 return rate_string[value_index];
252 case STATE_SWITCH:
253 if (OtaIsFullRes)
255 return switch_mode_full[value_index];
257 return switch_mode[value_index];
258 case STATE_ANTENNA:
259 return antenna_mode[value_index];
260 case STATE_TELEMETRY:
261 return ratio_string[value_index];
262 case STATE_TELEMETRY_CURR:
263 return ratio_curr_string[value_index];
264 case STATE_POWERSAVE:
265 return powersaving_string[value_index];
266 case STATE_SMARTFAN:
267 return smartfan_string[value_index];
269 case STATE_POWER:
270 case STATE_POWER_MAX:
271 return power_string[value_index];
272 case STATE_POWER_DYNAMIC:
273 return dynamic_string[value_index];
275 case STATE_VTX_BAND:
276 return band_string[value_index];
277 case STATE_VTX_CHANNEL:
278 return channel_string[value_index];
279 case STATE_VTX_POWER:
280 return vtx_power_string[value_index];
281 case STATE_VTX_PITMODE:
282 return pitmode_string[value_index];
283 default:
284 return nullptr;