MCPcopy Create free account
hub / github.com/cifertech/nRFBox / blackoutLoop

Function blackoutLoop

nRFBox_V2/blackout.cpp:214–281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

212}
213
214void blackoutLoop() {
215 checkMode();
216
217 static Operation lastMode = DEACTIVE_MODE;
218
219 if (current != lastMode) {
220 lastMode = current;
221 initialize_Radios();
222 update_OLED();
223 }
224
225 if (current_Mode == BLE_MODULE) {
226 int randomIndex = random(0, sizeof(ble_channels) / sizeof(ble_channels[0]));
227 int channel = ble_channels[randomIndex];
228 radio_1.setChannel(channel);
229 radio_2.setChannel(channel);
230 radio_3.setChannel(channel);
231
232 } else if (current_Mode == Bluetooth_MODULE) {
233 int randomIndex = random(0, sizeof(bluetooth_channels) / sizeof(bluetooth_channels[0]));
234 int channel = bluetooth_channels[randomIndex];
235 radio_1.setChannel(channel);
236 radio_2.setChannel(channel);
237 radio_3.setChannel(channel);
238
239 }else if (current_Mode == WiFi_MODULE) {
240 int randomIndex = random(0, sizeof(WiFi_channels) / sizeof(WiFi_channels[0]));
241 int channel = WiFi_channels[randomIndex];
242 radio_1.setChannel(channel);
243 radio_2.setChannel(channel);
244 radio_3.setChannel(channel);
245
246 }else if (current_Mode == USB_WIRELESS_MODULE) {
247 int randomIndex = random(0, sizeof(usbWireless_channels) / sizeof(usbWireless_channels[0]));
248 int channel = usbWireless_channels[randomIndex];
249 radio_1.setChannel(channel);
250 radio_2.setChannel(channel);
251 radio_3.setChannel(channel);
252
253 }else if (current_Mode == VIDEO_TX_MODULE) {
254 int randomIndex = random(0, sizeof(videoTransmitter_channels) / sizeof(videoTransmitter_channels[0]));
255 int channel = videoTransmitter_channels[randomIndex];
256 radio_1.setChannel(channel);
257 radio_2.setChannel(channel);
258 radio_3.setChannel(channel);
259
260 }else if (current_Mode == RC_MODULE) {
261 int randomIndex = random(0, sizeof(rc_channels) / sizeof(rc_channels[0]));
262 int channel = rc_channels[randomIndex];
263 radio_1.setChannel(channel);
264 radio_2.setChannel(channel);
265 radio_3.setChannel(channel);
266
267 }else if (current_Mode == ZIGBEE_MODULE) {
268 int randomIndex = random(0, sizeof(zigbee_channels) / sizeof(zigbee_channels[0]));
269 int channel = zigbee_channels[randomIndex];
270 radio_1.setChannel(channel);
271 radio_2.setChannel(channel);

Callers

nothing calls this directly

Calls 3

checkModeFunction · 0.85
initialize_RadiosFunction · 0.85
update_OLEDFunction · 0.85

Tested by

no test coverage detected