From 8c659a67bc8e05fd6b7886b2e7b84b0f76b4e5e4 Mon Sep 17 00:00:00 2001 From: eadmaster <925171+eadmaster@users.noreply.github.com> Date: Tue, 23 Jul 2024 08:42:22 +0200 Subject: [PATCH] fixed recent menu in customSubGhz (#66) --- src/rf.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/rf.cpp b/src/rf.cpp index 366df9ae..c8b0bd37 100644 --- a/src/rf.cpp +++ b/src/rf.cpp @@ -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); @@ -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; }}); @@ -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