Skip to content

Commit

Permalink
fixed recent menu in customSubGhz (pr3y#66)
Browse files Browse the repository at this point in the history
  • Loading branch information
eadmaster committed Jul 23, 2024
1 parent 0f3ba0f commit 8c659a6
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/rf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ struct RfCodes selectRecentMenu() {
for(int i=0; i<16; i++) {
if(recent_rfcodes[i].filepath=="") continue; // not inited
// else
options.push_back({ recent_rfcodes[i].filepath.c_str(), [&](){ selected_code = recent_rfcodes[i]; }});
options.push_back({ recent_rfcodes[i].filepath.c_str(), [i, &selected_code](){ selected_code = recent_rfcodes[i]; }});
}
options.push_back({ "Main Menu" , [&](){ exit=true; }});
delay(200);
Expand All @@ -375,10 +375,9 @@ void otherRFcodes() {
File databaseFile;
FS *fs = NULL;
String filepath = "";
struct RfCodes selected_code ;
bool recent_menu_selected = false;
struct RfCodes selected_code;
options = {
//WIP: {"Recent", [&]() { selected_code = selectRecentMenu(); recent_menu_selected = true;}},
{"Recent", [&]() { selected_code = selectRecentMenu(); }},
{"LittleFS", [&]() { fs=&LittleFS; }},
};
if(setupSdCard()) options.push_back({"SD Card", [&]() { fs=&SD; }});
Expand All @@ -387,7 +386,7 @@ void otherRFcodes() {
loopOptions(options);
delay(200);

if(recent_menu_selected == true) {
if(fs == NULL) { // recent menu was selected
if(selected_code.filepath!="") sendRfCommand(selected_code); // a code was selected
return;
// no need to proceed, go back
Expand Down

0 comments on commit 8c659a6

Please sign in to comment.