Added draw function

This commit is contained in:
Just Call Me Koko
2020-01-11 21:08:42 -05:00
parent 7ae1427b12
commit 41c6dd4457
5 changed files with 44 additions and 8 deletions

View File

@@ -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 // Decode and render the Jpeg image onto the TFT screen
//==================================================================================== //====================================================================================

View File

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

View File

@@ -99,10 +99,13 @@ void MenuFunctions::main()
// Function to build the menus // Function to build the menus
void MenuFunctions::RunSetup() void MenuFunctions::RunSetup()
{ {
// Main menu stuff // root menu stuff
mainMenu.list = new SimpleList<MenuNode>(); // Get list in first menu ready 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 wifiMenu.list = new SimpleList<MenuNode>(); // Get list in second menu ready
bluetoothMenu.list = new SimpleList<MenuNode>(); // Get list in third menu ready bluetoothMenu.list = new SimpleList<MenuNode>(); // Get list in third menu ready
generalMenu.list = new SimpleList<MenuNode>();
// WiFi menu stuff // WiFi menu stuff
wifiSnifferMenu.list = new SimpleList<MenuNode>(); wifiSnifferMenu.list = new SimpleList<MenuNode>();
@@ -116,6 +119,7 @@ void MenuFunctions::RunSetup()
// Work menu names // Work menu names
mainMenu.name = " ESP32 Marauder "; mainMenu.name = " ESP32 Marauder ";
wifiMenu.name = " WiFi "; wifiMenu.name = " WiFi ";
generalMenu.name = " General Apps ";
bluetoothMenu.name = " Bluetooth "; bluetoothMenu.name = " Bluetooth ";
wifiSnifferMenu.name = " WiFi Sniffers "; wifiSnifferMenu.name = " WiFi Sniffers ";
wifiScannerMenu.name = " WiFi Scanners"; wifiScannerMenu.name = " WiFi Scanners";
@@ -127,7 +131,8 @@ void MenuFunctions::RunSetup()
mainMenu.parentMenu = NULL; mainMenu.parentMenu = NULL;
addNodes(&mainMenu, "WiFi", TFT_GREEN, NULL, 0, [this](){changeMenu(&wifiMenu);}); addNodes(&mainMenu, "WiFi", TFT_GREEN, NULL, 0, [this](){changeMenu(&wifiMenu);});
addNodes(&mainMenu, "Bluetooth", TFT_CYAN, NULL, 1, [this](){changeMenu(&bluetoothMenu);}); 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 // Build WiFi Menu
wifiMenu.parentMenu = &mainMenu; // Main Menu is second menu parent 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, "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);}); 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 // Set the current menu to the mainMenu
changeMenu(&mainMenu); changeMenu(&mainMenu);

View File

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

View File

@@ -51,14 +51,20 @@ void loop()
currentTime = millis(); currentTime = millis();
// Update all of our objects // Update all of our objects
display_obj.main(); if (!display_obj.draw_tft)
wifi_scan_obj.main(currentTime); {
//if ((wifi_scan_obj.currentScanMode != WIFI_ATTACK_BEACON_SPAM)) display_obj.main();
menu_function_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("Run Time: ");
//Serial.print(millis() - currentTime); //Serial.print(millis() - currentTime);
//Serial.println("ms"); //Serial.println("ms");
delay(1);
} }