MCPcopy Create free account
hub / github.com/BruceDevices/firmware / sendCustomRF

Function sendCustomRF

src/modules/rf/rf_send.cpp:20–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18FS *filesystem = NULL;
19
20void sendCustomRF() {
21 // interactive menu part only
22 struct RfCodes selected_code;
23
24 returnToMenu = true; // make sure menu is redrawn when quitting in any point
25
26 options = {
27 {"Recent", [&]() { selected_code = selectRecentRfMenu(); }},
28 {"LittleFS", [&]() { filesystem = &LittleFS; } },
29 };
30 if (setupSdCard()) options.insert(options.begin(), {"SD Card", [&]() { filesystem = &SD; }});
31
32 loopOptions(options);
33
34 if (filesystem == NULL) { // recent menu was selected
35 if (selected_code.filepath != "") sendRfCommand(selected_code); // a code was selected
36 return;
37 // no need to proceed, go back
38 }
39
40 returnToMenu = false;
41 filepath = "";
42
43 while (!returnToMenu) {
44 num_steps_keeloq = 1;
45 num_signal_repeat = 4;
46 delay(200);
47 filepath = loopSD(*filesystem, true, "SUB", "/BruceRF");
48 if (filepath == "" || check(EscPress)) return; // cancelled
49
50 RfCodes data{};
51
52 if (!readSubFile(filesystem, filepath, data)) continue;
53
54 if (data.protocol == "RcSwitch") {
55 loopEmulate(data);
56 } else {
57 txSubFile(data);
58 delay(200);
59 }
60 }
61}
62
63void set_option(int opt) {
64 switch (opt) {

Callers 1

StartupAppMethod · 0.85

Calls 10

selectRecentRfMenuFunction · 0.85
setupSdCardFunction · 0.85
sendRfCommandFunction · 0.85
loopSDFunction · 0.85
checkFunction · 0.85
readSubFileFunction · 0.85
loopEmulateFunction · 0.85
txSubFileFunction · 0.85
loopOptionsFunction · 0.50
beginMethod · 0.45

Tested by

no test coverage detected