ESP32-S2 support.

This commit is contained in:
Blaz Kristan 2022-09-09 23:21:47 +02:00
parent e4fbf70568
commit 2cd40c7552
4 changed files with 19 additions and 14 deletions

View File

@ -279,11 +279,15 @@
#endif #endif
#ifndef MAX_LED_MEMORY #ifndef MAX_LED_MEMORY
#ifdef ESP8266 #ifdef ESP8266
#define MAX_LED_MEMORY 4000 #define MAX_LED_MEMORY 4000
#else #else
#define MAX_LED_MEMORY 64000 #ifdef ARDUINO_ARCH_ESP32S2
#endif #define MAX_LED_MEMORY 32000
#else
#define MAX_LED_MEMORY 64000
#endif
#endif
#endif #endif
#ifndef MAX_LEDS_PER_BUS #ifndef MAX_LEDS_PER_BUS
@ -333,7 +337,8 @@
#define JSON_BUFFER_SIZE 24576 #define JSON_BUFFER_SIZE 24576
#endif #endif
#define MIN_HEAP_SIZE (MAX_LED_MEMORY+2048) //#define MIN_HEAP_SIZE (MAX_LED_MEMORY+2048)
#define MIN_HEAP_SIZE (8192)
// Maximum size of node map (list of other WLED instances) // Maximum size of node map (list of other WLED instances)
#ifdef ESP8266 #ifdef ESP8266

View File

@ -728,7 +728,7 @@ void handleIR()
{ {
if (results.value != 0) // only print results if anything is received ( != 0 ) if (results.value != 0) // only print results if anything is received ( != 0 )
{ {
if (!pinManager.isPinAllocated(1) || pinManager.getPinOwner(1) == PinOwner::DebugOut) //GPIO 1 - Serial TX pin if (!pinManager.isPinAllocated(TX) || pinManager.getPinOwner(TX) == PinOwner::DebugOut) //GPIO 1 - Serial TX pin
Serial.printf_P(PSTR("IR recv: 0x%lX\n"), (unsigned long)results.value); Serial.printf_P(PSTR("IR recv: 0x%lX\n"), (unsigned long)results.value);
} }
decodeIR(results.value); decodeIR(results.value);

View File

@ -293,7 +293,7 @@ void WLED::setup()
//DEBUG_PRINTLN(heapPreAlloc - ESP.getFreeHeap()); //DEBUG_PRINTLN(heapPreAlloc - ESP.getFreeHeap());
#ifdef WLED_DEBUG #ifdef WLED_DEBUG
pinManager.allocatePin(1, true, PinOwner::DebugOut); // GPIO1 reserved for debug output pinManager.allocatePin(TX, true, PinOwner::DebugOut); // GPIO1 reserved for debug output
#endif #endif
#ifdef WLED_ENABLE_DMX //reserve GPIO2 as hardcoded DMX pin #ifdef WLED_ENABLE_DMX //reserve GPIO2 as hardcoded DMX pin
pinManager.allocatePin(2, true, PinOwner::DMX); pinManager.allocatePin(2, true, PinOwner::DMX);
@ -348,7 +348,7 @@ void WLED::setup()
#ifdef WLED_ENABLE_ADALIGHT #ifdef WLED_ENABLE_ADALIGHT
//Serial RX (Adalight, Improv, Serial JSON) only possible if GPIO3 unused //Serial RX (Adalight, Improv, Serial JSON) only possible if GPIO3 unused
//Serial TX (Debug, Improv, Serial JSON) only possible if GPIO1 unused //Serial TX (Debug, Improv, Serial JSON) only possible if GPIO1 unused
if (!pinManager.isPinAllocated(3) && !pinManager.isPinAllocated(1)) { if (!pinManager.isPinAllocated(RX) && !pinManager.isPinAllocated(TX)) {
Serial.println(F("Ada")); Serial.println(F("Ada"));
} }
#endif #endif

View File

@ -26,7 +26,7 @@ void updateBaudRate(uint32_t rate){
if (rate100 == currentBaud || rate100 < 96) return; if (rate100 == currentBaud || rate100 < 96) return;
currentBaud = rate100; currentBaud = rate100;
if (!pinManager.isPinAllocated(1) || pinManager.getPinOwner(1) == PinOwner::DebugOut){ if (!pinManager.isPinAllocated(TX) || pinManager.getPinOwner(1) == PinOwner::DebugOut){
Serial.print(F("Baud is now ")); Serial.println(rate); Serial.print(F("Baud is now ")); Serial.println(rate);
} }
@ -36,7 +36,7 @@ void updateBaudRate(uint32_t rate){
void handleSerial() void handleSerial()
{ {
if (pinManager.isPinAllocated(3)) return; if (pinManager.isPinAllocated(RX)) return;
#ifdef WLED_ENABLE_ADALIGHT #ifdef WLED_ENABLE_ADALIGHT
static auto state = AdaState::Header_A; static auto state = AdaState::Header_A;
@ -72,7 +72,7 @@ void handleSerial()
} else if (next == 0xB7) {updateBaudRate(1500000); } else if (next == 0xB7) {updateBaudRate(1500000);
} else if (next == 'l') { //RGB(W) LED data return as JSON array. Slow, but easy to use on the other end. } else if (next == 'l') { //RGB(W) LED data return as JSON array. Slow, but easy to use on the other end.
if (!pinManager.isPinAllocated(1) || pinManager.getPinOwner(1) == PinOwner::DebugOut){ if (!pinManager.isPinAllocated(TX) || pinManager.getPinOwner(TX) == PinOwner::DebugOut){
uint16_t used = strip.getLengthTotal(); uint16_t used = strip.getLengthTotal();
Serial.write('['); Serial.write('[');
for (uint16_t i=0; i<used; i+=1) { for (uint16_t i=0; i<used; i+=1) {
@ -82,7 +82,7 @@ void handleSerial()
Serial.println("]"); Serial.println("]");
} }
} else if (next == 'L') { //RGB LED data returned as bytes in tpm2 format. Faster, and slightly less easy to use on the other end. } else if (next == 'L') { //RGB LED data returned as bytes in tpm2 format. Faster, and slightly less easy to use on the other end.
if (!pinManager.isPinAllocated(1) || pinManager.getPinOwner(1) == PinOwner::DebugOut) { if (!pinManager.isPinAllocated(TX) || pinManager.getPinOwner(TX) == PinOwner::DebugOut) {
Serial.write(0xC9); Serial.write(0xDA); Serial.write(0xC9); Serial.write(0xDA);
uint16_t used = strip.getLengthTotal(); uint16_t used = strip.getLengthTotal();
uint16_t len = used*3; uint16_t len = used*3;
@ -107,7 +107,7 @@ void handleSerial()
} }
verboseResponse = deserializeState(doc.as<JsonObject>()); verboseResponse = deserializeState(doc.as<JsonObject>());
//only send response if TX pin is unused for other purposes //only send response if TX pin is unused for other purposes
if (verboseResponse && (!pinManager.isPinAllocated(1) || pinManager.getPinOwner(1) == PinOwner::DebugOut)) { if (verboseResponse && (!pinManager.isPinAllocated(TX) || pinManager.getPinOwner(TX) == PinOwner::DebugOut)) {
doc.clear(); doc.clear();
JsonObject state = doc.createNestedObject("state"); JsonObject state = doc.createNestedObject("state");
serializeState(state); serializeState(state);