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

Feature/lilygo t8 esp32 s2 #568

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions esp32_marauder/LedInterface.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
#include "LedInterface.h"

#ifndef HAS_NEOPIXEL_LED

LedInterface::LedInterface(){}
void LedInterface::RunSetup(){}
void LedInterface::main(uint32_t currentTime){}
void LedInterface::setMode(uint8_t new_mode){}
uint8_t LedInterface::getMode(){}
void LedInterface::setColor(int r, int g, int b){}
void LedInterface::sniffLed(){}
void LedInterface::attackLed(){}
void LedInterface::ledOff(){}
void LedInterface::rainbow(){}
uint32_t LedInterface::Wheel(byte WheelPos){}

#else

LedInterface::LedInterface() {

}
Expand Down Expand Up @@ -51,7 +67,7 @@ uint8_t LedInterface::getMode() {

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

void LedInterface::sniffLed() {
Expand Down Expand Up @@ -88,4 +104,5 @@ uint32_t LedInterface::Wheel(byte WheelPos) {
}
WheelPos -= 170;
return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
}
}
#endif
24 changes: 16 additions & 8 deletions esp32_marauder/SDInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ bool SDInterface::initSD() {
pinMode(SD_CS, OUTPUT);

delay(10);
#if defined(MARAUDER_M5STICKC)

#if defined(LILYGO_T8_ESP32S2)
// setup custom spi pins for Lilygo T8
pinMode(14, INPUT_PULLUP);
enum { SPI_SCK = 12, SPI_MISO = 13, SPI_MOSI = 11 };
#elif defined(MARAUDER_M5STICKC)
/* Set up SPI SD Card using external pin header
StickCPlus Header - SPI SD Card Reader
3v3 - 3v3
Expand All @@ -32,6 +37,9 @@ bool SDInterface::initSD() {
- CS (jumper to SD Card GND Pin)
*/
enum { SPI_SCK = 0, SPI_MISO = 36, SPI_MOSI = 26 };
#endif

#if defined(MARAUDER_M5STICKC) || defined(LILYGO_T8_ESP32S2)
this->spiExt = new SPIClass();
this->spiExt->begin(SPI_SCK, SPI_MISO, SPI_MOSI, SD_CS);
if (!SD.begin(SD_CS, *(this->spiExt))) {
Expand All @@ -55,7 +63,7 @@ bool SDInterface::initSD() {
// Serial.println(F("SD: UNKNOWN Card Mounted"));

this->cardSizeMB = SD.cardSize() / (1024 * 1024);

//Serial.printf("SD Card Size: %lluMB\n", this->cardSizeMB);

if (this->supported) {
Expand All @@ -69,7 +77,7 @@ bool SDInterface::initSD() {
sz[i] = '0' + (this->cardSizeMB % 10);
display_string.concat((String)sz[i]);
}

this->card_sz = sz;
}

Expand All @@ -83,7 +91,7 @@ bool SDInterface::initSD() {
this->sd_files = new LinkedList<String>();

this->sd_files->add("Back");

return true;
}

Expand Down Expand Up @@ -164,7 +172,7 @@ void SDInterface::runUpdate() {
display_obj.tft.setCursor(0, TFT_HEIGHT / 3);
display_obj.tft.setTextSize(1);
display_obj.tft.setTextColor(TFT_WHITE);

display_obj.tft.println(F(text15));
#endif
File updateBin = SD.open("/update.bin");
Expand Down Expand Up @@ -204,13 +212,13 @@ void SDInterface::runUpdate() {
}

updateBin.close();

// whe finished remove the binary from sd card to indicate end of the process
#ifdef HAS_SCREEN
display_obj.tft.println(F(text_table2[3]));
#endif
Serial.println(F("rebooting..."));
//SD.remove("/update.bin");
//SD.remove("/update.bin");
delay(1000);
ESP.restart();
}
Expand All @@ -227,7 +235,7 @@ void SDInterface::runUpdate() {
}

void SDInterface::performUpdate(Stream &updateSource, size_t updateSize) {
if (Update.begin(updateSize)) {
if (Update.begin(updateSize)) {
#ifdef HAS_SCREEN
display_obj.tft.println(text_table2[5] + String(updateSize));
display_obj.tft.println(F(text_table2[6]));
Expand Down
2 changes: 1 addition & 1 deletion esp32_marauder/SDInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ extern Settings settings_obj;
class SDInterface {

private:
#if defined(MARAUDER_M5STICKC)
#if defined(MARAUDER_M5STICKC) || defined(LILYGO_T8_ESP32S2)
SPIClass *spiExt;
#endif
bool checkDetectPin();
Expand Down
Loading
Loading