Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lilygo t3 display s3 #517

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
84 changes: 69 additions & 15 deletions .github/workflows/build_push.yml

Large diffs are not rendered by default.

47 changes: 47 additions & 0 deletions Setup206_LilyGo_T_Display_S3.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// ST7789 using 8-bit Parallel

#define USER_SETUP_ID 206

#define ST7789_DRIVER
#define INIT_SEQUENCE_3 // Using this initialisation sequence improves the display image

#define CGRAM_OFFSET
#define TFT_RGB_ORDER TFT_RGB // Colour order Red-Green-Blue
//#define TFT_RGB_ORDER TFT_BGR // Colour order Blue-Green-Red

#define TFT_INVERSION_ON
// #define TFT_INVERSION_OFF

#define TFT_PARALLEL_8_BIT

#define TFT_WIDTH 170
#define TFT_HEIGHT 320

#define TFT_CS 6
#define TFT_DC 7
#define TFT_RST 5

#define TFT_WR 8
#define TFT_RD 9

#define TFT_D0 39
#define TFT_D1 40
#define TFT_D2 41
#define TFT_D3 42
#define TFT_D4 45
#define TFT_D5 46
#define TFT_D6 47
#define TFT_D7 48

#define TFT_BL 38
#define TFT_BACKLIGHT_ON HIGH

#define LOAD_GLCD
#define LOAD_FONT2
#define LOAD_FONT4
#define LOAD_FONT6
#define LOAD_FONT7
#define LOAD_FONT8
#define LOAD_GFXFF

#define SMOOTH_FONT
1 change: 1 addition & 0 deletions User_Setup_Select.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
//#include <User_Setup_marauder_mini.h>
//#include <User_Setup_marauder_m5stickc.h>
//#include <User_Setup_marauder_rev_feather.h>
//#include <Setup206_LilyGo_T_Display_S3.h>

//#include <User_Setups/Setup1_ILI9341.h> // Setup file configured for my ILI9341
//#include <User_Setups/Setup2_ST7735.h> // Setup file configured for my ST7735
Expand Down
9 changes: 9 additions & 0 deletions esp32_marauder/Buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ void Buffer::createFile(String name, bool is_pcap){
Serial.println(fileName);

file = fs->open(fileName, FILE_WRITE);
if(!file) {
Serial.println("failed to create file " + fileName);
return;
}
file.close();
}

