mirror of
https://github.com/justcallmekoko/ESP32Marauder.git
synced 2025-12-12 07:40:58 -08:00
nye³ (#35)
* Update Display.cpp I THINK I FIGURED OUT WHAT IM DOING * Add files via upload * Update esp32_marauder.ino * Update MenuFunctions.cpp * Update MenuFunctions.h * Update MenuFunctions.cpp * Update README.md * Update README.md * Update MenuFunctions.cpp * Update MenuFunctions.h * Update MenuFunctions.h * Add files via upload * Update esp32_marauder.ino * Update README.md * Update Display.cpp moved the float "wd", as the draw function would continously change it, which resulted in those weird effects when trying to draw different thicknesses * Update MenuFunctions.cpp * Update Display.cpp made it so the drawing code doesnt need to draw every pixel individually and made it so it can handle higher thiccnesses... at all. it did not handly thicknesses above 2 with any kind of grace * Update Display.cpp removed unneccessary variable changes, just realized i kept making certain variables be a certain value over and over * Fix screen change battery percentage * restore TFT touch data Co-authored-by: Just Call Me Koko <25190487+justcallmekoko@users.noreply.github.com>
This commit is contained in:
10
README.md
10
README.md
@@ -96,6 +96,14 @@ Make the following connections between your 2.8" TFT Screen and your ESP32 board
|
|||||||
| | T_IRQ | |
|
| | T_IRQ | |
|
||||||
| SD_CS | | GPIO12 |
|
| SD_CS | | GPIO12 |
|
||||||
|
|
||||||
|
For the analog battery circuit, use a 4 to 1 voltage divider, and (optional) a mosfet
|
||||||
|
For the charge detection circuit, use a 1 to 2 voltage divider (the charge detection is optional and only changes the battery icon colour while charging)
|
||||||
|
| BATTERY | ESP32 |
|
||||||
|
| ------- | ------ |
|
||||||
|
| BAT + | GPIO34 |
|
||||||
|
| MOSFET | GPIO13 |
|
||||||
|
| CHARGE +| GPIO27 |
|
||||||
|
|
||||||
## Flashing Firmware
|
## Flashing Firmware
|
||||||
### Using Arduino IDE
|
### Using Arduino IDE
|
||||||
1. Install the [Arduino IDE](https://www.arduino.cc/en/main/software)
|
1. Install the [Arduino IDE](https://www.arduino.cc/en/main/software)
|
||||||
@@ -115,8 +123,10 @@ Make the following connections between your 2.8" TFT Screen and your ESP32 board
|
|||||||
8. Install the [CH340 Drivers](https://github.com/justcallmekoko/ESP32Marauder/blob/master/Drivers/CH34x_Install_Windows_v3_4.EXE)
|
8. Install the [CH340 Drivers](https://github.com/justcallmekoko/ESP32Marauder/blob/master/Drivers/CH34x_Install_Windows_v3_4.EXE)
|
||||||
9. Download or clone this repository
|
9. Download or clone this repository
|
||||||
10. Open `esp32_marauder.ino`
|
10. Open `esp32_marauder.ino`
|
||||||
|
10.5. If you're using the analog battery measuring circuit, go to the MenuFunctions.h and change "#define BATTERY_ANALOG_ON" to 1
|
||||||
11. Plug your ESP32 into a USB port and select the COM port under `Tools`>`Port`
|
11. Plug your ESP32 into a USB port and select the COM port under `Tools`>`Port`
|
||||||
12. Select `LOLIN D32` under `Tools`>`Boards`
|
12. Select `LOLIN D32` under `Tools`>`Boards`
|
||||||
|
12.5 If you want an upscaled version of the logo, go to the data folder and rename "marauder3L1.jpg" to "marauder3L.jpg"
|
||||||
13. Click `ESP32 Sketch Data Upload` and wait for the SPIFFS upload to finish
|
13. Click `ESP32 Sketch Data Upload` and wait for the SPIFFS upload to finish
|
||||||
14. Click the upload button
|
14. Click the upload button
|
||||||
|
|
||||||
|
|||||||
@@ -465,7 +465,6 @@ void Display::drawJpeg(const char *filename, int xpos, int ypos) {
|
|||||||
uint16_t xlast;
|
uint16_t xlast;
|
||||||
uint16_t ylast;
|
uint16_t ylast;
|
||||||
uint32_t AH;
|
uint32_t AH;
|
||||||
float wd = 3;
|
|
||||||
void Display::drawStylus()
|
void Display::drawStylus()
|
||||||
{
|
{
|
||||||
uint16_t x = 0, y = 0; // To store the touch coordinates
|
uint16_t x = 0, y = 0; // To store the touch coordinates
|
||||||
@@ -477,26 +476,35 @@ void Display::drawStylus()
|
|||||||
if (pressed) {
|
if (pressed) {
|
||||||
// tft.fillCircle(x, y, 2, TFT_WHITE);
|
// tft.fillCircle(x, y, 2, TFT_WHITE);
|
||||||
if ( xlast > 0 && ylast > 0 ) {
|
if ( xlast > 0 && ylast > 0 ) {
|
||||||
int dx = abs(x - xlast), sx = xlast < x ? 1 : -1;
|
uint16_t the_color = TFT_WHITE;
|
||||||
int dy = abs(y - ylast), sy = ylast < y ? 1 : -1;
|
uint16_t wd = 1;
|
||||||
int err = dx - dy, e2, x2, y2; /* error value e_xy */
|
int xlast2;
|
||||||
float ed = dx + dy == 0 ? 1 : sqrt((float)dx * dx + (float)dy * dy);
|
int ylast2;
|
||||||
|
int x2;
|
||||||
for (wd = (wd + 1) / 2; ; ) { /* pixel loop */
|
int y2;
|
||||||
tft.drawPixel(xlast, ylast, TFT_WHITE);
|
int n;
|
||||||
e2 = err; x2 = xlast;
|
int n2 = -wd;
|
||||||
if (2 * e2 >= -dx) { /* x step */
|
xlast2 = xlast - wd;
|
||||||
for (e2 += dy, y2 = ylast; e2 < ed * wd && (y != y2 || dx > dy); e2 += dx)
|
x2 = x - wd;
|
||||||
tft.drawPixel(xlast, y2 += sy, TFT_WHITE);
|
for (n = -wd; n <= wd; n++) {
|
||||||
if (xlast == x) break;
|
ylast2 = ylast + n;
|
||||||
e2 = err; err -= dy; xlast += sx;
|
y2 = y + n;
|
||||||
}
|
tft.drawLine(xlast2, ylast2, x2, y2, the_color);
|
||||||
if (2 * e2 <= dy) { /* y step */
|
}
|
||||||
for (e2 = dx - e2; e2 < ed * wd && (x != x2 || dx < dy); e2 += dy)
|
for (n2 = -wd; n2 <= wd; n2++) {
|
||||||
tft.drawPixel(x2 += sx, ylast, TFT_WHITE);
|
xlast2 = xlast + n2;
|
||||||
if (ylast == y) break;
|
x2 = x + n2;
|
||||||
err += dx; ylast += sy;
|
tft.drawLine(xlast2, ylast2, x2, y2, the_color);
|
||||||
}
|
}
|
||||||
|
for (n = wd; n >= -wd; n--) {
|
||||||
|
ylast2 = ylast + n;
|
||||||
|
y2 = y + n;
|
||||||
|
tft.drawLine(xlast2, ylast2, x2, y2, the_color);
|
||||||
|
}
|
||||||
|
for (n2 = wd; n2 >= -wd; n2--) {
|
||||||
|
xlast2 = xlast + n2;
|
||||||
|
x2 = x + n2;
|
||||||
|
tft.drawLine(xlast2, ylast2, x2, y2, the_color);
|
||||||
}
|
}
|
||||||
// tft.drawLine(xlast, ylast, x, y, TFT_WHITE);
|
// tft.drawLine(xlast, ylast, x, y, TFT_WHITE);
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -1,12 +1,15 @@
|
|||||||
#ifndef MenuFunctions_h
|
#ifndef MenuFunctions_h
|
||||||
#define MenuFunctions_h
|
#define MenuFunctions_h
|
||||||
|
|
||||||
|
#define BATTERY_ANALOG_ON 0
|
||||||
|
|
||||||
#include "WiFiScan.h"
|
#include "WiFiScan.h"
|
||||||
#include "Display.h"
|
#include "Display.h"
|
||||||
#include "BatteryInterface.h"
|
#include "BatteryInterface.h"
|
||||||
#include "SDInterface.h"
|
#include "SDInterface.h"
|
||||||
#include "Web.h"
|
#include "Web.h"
|
||||||
|
|
||||||
|
|
||||||
extern Display display_obj;
|
extern Display display_obj;
|
||||||
extern WiFiScan wifi_scan_obj;
|
extern WiFiScan wifi_scan_obj;
|
||||||
extern Web web_obj;
|
extern Web web_obj;
|
||||||
@@ -28,6 +31,12 @@ extern BatteryInterface battery_obj;
|
|||||||
|
|
||||||
#define FLASH_BUTTON 0
|
#define FLASH_BUTTON 0
|
||||||
|
|
||||||
|
#if BATTERY_ANALOG_ON == 1
|
||||||
|
#define BATTERY_PIN 13
|
||||||
|
#define ANALOG_PIN 34
|
||||||
|
#define CHARGING_PIN 27
|
||||||
|
#endif
|
||||||
|
|
||||||
// Icon definitions
|
// Icon definitions
|
||||||
#define ATTACKS 0
|
#define ATTACKS 0
|
||||||
#define BEACON_SNIFF 1
|
#define BEACON_SNIFF 1
|
||||||
@@ -61,35 +70,35 @@ struct Menu;
|
|||||||
// Individual Nodes of a menu
|
// Individual Nodes of a menu
|
||||||
|
|
||||||
struct MenuNode {
|
struct MenuNode {
|
||||||
String name;
|
String name;
|
||||||
uint16_t color;
|
uint16_t color;
|
||||||
int icon;
|
int icon;
|
||||||
TFT_eSPI_Button* button;
|
TFT_eSPI_Button* button;
|
||||||
std::function<void()> callable;
|
std::function<void()> callable;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Full Menus
|
// Full Menus
|
||||||
struct Menu {
|
struct Menu {
|
||||||
String name;
|
String name;
|
||||||
LinkedList<MenuNode>* list;
|
LinkedList<MenuNode>* list;
|
||||||
Menu * parentMenu;
|
Menu * parentMenu;
|
||||||
//uint8_t selected;
|
//uint8_t selected;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class MenuFunctions
|
class MenuFunctions
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
String u_result = "";
|
String u_result = "";
|
||||||
|
|
||||||
uint32_t initTime = 0;
|
uint32_t initTime = 0;
|
||||||
|
|
||||||
Menu* current_menu;
|
Menu* current_menu;
|
||||||
|
|
||||||
// Main menu stuff
|
// Main menu stuff
|
||||||
Menu mainMenu;
|
Menu mainMenu;
|
||||||
|
|
||||||
Menu wifiMenu;
|
Menu wifiMenu;
|
||||||
Menu bluetoothMenu;
|
Menu bluetoothMenu;
|
||||||
Menu generalMenu;
|
Menu generalMenu;
|
||||||
@@ -112,17 +121,19 @@ class MenuFunctions
|
|||||||
Menu bluetoothScannerMenu;
|
Menu bluetoothScannerMenu;
|
||||||
|
|
||||||
// Menu icons
|
// Menu icons
|
||||||
|
|
||||||
|
|
||||||
//TFT_eSPI_Button key[BUTTON_ARRAY_LEN];
|
//TFT_eSPI_Button key[BUTTON_ARRAY_LEN];
|
||||||
|
|
||||||
void addNodes(Menu* menu, String name, uint16_t color, Menu* child, int place, std::function<void()> callable);
|
void addNodes(Menu* menu, String name, uint16_t color, Menu* child, int place, std::function<void()> callable);
|
||||||
void drawStatusBar();
|
void drawStatusBar();
|
||||||
void updateStatusBar();
|
void updateStatusBar();
|
||||||
|
void battery(bool initial = false);
|
||||||
|
void battery2(bool initial = false);
|
||||||
void showMenuList(Menu* menu, int layer);
|
void showMenuList(Menu* menu, int layer);
|
||||||
void orientDisplay();
|
void orientDisplay();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MenuFunctions();
|
MenuFunctions();
|
||||||
|
|
||||||
uint16_t x = -1, y = -1;
|
uint16_t x = -1, y = -1;
|
||||||
|
|||||||
BIN
esp32_marauder/data/marauder3L1.jpg
Normal file
BIN
esp32_marauder/data/marauder3L1.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
@@ -58,7 +58,11 @@ void setup()
|
|||||||
pinMode(FLASH_BUTTON, INPUT);
|
pinMode(FLASH_BUTTON, INPUT);
|
||||||
pinMode(TFT_BL, OUTPUT);
|
pinMode(TFT_BL, OUTPUT);
|
||||||
digitalWrite(TFT_BL, LOW);
|
digitalWrite(TFT_BL, LOW);
|
||||||
|
#if BATTERY_ANALOG_ON == 1
|
||||||
|
pinMode(BATTERY_PIN, OUTPUT);
|
||||||
|
pinMode(CHARGING_PIN, INPUT);
|
||||||
|
#endif
|
||||||
|
|
||||||
// Preset SPI CS pins to avoid bus conflicts
|
// Preset SPI CS pins to avoid bus conflicts
|
||||||
digitalWrite(TFT_CS, HIGH);
|
digitalWrite(TFT_CS, HIGH);
|
||||||
digitalWrite(SD_CS, HIGH);
|
digitalWrite(SD_CS, HIGH);
|
||||||
|
|||||||
Reference in New Issue
Block a user