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
#ifndef MAX_LED_MEMORY
#ifdef ESP8266
#define MAX_LED_MEMORY 4000
#else
#define MAX_LED_MEMORY 64000
#endif
#ifdef ESP8266
#define MAX_LED_MEMORY 4000
#else
#ifdef ARDUINO_ARCH_ESP32S2
#define MAX_LED_MEMORY 32000
#else
#define MAX_LED_MEMORY 64000
#endif
#endif
#endif
#ifndef MAX_LEDS_PER_BUS
@ -333,7 +337,8 @@
#define JSON_BUFFER_SIZE 24576
#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)
#ifdef ESP8266

View File

@ -728,7 +728,7 @@ void handleIR()
{
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);
}
decodeIR(results.value);

View File

@ -293,7 +293,7 @@ void WLED::setup()
//DEBUG_PRINTLN(heapPreAlloc - ESP.getFreeHeap());
#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
#ifdef WLED_ENABLE_DMX //reserve GPIO2 as hardcoded DMX pin
pinManager.allocatePin(2, true, PinOwner::DMX);
@ -348,7 +348,7 @@ void WLED::setup()
#ifdef WLED_ENABLE_ADALIGHT
//Serial RX (Adalight, Improv, Serial JSON) only possible if GPIO3 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"));
}
#endif

View File

@ -26,7 +26,7 @@ void updateBaudRate(uint32_t rate){
if (rate100 == currentBaud || rate100 < 96) return;
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);
}
@ -36,7 +36,7 @@ void updateBaudRate(uint32_t rate){
void handleSerial()
{
if (pinManager.isPinAllocated(3)) return;
if (pinManager.isPinAllocated(RX)) return;
#ifdef WLED_ENABLE_ADALIGHT
static auto state = AdaState::Header_A;
@ -72,7 +72,7 @@ void handleSerial()
} 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.
if (!pinManager.isPinAllocated(1) || pinManager.getPinOwner(1) == PinOwner::DebugOut){
if (!pinManager.isPinAllocated(TX) || pinManager.getPinOwner(TX) == PinOwner::DebugOut){
uint16_t used = strip.getLengthTotal();
Serial.write('[');
for (uint16_t i=0; i<used; i+=1) {
@ -82,7 +82,7 @@ void handleSerial()
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.
if (!pinManager.isPinAllocated(1) || pinManager.getPinOwner(1) == PinOwner::DebugOut) {
if (!pinManager.isPinAllocated(TX) || pinManager.getPinOwner(TX) == PinOwner::DebugOut) {
Serial.write(0xC9); Serial.write(0xDA);
uint16_t used = strip.getLengthTotal();
uint16_t len = used*3;
@ -107,7 +107,7 @@ void handleSerial()
}
verboseResponse = deserializeState(doc.as<JsonObject>());
//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();
JsonObject state = doc.createNestedObject("state");
serializeState(state);