Expand All @@ -49,6 +53,7 @@ void Buffer::open(bool is_pcap){
void Buffer::openFile(String file_name, fs::FS* fs, bool serial, bool is_pcap) {
bool save_pcap = settings_obj.loadSetting<bool>("SavePCAP");
if (!save_pcap) {
Serial.println("Save pcap disabled");
this->fs = NULL;
this->serial = false;
writing = false;
Expand All @@ -57,11 +62,15 @@ void Buffer::openFile(String file_name, fs::FS* fs, bool serial, bool is_pcap) {
this->fs = fs;
this->serial = serial;
if (this->fs) {
Serial.print("Creating file ");
Serial.println(file_name);
createFile(file_name, is_pcap);
}
if (this->fs || this->serial) {
open(is_pcap);
Serial.println("File open");
} else {
Serial.println("Writing disabled");
writing = false;
}
}
Expand Down
4 changes: 4 additions & 0 deletions esp32_marauder/Buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ class Buffer {
bool useA = true; // writing to bufA or bufB
bool saving = false; // currently saving onto the SD card

#ifdef USE_FFAT
String fileName = "/0.cap";
#else
String fileName = "/0.pcap";
#endif
File file;
fs::FS* fs;
bool serial;
Expand Down
6 changes: 5 additions & 1 deletion esp32_marauder/CommandLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,11 @@ void CommandLine::runCommand(String input) {
int da_sw = this->argSearch(&cmd_args, "disable"); // disable setting

if (re_sw != -1) {
settings_obj.createDefaultSettings(SPIFFS);
#ifndef USE_FFAT
settings_obj.createDefaultSettings(SPIFFS);
#else
settings_obj.createDefaultSettings(FFat);
#endif
return;
}

Expand Down
22 changes: 19 additions & 3 deletions esp32_marauder/Display.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "Display.h"
#include "lang_var.h"
#include "FFat.h"

#ifdef HAS_SCREEN

Expand Down Expand Up @@ -624,9 +625,15 @@ void Display::jpegInfo() {
// Open a Jpeg file and send it to the Serial port in a C array compatible format
//====================================================================================
void createArray(const char *filename) {
fs::File jpgFile;

// Open the named file
fs::File jpgFile = SPIFFS.open( filename, "r"); // File handle reference for SPIFFS
#ifndef USE_FFAT
jpgFile = SPIFFS.open( filename, "r"); // File handle reference for SPIFFS
#else
jpgFile = FFat.open( filename, "r"); // File handle reference for FFat
#endif

// File jpgFile = SD.open( filename, FILE_READ); // or, file handle reference for SD library

if ( !jpgFile ) {
Expand Down Expand Up @@ -672,9 +679,14 @@ void createArray(const char *filename) {
#ifdef ESP8266
void Display::listFiles(void) {
Serial.println();
Serial.println(F("SPIFFS files found:"));
Serial.println(F("Files found:"));

#ifndef USE_FFAT
fs::Dir dir = SPIFFS.openDir("/"); // Root directory
#else
fs::Dir dir = FFat.openDir("/"); // Root directory
#endif

String line = "=====================================";

Serial.println(line);
Expand Down Expand Up @@ -705,13 +717,17 @@ void Display::listFiles(void) {
#ifdef ESP32

void Display::listFiles(void) {
#ifndef USE_FFAT
listDir(SPIFFS, "/", 0);
#else
listDir(FFat, "/", 0);
#endif
}

void Display::listDir(fs::FS &fs, const char * dirname, uint8_t levels) {

Serial.println();
Serial.println(F("SPIFFS files found:"));
Serial.println(F("Files found:"));

Serial.printf("Listing directory: %s\n", "/");
String line = "=====================================";
Expand Down
4 changes: 4 additions & 0 deletions esp32_marauder/EvilPortal.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#include "EvilPortal.h"


char apName[MAX_AP_NAME_SIZE] = "PORTAL";
char index_html[MAX_HTML_SIZE] = "TEST";

AsyncWebServer server(80);

EvilPortal::EvilPortal() {
Expand Down
4 changes: 2 additions & 2 deletions esp32_marauder/EvilPortal.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ extern Buffer buffer_obj;
#define MAX_AP_NAME_SIZE 30
#define WIFI_SCAN_EVIL_PORTAL 30

char apName[MAX_AP_NAME_SIZE] = "PORTAL";
char index_html[MAX_HTML_SIZE] = "TEST";
extern char apName[];
extern char index_html[];

struct ssid {
String essid;
Expand Down
16 changes: 16 additions & 0 deletions esp32_marauder/LedInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ LedInterface::LedInterface() {

void LedInterface::RunSetup() {
//Serial.println("Setting neopixel to black...");
#ifdef HAS_NEOPIXEL_LED
strip.setBrightness(0);
strip.begin();
strip.setPixelColor(0, strip.Color(0, 0, 0));
Expand All @@ -15,9 +16,11 @@ void LedInterface::RunSetup() {
strip.setPixelColor(0, strip.Color(0, 0, 0));
strip.show();
this->initTime = millis();
#endif
}

void LedInterface::main(uint32_t currentTime) {
#ifdef HAS_NEOPIXEL_LED
if ((!settings_obj.loadSetting<bool>("EnableLED")) ||
(this->current_mode == MODE_OFF)) {
this->ledOff();
Expand All @@ -39,6 +42,7 @@ void LedInterface::main(uint32_t currentTime) {
else {
this->ledOff();
}
#endif
};

void LedInterface::setMode(uint8_t new_mode) {
Expand All @@ -50,23 +54,32 @@ uint8_t LedInterface::getMode() {
}

void LedInterface::setColor(int r, int g, int b) {
#ifdef HAS_NEOPIXEL_LED
strip.setPixelColor(0, strip.Color(r, g, b));
strip.show();
#endif
}

void LedInterface::sniffLed() {
#ifdef HAS_NEOPIXEL_LED
this->setColor(0, 0, 255);
#endif
}

void LedInterface::attackLed() {
#ifdef HAS_NEOPIXEL_LED
this->setColor(255, 0, 0);
#endif
}

void LedInterface::ledOff() {
#ifdef HAS_NEOPIXEL_LED
this->setColor(0, 0, 0);
#endif
}

void LedInterface::rainbow() {
#ifdef HAS_NEOPIXEL_LED
strip.setPixelColor(0, this->Wheel((0 * 256 / 100 + this->wheel_pos) % 256));
strip.show();

Expand All @@ -75,9 +88,11 @@ void LedInterface::rainbow() {
this->wheel_pos = this->wheel_pos - this->wheel_speed;
if (this->wheel_pos < 0)
this->wheel_pos = 255;
#endif
}

uint32_t LedInterface::Wheel(byte WheelPos) {
#ifdef HAS_NEOPIXEL_LED
WheelPos = 255 - WheelPos;
if(WheelPos < 85) {
return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
Expand All @@ -88,4 +103,5 @@ uint32_t LedInterface::Wheel(byte WheelPos) {
}
WheelPos -= 170;
return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
#endif
}
Loading
Loading