mirror of
https://github.com/justcallmekoko/ESP32Marauder.git
synced 2025-12-23 15:38:14 -08:00
Paginated Mini menu and fix status bar
This commit is contained in:
@@ -393,14 +393,18 @@ MenuFunctions::MenuFunctions()
|
|||||||
#endif
|
#endif
|
||||||
//// END LV_ARDUINO STUFF
|
//// END LV_ARDUINO STUFF
|
||||||
|
|
||||||
void MenuFunctions::buttonNotSelected(uint8_t b) {
|
void MenuFunctions::buttonNotSelected(uint8_t b, int8_t x) {
|
||||||
|
if (x == -1)
|
||||||
|
x = b;
|
||||||
display_obj.tft.setFreeFont(NULL);
|
display_obj.tft.setFreeFont(NULL);
|
||||||
display_obj.key[b].drawButton(false, current_menu->list->get(b).name);
|
display_obj.key[b].drawButton(false, current_menu->list->get(x).name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MenuFunctions::buttonSelected(uint8_t b) {
|
void MenuFunctions::buttonSelected(uint8_t b, int8_t x) {
|
||||||
|
if (x == -1)
|
||||||
|
x = b;
|
||||||
display_obj.tft.setFreeFont(NULL);
|
display_obj.tft.setFreeFont(NULL);
|
||||||
display_obj.key[b].drawButton(true, current_menu->list->get(b).name);
|
display_obj.key[b].drawButton(true, current_menu->list->get(x).name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function to check menu input
|
// Function to check menu input
|
||||||
@@ -657,9 +661,13 @@ void MenuFunctions::main(uint32_t currentTime)
|
|||||||
(wifi_scan_obj.currentScanMode == OTA_UPDATE)) {
|
(wifi_scan_obj.currentScanMode == OTA_UPDATE)) {
|
||||||
if (current_menu->selected > 0) {
|
if (current_menu->selected > 0) {
|
||||||
current_menu->selected--;
|
current_menu->selected--;
|
||||||
this->buttonSelected(current_menu->selected);
|
if (current_menu->selected < this->menu_start_index) {
|
||||||
|
this->buildButtons(current_menu, current_menu->selected);
|
||||||
|
this->displayCurrentMenu(current_menu->selected);
|
||||||
|
}
|
||||||
|
this->buttonSelected(current_menu->selected - this->menu_start_index, current_menu->selected);
|
||||||
if (!current_menu->list->get(current_menu->selected + 1).selected)
|
if (!current_menu->list->get(current_menu->selected + 1).selected)
|
||||||
this->buttonNotSelected(current_menu->selected + 1);
|
this->buttonNotSelected(current_menu->selected + 1 - this->menu_start_index, current_menu->selected + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((wifi_scan_obj.currentScanMode == WIFI_PACKET_MONITOR) ||
|
else if ((wifi_scan_obj.currentScanMode == WIFI_PACKET_MONITOR) ||
|
||||||
@@ -674,11 +682,19 @@ void MenuFunctions::main(uint32_t currentTime)
|
|||||||
(wifi_scan_obj.currentScanMode == OTA_UPDATE)) {
|
(wifi_scan_obj.currentScanMode == OTA_UPDATE)) {
|
||||||
if (current_menu->selected < current_menu->list->size() - 1) {
|
if (current_menu->selected < current_menu->list->size() - 1) {
|
||||||
current_menu->selected++;
|
current_menu->selected++;
|
||||||
this->buttonSelected(current_menu->selected);
|
this->buttonSelected(current_menu->selected - this->menu_start_index, current_menu->selected);
|
||||||
if (!current_menu->list->get(current_menu->selected - 1).selected)
|
if (!current_menu->list->get(current_menu->selected - 1).selected)
|
||||||
this->buttonNotSelected(current_menu->selected - 1);
|
this->buttonNotSelected(current_menu->selected - 1 - this->menu_start_index, current_menu->selected - 1);
|
||||||
|
if (current_menu->selected >= BUTTON_SCREEN_LIMIT) {
|
||||||
|
this->buildButtons(current_menu, current_menu->selected + 1 - BUTTON_SCREEN_LIMIT);
|
||||||
|
this->displayCurrentMenu(current_menu->selected + 1 - BUTTON_SCREEN_LIMIT);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if (current_menu->selected >= BUTTON_SCREEN_LIMIT) {
|
||||||
|
this->buildButtons(current_menu);
|
||||||
|
this->displayCurrentMenu();
|
||||||
|
}
|
||||||
current_menu->selected = 0;
|
current_menu->selected = 0;
|
||||||
this->buttonSelected(current_menu->selected);
|
this->buttonSelected(current_menu->selected);
|
||||||
if (!current_menu->list->get(current_menu->list->size() - 1).selected)
|
if (!current_menu->list->get(current_menu->list->size() - 1).selected)
|
||||||
@@ -827,6 +843,9 @@ void MenuFunctions::updateStatusBar()
|
|||||||
display_obj.tft.setTextColor(TFT_WHITE, STATUSBAR_COLOR);
|
display_obj.tft.setTextColor(TFT_WHITE, STATUSBAR_COLOR);
|
||||||
|
|
||||||
display_obj.tft.drawString(gps_obj.getNumSatsString(), 22, 0, 2);
|
display_obj.tft.drawString(gps_obj.getNumSatsString(), 22, 0, 2);
|
||||||
|
#elif defined(HAS_SCREEN)
|
||||||
|
display_obj.tft.setTextColor(the_color, STATUSBAR_COLOR);
|
||||||
|
display_obj.tft.drawString("GPS", 0, 0, 1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -836,7 +855,7 @@ void MenuFunctions::updateStatusBar()
|
|||||||
// WiFi Channel Stuff
|
// WiFi Channel Stuff
|
||||||
if (wifi_scan_obj.set_channel != wifi_scan_obj.old_channel) {
|
if (wifi_scan_obj.set_channel != wifi_scan_obj.old_channel) {
|
||||||
wifi_scan_obj.old_channel = wifi_scan_obj.set_channel;
|
wifi_scan_obj.old_channel = wifi_scan_obj.set_channel;
|
||||||
display_obj.tft.fillRect(50, 0, 50, STATUS_BAR_WIDTH, STATUSBAR_COLOR);
|
display_obj.tft.fillRect(50, 0, TFT_WIDTH * 0.21, STATUS_BAR_WIDTH, STATUSBAR_COLOR);
|
||||||
#ifdef HAS_ILI9341
|
#ifdef HAS_ILI9341
|
||||||
display_obj.tft.drawString("CH: " + (String)wifi_scan_obj.set_channel, 50, 0, 2);
|
display_obj.tft.drawString("CH: " + (String)wifi_scan_obj.set_channel, 50, 0, 2);
|
||||||
#endif
|
#endif
|
||||||
@@ -1589,6 +1608,7 @@ void MenuFunctions::buildButtons(Menu * menu, int starting_index)
|
|||||||
{
|
{
|
||||||
if (menu->list != NULL)
|
if (menu->list != NULL)
|
||||||
{
|
{
|
||||||
|
this->menu_start_index = starting_index;
|
||||||
for (uint8_t i = 0; i < menu->list->size(); i++)
|
for (uint8_t i = 0; i < menu->list->size(); i++)
|
||||||
{
|
{
|
||||||
TFT_eSPI_Button new_button;
|
TFT_eSPI_Button new_button;
|
||||||
@@ -1611,7 +1631,7 @@ void MenuFunctions::buildButtons(Menu * menu, int starting_index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MenuFunctions::displayCurrentMenu()
|
void MenuFunctions::displayCurrentMenu(uint8_t start_index)
|
||||||
{
|
{
|
||||||
//Serial.println(F("Displaying current menu..."));
|
//Serial.println(F("Displaying current menu..."));
|
||||||
display_obj.clearScreen();
|
display_obj.clearScreen();
|
||||||
@@ -1629,7 +1649,7 @@ void MenuFunctions::displayCurrentMenu()
|
|||||||
display_obj.tft.setFreeFont(NULL);
|
display_obj.tft.setFreeFont(NULL);
|
||||||
display_obj.tft.setTextSize(1);
|
display_obj.tft.setTextSize(1);
|
||||||
#endif
|
#endif
|
||||||
for (uint8_t i = 0; i < current_menu->list->size(); i++)
|
for (uint8_t i = start_index; i < current_menu->list->size(); i++)
|
||||||
{
|
{
|
||||||
#ifdef HAS_ILI9341
|
#ifdef HAS_ILI9341
|
||||||
if (!current_menu->list->get(i).selected)
|
if (!current_menu->list->get(i).selected)
|
||||||
@@ -1650,9 +1670,9 @@ void MenuFunctions::displayCurrentMenu()
|
|||||||
|
|
||||||
#if defined(MARAUDER_MINI) || defined(MARAUDER_M5STICKC)
|
#if defined(MARAUDER_MINI) || defined(MARAUDER_M5STICKC)
|
||||||
if ((current_menu->selected == i) || (current_menu->list->get(i).selected))
|
if ((current_menu->selected == i) || (current_menu->list->get(i).selected))
|
||||||
display_obj.key[i].drawButton(true, current_menu->list->get(i).name);
|
display_obj.key[i - start_index].drawButton(true, current_menu->list->get(i).name);
|
||||||
else
|
else
|
||||||
display_obj.key[i].drawButton(false, current_menu->list->get(i).name);
|
display_obj.key[i - start_index].drawButton(false, current_menu->list->get(i).name);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
display_obj.tft.setFreeFont(NULL);
|
display_obj.tft.setFreeFont(NULL);
|
||||||
|
|||||||
@@ -116,6 +116,7 @@ class MenuFunctions
|
|||||||
String u_result = "";
|
String u_result = "";
|
||||||
|
|
||||||
uint32_t initTime = 0;
|
uint32_t initTime = 0;
|
||||||
|
uint8_t menu_start_index = 0;
|
||||||
|
|
||||||
|
|
||||||
// Main menu stuff
|
// Main menu stuff
|
||||||
@@ -163,8 +164,8 @@ class MenuFunctions
|
|||||||
String callSetting(String key);
|
String callSetting(String key);
|
||||||
void runBoolSetting(String ley);
|
void runBoolSetting(String ley);
|
||||||
void displaySetting(String key, Menu* menu, int index);
|
void displaySetting(String key, Menu* menu, int index);
|
||||||
void buttonSelected(uint8_t b);
|
void buttonSelected(uint8_t b, int8_t x = -1);
|
||||||
void buttonNotSelected(uint8_t b);
|
void buttonNotSelected(uint8_t b, int8_t x = -1);
|
||||||
|
|
||||||
uint8_t updateTouch(uint16_t *x, uint16_t *y, uint16_t threshold = 600);
|
uint8_t updateTouch(uint16_t *x, uint16_t *y, uint16_t threshold = 600);
|
||||||
|
|
||||||
@@ -195,7 +196,7 @@ class MenuFunctions
|
|||||||
void buildButtons(Menu* menu, int starting_index = 0);
|
void buildButtons(Menu* menu, int starting_index = 0);
|
||||||
void changeMenu(Menu* menu);
|
void changeMenu(Menu* menu);
|
||||||
void drawStatusBar();
|
void drawStatusBar();
|
||||||
void displayCurrentMenu();
|
void displayCurrentMenu(uint8_t start_index = 0);
|
||||||
void main(uint32_t currentTime);
|
void main(uint32_t currentTime);
|
||||||
void RunSetup();
|
void RunSetup();
|
||||||
void orientDisplay();
|
void orientDisplay();
|
||||||
|
|||||||
@@ -518,9 +518,11 @@ void WiFiScan::startWiFiAttacks(uint8_t scan_mode, uint16_t color, String title_
|
|||||||
display_obj.initScrollValues(true);
|
display_obj.initScrollValues(true);
|
||||||
display_obj.tft.setTextWrap(false);
|
display_obj.tft.setTextWrap(false);
|
||||||
display_obj.tft.setTextColor(TFT_BLACK, color);
|
display_obj.tft.setTextColor(TFT_BLACK, color);
|
||||||
|
#ifdef HAS_ILI9341
|
||||||
display_obj.tft.fillRect(0,16,240,16, color);
|
display_obj.tft.fillRect(0,16,240,16, color);
|
||||||
display_obj.tft.drawCentreString((String)title_string,120,16,2);
|
display_obj.tft.drawCentreString((String)title_string,120,16,2);
|
||||||
display_obj.touchToExit();
|
display_obj.touchToExit();
|
||||||
|
#endif
|
||||||
display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1857,9 +1859,11 @@ void WiFiScan::RunSourApple(uint8_t scan_mode, uint16_t color) {
|
|||||||
display_obj.initScrollValues(true);
|
display_obj.initScrollValues(true);
|
||||||
display_obj.tft.setTextWrap(false);
|
display_obj.tft.setTextWrap(false);
|
||||||
display_obj.tft.setTextColor(TFT_BLACK, color);
|
display_obj.tft.setTextColor(TFT_BLACK, color);
|
||||||
|
#ifdef HAS_ILI9341
|
||||||
display_obj.tft.fillRect(0,16,240,16, color);
|
display_obj.tft.fillRect(0,16,240,16, color);
|
||||||
display_obj.tft.drawCentreString("Sour Apple",120,16,2);
|
display_obj.tft.drawCentreString("Sour Apple",120,16,2);
|
||||||
display_obj.touchToExit();
|
display_obj.touchToExit();
|
||||||
|
#endif
|
||||||
display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1877,9 +1881,11 @@ void WiFiScan::RunSwiftpairSpam(uint8_t scan_mode, uint16_t color) {
|
|||||||
display_obj.initScrollValues(true);
|
display_obj.initScrollValues(true);
|
||||||
display_obj.tft.setTextWrap(false);
|
display_obj.tft.setTextWrap(false);
|
||||||
display_obj.tft.setTextColor(TFT_BLACK, color);
|
display_obj.tft.setTextColor(TFT_BLACK, color);
|
||||||
|
#ifdef HAS_ILI9341
|
||||||
display_obj.tft.fillRect(0,16,240,16, color);
|
display_obj.tft.fillRect(0,16,240,16, color);
|
||||||
display_obj.tft.drawCentreString("Swiftpair Spam",120,16,2);
|
display_obj.tft.drawCentreString("Swiftpair Spam",120,16,2);
|
||||||
display_obj.touchToExit();
|
display_obj.touchToExit();
|
||||||
|
#endif
|
||||||
display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
display_obj.tft.setTextColor(TFT_GREEN, TFT_BLACK);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -10,9 +10,9 @@
|
|||||||
|
|
||||||
//// BOARD TARGETS
|
//// BOARD TARGETS
|
||||||
//#define MARAUDER_M5STICKC
|
//#define MARAUDER_M5STICKC
|
||||||
//#define MARAUDER_MINI
|
#define MARAUDER_MINI
|
||||||
//#define MARAUDER_V4
|
//#define MARAUDER_V4
|
||||||
#define MARAUDER_V6
|
//#define MARAUDER_V6
|
||||||
//#define MARAUDER_V6_1
|
//#define MARAUDER_V6_1
|
||||||
//#define MARAUDER_KIT
|
//#define MARAUDER_KIT
|
||||||
//#define GENERIC_ESP32
|
//#define GENERIC_ESP32
|
||||||
@@ -272,6 +272,7 @@
|
|||||||
//#define MENU_FONT &FreeMonoBold9pt7b
|
//#define MENU_FONT &FreeMonoBold9pt7b
|
||||||
//#define MENU_FONT &FreeSans9pt7b
|
//#define MENU_FONT &FreeSans9pt7b
|
||||||
//#define MENU_FONT &FreeSansBold9pt7b
|
//#define MENU_FONT &FreeSansBold9pt7b
|
||||||
|
#define BUTTON_SCREEN_LIMIT 12
|
||||||
#define BUTTON_ARRAY_LEN 12
|
#define BUTTON_ARRAY_LEN 12
|
||||||
#define STATUS_BAR_WIDTH (TFT_HEIGHT/16)
|
#define STATUS_BAR_WIDTH (TFT_HEIGHT/16)
|
||||||
#define LVGL_TICK_PERIOD 6
|
#define LVGL_TICK_PERIOD 6
|
||||||
@@ -327,6 +328,7 @@
|
|||||||
//#define MENU_FONT &FreeMonoBold9pt7b
|
//#define MENU_FONT &FreeMonoBold9pt7b
|
||||||
//#define MENU_FONT &FreeSans9pt7b
|
//#define MENU_FONT &FreeSans9pt7b
|
||||||
//#define MENU_FONT &FreeSansBold9pt7b
|
//#define MENU_FONT &FreeSansBold9pt7b
|
||||||
|
#define BUTTON_SCREEN_LIMIT 12
|
||||||
#define BUTTON_ARRAY_LEN 12
|
#define BUTTON_ARRAY_LEN 12
|
||||||
#define STATUS_BAR_WIDTH 16
|
#define STATUS_BAR_WIDTH 16
|
||||||
#define LVGL_TICK_PERIOD 6
|
#define LVGL_TICK_PERIOD 6
|
||||||
@@ -384,6 +386,7 @@
|
|||||||
//#define MENU_FONT &FreeMonoBold9pt7b
|
//#define MENU_FONT &FreeMonoBold9pt7b
|
||||||
//#define MENU_FONT &FreeSans9pt7b
|
//#define MENU_FONT &FreeSans9pt7b
|
||||||
//#define MENU_FONT &FreeSansBold9pt7b
|
//#define MENU_FONT &FreeSansBold9pt7b
|
||||||
|
#define BUTTON_SCREEN_LIMIT 12
|
||||||
#define BUTTON_ARRAY_LEN 12
|
#define BUTTON_ARRAY_LEN 12
|
||||||
#define STATUS_BAR_WIDTH 16
|
#define STATUS_BAR_WIDTH 16
|
||||||
#define LVGL_TICK_PERIOD 6
|
#define LVGL_TICK_PERIOD 6
|
||||||
@@ -442,6 +445,7 @@
|
|||||||
//#define MENU_FONT &FreeMonoBold9pt7b
|
//#define MENU_FONT &FreeMonoBold9pt7b
|
||||||
//#define MENU_FONT &FreeSans9pt7b
|
//#define MENU_FONT &FreeSans9pt7b
|
||||||
//#define MENU_FONT &FreeSansBold9pt7b
|
//#define MENU_FONT &FreeSansBold9pt7b
|
||||||
|
#define BUTTON_SCREEN_LIMIT 12
|
||||||
#define BUTTON_ARRAY_LEN 12
|
#define BUTTON_ARRAY_LEN 12
|
||||||
#define STATUS_BAR_WIDTH 16
|
#define STATUS_BAR_WIDTH 16
|
||||||
#define LVGL_TICK_PERIOD 6
|
#define LVGL_TICK_PERIOD 6
|
||||||
@@ -510,6 +514,7 @@
|
|||||||
//#define MENU_FONT &FreeMonoBold9pt7b
|
//#define MENU_FONT &FreeMonoBold9pt7b
|
||||||
//#define MENU_FONT &FreeSans9pt7b
|
//#define MENU_FONT &FreeSans9pt7b
|
||||||
//#define MENU_FONT &FreeSansBold9pt7b
|
//#define MENU_FONT &FreeSansBold9pt7b
|
||||||
|
#define BUTTON_SCREEN_LIMIT 10
|
||||||
#define BUTTON_ARRAY_LEN 12
|
#define BUTTON_ARRAY_LEN 12
|
||||||
#define STATUS_BAR_WIDTH (TFT_HEIGHT/16)
|
#define STATUS_BAR_WIDTH (TFT_HEIGHT/16)
|
||||||
#define LVGL_TICK_PERIOD 6
|
#define LVGL_TICK_PERIOD 6
|
||||||
|
|||||||
Reference in New Issue
Block a user