Just Call Me Koko пре 5 година
родитељ
комит
ece6b63de4
2 измењених фајлова са 44 додато и 4 уклоњено
  1. 38 3
      esp32_marauder/MenuFunctions.cpp
  2. 6 1
      esp32_marauder/MenuFunctions.h

+ 38 - 3
esp32_marauder/MenuFunctions.cpp

@@ -141,7 +141,7 @@ void MenuFunctions::joinWiFiGFX(){
   // Create a keyboard and apply the styles
   // Create a keyboard and apply the styles
   kb = lv_keyboard_create(lv_scr_act(), NULL);
   kb = lv_keyboard_create(lv_scr_act(), NULL);
   lv_obj_set_size(kb, LV_HOR_RES, LV_VER_RES / 2);
   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
   // Focus it on one of the text areas to start
   lv_keyboard_set_textarea(kb, ta1);
   lv_keyboard_set_textarea(kb, ta1);
@@ -149,8 +149,8 @@ void MenuFunctions::joinWiFiGFX(){
   
   
 }
 }
 
 
-
-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 Display display_obj;
   extern MenuFunctions menu_function_obj;
   extern MenuFunctions menu_function_obj;
   extern WiFiScan wifi_scan_obj;
   extern WiFiScan wifi_scan_obj;
@@ -622,6 +622,11 @@ void MenuFunctions::RunSetup()
   // Bluetooth menu stuff
   // Bluetooth menu stuff
   bluetoothSnifferMenu.list = new LinkedList<MenuNode>();
   bluetoothSnifferMenu.list = new LinkedList<MenuNode>();
   bluetoothScannerMenu.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
   // Work menu names
   mainMenu.name = " ESP32 Marauder ";
   mainMenu.name = " ESP32 Marauder ";
@@ -640,6 +645,9 @@ void MenuFunctions::RunSetup()
   wifiGeneralMenu.name = " WiFi General ";
   wifiGeneralMenu.name = " WiFi General ";
   bluetoothSnifferMenu.name = " Bluetooth Sniffers ";
   bluetoothSnifferMenu.name = " Bluetooth Sniffers ";
   bluetoothScannerMenu.name = " Bluetooth Scanners ";
   bluetoothScannerMenu.name = " Bluetooth Scanners ";
+  bluetoothGeneralMenu.name = " Bluetooth General ";
+  shutdownWiFiMenu.name = " Shutdown WiFi ";
+  shutdownBLEMenu.name = " Shutdown BLE ";
 
 
   // Build Main Menu
   // Build Main Menu
   mainMenu.parentMenu = NULL;
   mainMenu.parentMenu = NULL;
@@ -747,6 +755,15 @@ void MenuFunctions::RunSetup()
     wifi_scan_obj.StartScan(LV_JOIN_WIFI, TFT_YELLOW); 
     wifi_scan_obj.StartScan(LV_JOIN_WIFI, TFT_YELLOW); 
     joinWiFiGFX();
     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
   // Build Bluetooth Menu
@@ -760,6 +777,9 @@ void MenuFunctions::RunSetup()
   addNodes(&bluetoothMenu, "Scanners", TFT_ORANGE, NULL, SCANNERS, [this]() {
   addNodes(&bluetoothMenu, "Scanners", TFT_ORANGE, NULL, SCANNERS, [this]() {
     changeMenu(&bluetoothScannerMenu);
     changeMenu(&bluetoothScannerMenu);
   });
   });
+  addNodes(&bluetoothMenu, "General", TFT_PURPLE, NULL, GENERAL_APPS, [this]() {
+    changeMenu(&bluetoothGeneralMenu);
+  });
 
 
   // Build bluetooth sniffer Menu
   // Build bluetooth sniffer Menu
   bluetoothSnifferMenu.parentMenu = &bluetoothMenu; // Second Menu is third menu parent
   bluetoothSnifferMenu.parentMenu = &bluetoothMenu; // Second Menu is third menu parent
@@ -783,6 +803,21 @@ void MenuFunctions::RunSetup()
     wifi_scan_obj.StartScan(BT_SCAN_SKIMMERS, TFT_MAGENTA);
     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
   // General apps menu
   generalMenu.parentMenu = &mainMenu;
   generalMenu.parentMenu = &mainMenu;
   addNodes(&generalMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this]() {
   addNodes(&generalMenu, "Back", TFT_LIGHTGREY, NULL, 0, [this]() {

+ 6 - 1
esp32_marauder/MenuFunctions.h

@@ -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 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 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
 // lvgl stuff
 PROGMEM static lv_obj_t *kb;
 PROGMEM static lv_obj_t *kb;
@@ -132,6 +132,11 @@ class MenuFunctions
     // Bluetooth menu stuff
     // Bluetooth menu stuff
     Menu bluetoothSnifferMenu;
     Menu bluetoothSnifferMenu;
     Menu bluetoothScannerMenu;
     Menu bluetoothScannerMenu;
+    Menu bluetoothGeneralMenu;
+
+    // Settings things menus
+    Menu shutdownWiFiMenu;
+    Menu shutdownBLEMenu;
 
 
     static void lv_tick_handler();
     static void lv_tick_handler();