PROGMEM commands and remove mini lv_arduino

This commit is contained in:
Just Call Me Koko
2022-05-07 14:36:44 -04:00
parent d9a6966574
commit 0f58a0657b
4 changed files with 760 additions and 737 deletions

View File

@@ -24,7 +24,7 @@ void CommandLine::parseCommand(String input) {
if (input != "")
Serial.println("#" + input);
if (input == "stopscan") {
if (input == STOPSCAN_CMD) {
wifi_scan_obj.StartScan(WIFI_SCAN_OFF);
// If we don't do this, the text and button coordinates will be off
@@ -34,13 +34,13 @@ void CommandLine::parseCommand(String input) {
menu_function_obj.changeMenu(menu_function_obj.current_menu);
}
else if (input == "scanap") {
else if (input == SCANAP_CMD) {
display_obj.clearScreen();
menu_function_obj.drawStatusBar();
wifi_scan_obj.StartScan(WIFI_SCAN_TARGET_AP, TFT_MAGENTA);
}
else if (input == "clearap") {
else if (input == CLEARAP_CMD) {
wifi_scan_obj.RunClearAPs();
}
}

View File

@@ -9,6 +9,11 @@ extern MenuFunctions menu_function_obj;
extern WiFiScan wifi_scan_obj;
extern Display display_obj;
// Commands
const char PROGMEM SCANAP_CMD[] = "scanap";
const char PROGMEM STOPSCAN_CMD[] = "stopscan";
const char PROGMEM CLEARAP_CMD[] = "clearap";
class CommandLine {
private:
String getSerialInput();

View File

@@ -14,6 +14,7 @@ MenuFunctions::MenuFunctions()
// LVGL Stuff
/* Interrupt driven periodic handler */
#ifndef MARAUDER_MINI
void MenuFunctions::lv_tick_handler()
{
lv_tick_inc(LVGL_TICK_PERIOD);
@@ -776,6 +777,9 @@ void ta_event_cb(lv_obj_t * ta, lv_event_t event)
//}
}
#endif
//// END LV_ARDUINO STUFF
void MenuFunctions::buttonNotSelected(uint8_t b) {
display_obj.tft.setFreeFont(NULL);
display_obj.key[b].drawButton(false, current_menu->list->get(b).name);
@@ -816,7 +820,7 @@ void MenuFunctions::main(uint32_t currentTime)
}
if (currentTime != 0) {
if (currentTime - initTime >= 100) {
if (currentTime - initTime >= BANNER_TIME) {
this->initTime = millis();
if ((wifi_scan_obj.currentScanMode != LV_JOIN_WIFI) &&
(wifi_scan_obj.currentScanMode != LV_ADD_SSID))
@@ -1333,7 +1337,9 @@ void MenuFunctions::displaySetting(String key, Menu* menu, int index) {
// Function to build the menus
void MenuFunctions::RunSetup()
{
#ifndef MARAUDER_MINI
this->initLVGL();
#endif
// root menu stuff
mainMenu.list = new LinkedList<MenuNode>(); // Get list in first menu ready
@@ -1519,12 +1525,14 @@ void MenuFunctions::RunSetup()
addNodes(&wifiGeneralMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this]() {
changeMenu(wifiGeneralMenu.parentMenu);
});
#ifndef MARAUDER_MINI
addNodes(&wifiGeneralMenu, "Join WiFi", TFT_DARKCYAN, NULL, JOIN_WIFI, [this](){
display_obj.clearScreen();
wifi_scan_obj.currentScanMode = LV_JOIN_WIFI;
wifi_scan_obj.StartScan(LV_JOIN_WIFI, TFT_YELLOW);
joinWiFiGFX();
});
#endif
addNodes(&wifiGeneralMenu, "Shutdown WiFi", TFT_CYAN, NULL, SHUTDOWN, [this]() {
changeMenu(&shutdownWiFiMenu);
wifi_scan_obj.RunShutdownWiFi();
@@ -1533,12 +1541,14 @@ void MenuFunctions::RunSetup()
changeMenu(&generateSSIDsMenu);
wifi_scan_obj.RunGenerateSSIDs();
});
#ifndef MARAUDER_MINI
addNodes(&wifiGeneralMenu, "Add SSID", TFT_NAVY, NULL, KEYBOARD_ICO, [this](){
display_obj.clearScreen();
//wifi_scan_obj.currentScanMode = LV_ADD_SSID;
wifi_scan_obj.StartScan(LV_ADD_SSID, TFT_YELLOW);
addSSIDGFX();
});
#endif
addNodes(&wifiGeneralMenu, "Clear SSIDs", TFT_SILVER, NULL, CLEAR_ICO, [this]() {
changeMenu(&clearSSIDsMenu);
wifi_scan_obj.RunClearSSIDs();
@@ -1547,12 +1557,14 @@ void MenuFunctions::RunSetup()
changeMenu(&clearAPsMenu);
wifi_scan_obj.RunClearAPs();
});
#ifndef MARAUDER_MINI
addNodes(&wifiGeneralMenu, "Select APs", TFT_NAVY, NULL, KEYBOARD_ICO, [this](){
display_obj.clearScreen();
wifi_scan_obj.currentScanMode = LV_ADD_SSID;
wifi_scan_obj.StartScan(LV_ADD_SSID, TFT_RED);
addAPGFX();
});
#endif
// Build shutdown wifi menu
shutdownWiFiMenu.parentMenu = &wifiGeneralMenu;
@@ -1638,12 +1650,14 @@ void MenuFunctions::RunSetup()
addNodes(&badusbMenu, "Test BadUSB", TFT_PURPLE, NULL, TEST_BAD_USB_ICO, [this]() {
a32u4_obj.test();
});
#ifndef MARAUDER_MINI
addNodes(&badusbMenu, "Run Ducky Script", TFT_RED, NULL, BAD_USB_ICO, [this](){
display_obj.clearScreen();
wifi_scan_obj.currentScanMode = LV_ADD_SSID;
wifi_scan_obj.StartScan(LV_ADD_SSID, TFT_RED);
writeBadUSB();
});
#endif
// General apps menu
generalMenu.parentMenu = &mainMenu;

View File

@@ -2,8 +2,8 @@
#define configs_h
// #define MARAUDER_MINI
#define MARAUDER_V4
#define MARAUDER_MINI
// #define MARAUDER_V4
#define MARAUDER_VERSION "v0.9.6"
@@ -138,6 +138,8 @@
//// MENU DEFINITIONS
#ifdef MARAUDER_V4
#define BANNER_TIME 100
#define COMMAND_PREFIX "!"
// Keypad start position, key sizes and spacing
@@ -155,13 +157,15 @@
#endif
#ifdef MARAUDER_MINI
#define BANNER_TIME 50
#define COMMAND_PREFIX "!"
// Keypad start position, key sizes and spacing
#define KEY_X (TFT_WIDTH/2) // Centre of key
#define KEY_Y (TFT_HEIGHT/4.5)
#define KEY_W TFT_WIDTH // Width and height
#define KEY_H (TFT_HEIGHT/10)
#define KEY_H (TFT_HEIGHT/12.8)
#define KEY_SPACING_X 0 // X and Y gap
#define KEY_SPACING_Y 1
#define KEY_TEXTSIZE 1 // Font size multiplier