mirror of
https://github.com/justcallmekoko/ESP32Marauder.git
synced 2025-12-21 23:00:51 -08:00
Fix EP HTML file menu
This commit is contained in:
@@ -14,8 +14,6 @@ void EvilPortal::setup() {
|
|||||||
|
|
||||||
html_files = new LinkedList<String>();
|
html_files = new LinkedList<String>();
|
||||||
|
|
||||||
html_files->add("Back");
|
|
||||||
|
|
||||||
#ifdef HAS_SD
|
#ifdef HAS_SD
|
||||||
if (sd_obj.supported) {
|
if (sd_obj.supported) {
|
||||||
sd_obj.listDirToLinkedList(html_files, "/", "html");
|
sd_obj.listDirToLinkedList(html_files, "/", "html");
|
||||||
|
|||||||
@@ -1790,44 +1790,25 @@ void MenuFunctions::RunSetup()
|
|||||||
});
|
});
|
||||||
#else // Mini EP HTML select
|
#else // Mini EP HTML select
|
||||||
this->addNodes(&wifiGeneralMenu, "Select EP HTML File", TFTCYAN, NULL, KEYBOARD_ICO, [this](){
|
this->addNodes(&wifiGeneralMenu, "Select EP HTML File", TFTCYAN, NULL, KEYBOARD_ICO, [this](){
|
||||||
this->changeMenu(&htmlMenu);
|
// Add the back button
|
||||||
#if (defined(HAS_BUTTONS) && defined(HAS_SD))
|
htmlMenu.list->clear();
|
||||||
#if !(defined(MARAUDER_V6) || defined(MARAUDER_V6_1))
|
this->addNodes(&htmlMenu, text09, TFTLIGHTGREY, NULL, 0, [this]() {
|
||||||
while(true) {
|
this->changeMenu(htmlMenu.parentMenu);
|
||||||
if (d_btn.justPressed()) {
|
});
|
||||||
if (evil_portal_obj.selected_html_index > 0)
|
|
||||||
evil_portal_obj.selected_html_index--;
|
|
||||||
else
|
|
||||||
evil_portal_obj.selected_html_index = evil_portal_obj.html_files->size() - 1;
|
|
||||||
|
|
||||||
this->htmlMenu.list->set(0, MenuNode{evil_portal_obj.html_files->get(evil_portal_obj.selected_html_index), false, TFTCYAN, 0, NULL, true, NULL});
|
// Populate the menu with buttons
|
||||||
this->buildButtons(&htmlMenu);
|
for (int i = 0; i < evil_portal_obj.html_files->size(); i++) {
|
||||||
this->displayCurrentMenu();
|
// This is the menu node
|
||||||
}
|
this->addNodes(&htmlMenu, evil_portal_obj.html_files->get(i), TFTCYAN, NULL, 255, [this, i](){
|
||||||
#if !defined(MARAUDER_M5STICKC) || defined(MARAUDER_M5STICKCP2)
|
evil_portal_obj.selected_html_index = i;
|
||||||
if (u_btn.justPressed()) {
|
|
||||||
if (evil_portal_obj.selected_html_index < evil_portal_obj.html_files->size() - 1)
|
|
||||||
evil_portal_obj.selected_html_index++;
|
|
||||||
else
|
|
||||||
evil_portal_obj.selected_html_index = 0;
|
|
||||||
|
|
||||||
this->htmlMenu.list->set(0, MenuNode{evil_portal_obj.html_files->get(evil_portal_obj.selected_html_index), false, TFTCYAN, 0, NULL, true, NULL});
|
|
||||||
this->buildButtons(&htmlMenu, 0, evil_portal_obj.html_files->get(evil_portal_obj.selected_html_index));
|
|
||||||
this->displayCurrentMenu();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if (c_btn.justPressed()) {
|
|
||||||
if (evil_portal_obj.html_files->get(evil_portal_obj.selected_html_index) != "Back") {
|
|
||||||
evil_portal_obj.target_html_name = evil_portal_obj.html_files->get(evil_portal_obj.selected_html_index);
|
evil_portal_obj.target_html_name = evil_portal_obj.html_files->get(evil_portal_obj.selected_html_index);
|
||||||
Serial.println("Set Evil Portal HTML as " + evil_portal_obj.target_html_name);
|
Serial.println("Set Evil Portal HTML as " + evil_portal_obj.target_html_name);
|
||||||
evil_portal_obj.using_serial_html = false;
|
evil_portal_obj.using_serial_html = false;
|
||||||
}
|
|
||||||
this->changeMenu(htmlMenu.parentMenu);
|
this->changeMenu(htmlMenu.parentMenu);
|
||||||
break;
|
return;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
this->changeMenu(&htmlMenu);
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
});
|
});
|
||||||
|
|
||||||
#if (!defined(HAS_ILI9341) && defined(HAS_BUTTONS))
|
#if (!defined(HAS_ILI9341) && defined(HAS_BUTTONS))
|
||||||
|
|||||||
Reference in New Issue
Block a user