Skip to content

Commit

Permalink
Added draw function
Browse files Browse the repository at this point in the history
  • Loading branch information
justcallmekoko committed Jan 12, 2020
1 parent 7ae1427 commit 41c6dd4
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 8 deletions.
17 changes: 17 additions & 0 deletions esp32_marauder/Display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
//====================================================================================
Expand Down
2 changes: 2 additions & 0 deletions esp32_marauder/Display.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
13 changes: 11 additions & 2 deletions esp32_marauder/MenuFunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>();
Expand All @@ -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";
Expand All @@ -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
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions esp32_marauder/MenuFunctions.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ class MenuFunctions

// Main menu stuff
Menu mainMenu;

Menu wifiMenu;
Menu bluetoothMenu;
Menu generalMenu;

// WiFi menu stuff
Menu wifiSnifferMenu;
Expand Down
18 changes: 12 additions & 6 deletions esp32_marauder/esp32_marauder.ino
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

0 comments on commit 41c6dd4

Please sign in to comment.