Skip to content

Commit

Permalink
Menus #55, #54, #53, #52
Browse files Browse the repository at this point in the history
  • Loading branch information
justcallmekoko committed Aug 28, 2020
1 parent a327c75 commit ece6b63
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 4 deletions.
41 changes: 38 additions & 3 deletions esp32_marauder/MenuFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,16 @@ void MenuFunctions::joinWiFiGFX(){
// Create a keyboard and apply the styles
kb = lv_keyboard_create(lv_scr_act(), NULL);
lv_obj_set_size(kb, LV_HOR_RES, LV_VER_RES / 2);
lv_obj_set_event_cb(kb, keyboard_event_cb);
lv_obj_set_event_cb(kb, join_wifi_keyboard_event_cb);

// Focus it on one of the text areas to start
lv_keyboard_set_textarea(kb, ta1);
lv_keyboard_set_cursor_manage(kb, true);

}


void keyboard_event_cb(lv_obj_t * keyboard, lv_event_t event){
// Keyboard callback dedicated to joining wifi
void join_wifi_keyboard_event_cb(lv_obj_t * keyboard, lv_event_t event){
extern Display display_obj;
extern MenuFunctions menu_function_obj;
extern WiFiScan wifi_scan_obj;
Expand Down Expand Up @@ -622,6 +622,11 @@ void MenuFunctions::RunSetup()
// Bluetooth menu stuff
bluetoothSnifferMenu.list = new LinkedList<MenuNode>();
bluetoothScannerMenu.list = new LinkedList<MenuNode>();
bluetoothGeneralMenu.list = new LinkedList<MenuNode>();

// Settings stuff
shutdownWiFiMenu.list = new LinkedList<MenuNode>();
shutdownBLEMenu.list = new LinkedList<MenuNode>();

// Work menu names
mainMenu.name = " ESP32 Marauder ";
Expand All @@ -640,6 +645,9 @@ void MenuFunctions::RunSetup()
wifiGeneralMenu.name = " WiFi General ";
bluetoothSnifferMenu.name = " Bluetooth Sniffers ";
bluetoothScannerMenu.name = " Bluetooth Scanners ";
bluetoothGeneralMenu.name = " Bluetooth General ";
shutdownWiFiMenu.name = " Shutdown WiFi ";
shutdownBLEMenu.name = " Shutdown BLE ";

// Build Main Menu
mainMenu.parentMenu = NULL;
Expand Down Expand Up @@ -747,6 +755,15 @@ void MenuFunctions::RunSetup()
wifi_scan_obj.StartScan(LV_JOIN_WIFI, TFT_YELLOW);
joinWiFiGFX();
});
addNodes(&wifiGeneralMenu, "Shutdown WiFi", TFT_ORANGE, NULL, SCANNERS, [this]() {
changeMenu(&shutdownWiFiMenu);
});

// Build shutdown wifi menu
shutdownWiFiMenu.parentMenu = &wifiGeneralMenu;
addNodes(&shutdownWiFiMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this]() {
changeMenu(shutdownWiFiMenu.parentMenu);
});


// Build Bluetooth Menu
Expand All @@ -760,6 +777,9 @@ void MenuFunctions::RunSetup()
addNodes(&bluetoothMenu, "Scanners", TFT_ORANGE, NULL, SCANNERS, [this]() {
changeMenu(&bluetoothScannerMenu);
});
addNodes(&bluetoothMenu, "General", TFT_PURPLE, NULL, GENERAL_APPS, [this]() {
changeMenu(&bluetoothGeneralMenu);
});

// Build bluetooth sniffer Menu
bluetoothSnifferMenu.parentMenu = &bluetoothMenu; // Second Menu is third menu parent
Expand All @@ -783,6 +803,21 @@ void MenuFunctions::RunSetup()
wifi_scan_obj.StartScan(BT_SCAN_SKIMMERS, TFT_MAGENTA);
});

// Build bluetooth general menu
bluetoothGeneralMenu.parentMenu = &bluetoothMenu;
addNodes(&bluetoothGeneralMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this]() {
changeMenu(bluetoothGeneralMenu.parentMenu);
});
addNodes(&bluetoothGeneralMenu, "Shutdown BLE", TFT_ORANGE, NULL, SCANNERS, [this]() {
changeMenu(&shutdownBLEMenu);
});

// Build shutdown BLE menu
shutdownBLEMenu.parentMenu = &bluetoothGeneralMenu;
addNodes(&shutdownBLEMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this]() {
changeMenu(shutdownBLEMenu.parentMenu);
});

// General apps menu
generalMenu.parentMenu = &mainMenu;
addNodes(&generalMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this]() {
Expand Down
7 changes: 6 additions & 1 deletion esp32_marauder/MenuFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ PROGMEM static lv_disp_buf_t disp_buf;
PROGMEM static lv_color_t buf[LV_HOR_RES_MAX * 10];

PROGMEM static void ta_event_cb(lv_obj_t * ta, lv_event_t event);
PROGMEM static void keyboard_event_cb(lv_obj_t * keyboard, lv_event_t event);
PROGMEM static void join_wifi_keyboard_event_cb(lv_obj_t * keyboard, lv_event_t event);

// lvgl stuff
PROGMEM static lv_obj_t *kb;
Expand Down Expand Up @@ -132,6 +132,11 @@ class MenuFunctions
// Bluetooth menu stuff
Menu bluetoothSnifferMenu;
Menu bluetoothScannerMenu;
Menu bluetoothGeneralMenu;

// Settings things menus
Menu shutdownWiFiMenu;
Menu shutdownBLEMenu;

static void lv_tick_handler();

Expand Down

0 comments on commit ece6b63

Please sign in to comment.