| 18 | FS *filesystem = NULL; |
| 19 | |
| 20 | void 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 | |
| 63 | void set_option(int opt) { |
| 64 | switch (opt) { |
no test coverage detected