Just Call Me Koko 6 лет назад
Родитель
Сommit
41c6dd4457

+ 17 - 0
esp32_marauder/Display.cpp

@@ -224,6 +224,23 @@ void Display::drawJpeg(const char *filename, int xpos, int ypos) {
   }
 }
 
+void Display::drawStylus()
+{
+  uint16_t x = 0, y = 0; // To store the touch coordinates
+
+  // Pressed will be set true is there is a valid touch on the screen
+  boolean pressed = tft.getTouch(&x, &y);
+
+  // Draw a white spot at the detected coordinates
+  if (pressed) {
+    tft.fillCircle(x, y, 2, TFT_WHITE);
+    //Serial.print("x,y = ");
+    //Serial.print(x);
+    //Serial.print(",");
+    //Serial.println(y);
+  }
+}
+
 //====================================================================================
 //   Decode and render the Jpeg image onto the TFT screen
 //====================================================================================

+ 2 - 0
esp32_marauder/Display.h

@@ -52,6 +52,7 @@ class Display
     bool printing = false;
     bool loading = false;
     bool tteBar = false;
+    bool draw_tft = false;
 
     int TOP_FIXED_AREA_2 = 32;
     int print_delay_1, print_delay_2 = 10;
@@ -83,6 +84,7 @@ class Display
     void clearScreen();
     void displayBuffer(bool do_clear = false);
     void drawJpeg(const char *filename, int xpos, int ypos);
+    void drawStylus();
     void getTouchWhileFunction(bool pressed);
     void initScrollValues(bool tte = false);
     void jpegInfo();

+ 11 - 2
esp32_marauder/MenuFunctions.cpp

@@ -99,10 +99,13 @@ void MenuFunctions::main()
 // Function to build the menus
 void MenuFunctions::RunSetup()
 {
-  // Main menu stuff
+  // root menu stuff
   mainMenu.list = new SimpleList<MenuNode>(); // Get list in first menu ready
+
+  // Main menu stuff
   wifiMenu.list = new SimpleList<MenuNode>(); // Get list in second menu ready
   bluetoothMenu.list = new SimpleList<MenuNode>(); // Get list in third menu ready
+  generalMenu.list = new SimpleList<MenuNode>();
 
   // WiFi menu stuff
   wifiSnifferMenu.list = new SimpleList<MenuNode>();
@@ -116,6 +119,7 @@ void MenuFunctions::RunSetup()
   // Work menu names
   mainMenu.name = " ESP32 Marauder ";
   wifiMenu.name = " WiFi ";
+  generalMenu.name = " General Apps ";
   bluetoothMenu.name = " Bluetooth ";
   wifiSnifferMenu.name = " WiFi Sniffers ";
   wifiScannerMenu.name = " WiFi Scanners";
@@ -127,7 +131,8 @@ void MenuFunctions::RunSetup()
   mainMenu.parentMenu = NULL;
   addNodes(&mainMenu, "WiFi", TFT_GREEN, NULL, 0, [this](){changeMenu(&wifiMenu);});
   addNodes(&mainMenu, "Bluetooth", TFT_CYAN, NULL, 1, [this](){changeMenu(&bluetoothMenu);});
-  addNodes(&mainMenu, "Reboot", TFT_LIGHTGREY, NULL, 2, [](){ESP.restart();});
+  addNodes(&mainMenu, "General Apps", TFT_MAGENTA, NULL, 2, [this](){changeMenu(&generalMenu);});
+  addNodes(&mainMenu, "Reboot", TFT_LIGHTGREY, NULL, 3, [](){ESP.restart();});
 
   // Build WiFi Menu
   wifiMenu.parentMenu = &mainMenu; // Main Menu is second menu parent
@@ -168,6 +173,10 @@ void MenuFunctions::RunSetup()
   addNodes(&bluetoothScannerMenu, "Back", TFT_RED, NULL, 0, [this](){changeMenu(bluetoothScannerMenu.parentMenu);});
   addNodes(&bluetoothScannerMenu, "Detect Card Skimmers", TFT_MAGENTA, NULL, 2, [this](){wifi_scan_obj.StartScan(BT_SCAN_SKIMMERS, TFT_MAGENTA);});
 
+  generalMenu.parentMenu = &mainMenu;
+  addNodes(&generalMenu, "Back", TFT_RED, NULL, 0, [this](){display_obj.draw_tft = false; changeMenu(generalMenu.parentMenu);});
+  addNodes(&generalMenu, "Draw", TFT_WHITE, NULL, 1, [this](){display_obj.clearScreen(); display_obj.draw_tft = true;});
+
 
   // Set the current menu to the mainMenu
   changeMenu(&mainMenu);

+ 2 - 0
esp32_marauder/MenuFunctions.h

@@ -48,8 +48,10 @@ class MenuFunctions
 
     // Main menu stuff
     Menu mainMenu;
+    
     Menu wifiMenu;
     Menu bluetoothMenu;
+    Menu generalMenu;
 
     // WiFi menu stuff
     Menu wifiSnifferMenu;

+ 12 - 6
esp32_marauder/esp32_marauder.ino

@@ -51,14 +51,20 @@ void loop()
   currentTime = millis();
 
   // Update all of our objects
-  display_obj.main(); 
-  wifi_scan_obj.main(currentTime);
-  //if ((wifi_scan_obj.currentScanMode != WIFI_ATTACK_BEACON_SPAM))
-  menu_function_obj.main();
+  if (!display_obj.draw_tft)
+  {
+    display_obj.main(); 
+    wifi_scan_obj.main(currentTime);
+    //if ((wifi_scan_obj.currentScanMode != WIFI_ATTACK_BEACON_SPAM))
+    menu_function_obj.main();
+    delay(1);
+  }
+  else
+  {
+    display_obj.drawStylus();
+  }
 
   //Serial.print("Run Time: ");
   //Serial.print(millis() - currentTime);
   //Serial.println("ms");
-
-  delay(1);
 }