diff --git a/platformio.ini b/platformio.ini index 043af891..7919956f 100644 --- a/platformio.ini +++ b/platformio.ini @@ -260,6 +260,7 @@ build_flagsV4 = -g -DARDUINO_ARCH_ESP32 -DESP32 -DCONFIG_LITTLEFS_FOR_IDF_3_2 -DLFS_THREADSAFE -D CONFIG_ASYNC_TCP_USE_WDT=0 + ; -DARDUINO_USB_CDC_ON_BOOT=0 ;; mandatory for "classic ESP32" when builing with arduino-esp32 >=2.0.3 ;;; V4.4.x libraries (without LOROL_LITTLEFS; with newer NeoPixelBus) lib_depsV4 = ${env.lib_deps} @@ -274,10 +275,11 @@ build_flags = -g -DCONFIG_IDF_TARGET_ESP32S2 -D CONFIG_ASYNC_TCP_USE_WDT=0 -DCO + -DARDUINO_USB_MODE=0 ;; WLEDMM - mandatory for ESP32-S2 when builing with arduino-esp32 >=2.0.3 lib_deps = ${env.lib_deps} - makuna/NeoPixelBus @ 2.6.9 + makuna/NeoPixelBus @ 2.7.1 ;; WLEDMM - new version is more stable on -S2 https://github.com/pbolduc/AsyncTCP.git @ 1.2.0 [esp32c3] @@ -287,6 +289,7 @@ build_flags = -g -DCONFIG_IDF_TARGET_ESP32C3 -D CONFIG_ASYNC_TCP_USE_WDT=0 -DCO + -DARDUINO_USB_MODE=1 ;; WLEDMM - mandatory for ESP32-C3 when builing with arduino-esp32 >=2.0.3 lib_deps = ${env.lib_deps} diff --git a/tools/ESP32-Chip_info.hpp b/tools/ESP32-Chip_info.hpp index f8563ab8..1e6fad8f 100644 --- a/tools/ESP32-Chip_info.hpp +++ b/tools/ESP32-Chip_info.hpp @@ -545,12 +545,16 @@ void showRealSpeed() { Serial.print("FLASH SIZE (magic byte): "); Serial.print(ESP.getFlashChipSize() / (1024.0 * 1024), 2); Serial.println(" MB"); Serial.print("FLASH MODE (magic byte): "); Serial.print(ESP.getFlashChipMode()); Serial.println(" ; 0=QIO, 1=QOUT, 2=DIO, 3=DOUT or other\n"); + Serial.flush(); Serial.print("FLASH CHIP ID: 0x"); Serial.println(my_ESP_getFlashChipId(), HEX); - Serial.print("FLASH CHIP FREQ: "); Serial.print(my_ESP_getFlashChipSpeed() / 1000000.0, 1); Serial.println(" MHz"); +#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) + //Serial.print("FLASH CHIP FREQ: "); Serial.print(my_ESP_getFlashChipSpeed() / 1000000.0, 1); Serial.println(" MHz"); // this seems to crash on -S2 +#endif Serial.print("FLASH REAL SIZE: "); Serial.print(my_ESP_getFlashChipRealSize() / (1024.0 * 1024), 2); Serial.println(" MB"); Serial.print("FLASH REAL MODE: "); Serial.println(my_ESP_getFlashChipMode()); Serial.println(F("\n------------------------------------")); + Serial.flush(); Serial.print( "RAM HEAP SIZE: "); Serial.print(ESP.getHeapSize() / 1024.0, 2); Serial.println(" KB"); Serial.print( " FREE RAM: "); Serial.print(ESP.getFreeHeap() / 1024.0, 2); Serial.println(" KB"); Serial.print( " MAX RAM alloc: "); Serial.print(ESP.getMaxAllocHeap() / 1024.0, 2); Serial.println(" KB"); @@ -566,6 +570,7 @@ void showRealSpeed() { Serial.println(); show_psram_info_part2(); } + Serial.flush(); #endif Serial.println(); diff --git a/tools/partitions-4MB-tinyuf2_spiffs.csv b/tools/partitions-4MB-tinyuf2_spiffs.csv new file mode 100644 index 00000000..4979c127 --- /dev/null +++ b/tools/partitions-4MB-tinyuf2_spiffs.csv @@ -0,0 +1,11 @@ +# ESP-IDF Partition Table +# Name, Type, SubType, Offset, Size, Flags +# bootloader.bin,, 0x1000, 32K +# partition table, 0x8000, 4K + +nvs, data, nvs, 0x9000, 20K, +otadata, data, ota, 0xe000, 8K, +ota_0, 0, ota_0, 0x10000, 1408K, +ota_1, 0, ota_1, 0x170000, 1408K, +uf2, app, factory,0x2d0000, 256K, +spiffs, data, spiffs, 0x310000, 960K, diff --git a/usermods/audioreactive/audio_reactive.h b/usermods/audioreactive/audio_reactive.h index cf63e355..3f41033c 100644 --- a/usermods/audioreactive/audio_reactive.h +++ b/usermods/audioreactive/audio_reactive.h @@ -309,7 +309,7 @@ static float fftAddAvg(int from, int to) { // void FFTcode(void * parameter) { - DEBUGSR_PRINT("FFT started on core: "); DEBUGSR_PRINTLN(xPortGetCoreID()); + // DEBUGSR_PRINT("FFT started on core: "); DEBUGSR_PRINTLN(xPortGetCoreID()); // causes trouble on -S2 // see https://www.freertos.org/vtaskdelayuntil.html const TickType_t xFrequency = FFT_MIN_CYCLE * portTICK_PERIOD_MS; diff --git a/wled00/pin_manager.cpp b/wled00/pin_manager.cpp index a0de2727..302f6c5a 100644 --- a/wled00/pin_manager.cpp +++ b/wled00/pin_manager.cpp @@ -114,7 +114,7 @@ String PinManagerClass::getPinSpecialText(int gpio) { // special purpose PIN in #elif defined(CONFIG_IDF_TARGET_ESP32S2) // ESP32-S2 - if (gpio > 38 && gpio < 43) return (F("USB (CDC) / JTAG")); + //if (gpio > 38 && gpio < 43) return (F("USB (CDC) / JTAG")); // note to self: this seems to be wrong. need to fix later. if (gpio == 46) return (F("pulled-down, input only")); //if (gpio == 0 || gpio == 45 || gpio == 46) return (F("(strapping pin)")); diff --git a/wled00/wled.cpp b/wled00/wled.cpp index 43528038..b9120f1a 100644 --- a/wled00/wled.cpp +++ b/wled00/wled.cpp @@ -276,10 +276,22 @@ void WLED::setup() #endif Serial.begin(115200); - Serial.setTimeout(50); #if defined(WLED_DEBUG) && defined(ARDUINO_ARCH_ESP32) && (defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32C3) || ARDUINO_USB_CDC_ON_BOOT) delay(2500); // allow CDC USB serial to initialise #endif + + #if ARDUINO_USB_CDC_ON_BOOT + delay(2500); // WLEDMM: always allow CDC USB serial to initialise + Serial.flush(); + //Serial.setTimeout(350); // WLEDMM: don't change timeout, as it causes crashes later + // WLEDMM: redirect debug output to HWCDC + Serial0.setDebugOutput(false); + Serial.setDebugOutput(true); + #else + Serial.setTimeout(50); + #endif + + //Serial0.setDebugOutput(false); //Serial.setDebugOutput(true); USER_FLUSH(); delay(100); USER_PRINTLN(); @@ -362,6 +374,18 @@ void WLED::setup() pinManager.allocatePin(2, true, PinOwner::DMX); #endif +// WLEDMM experimental: support for single neoPixel on Adafruit boards +#if 0 + //#ifdef PIN_NEOPIXEL + //pinManager.allocatePin(PIN_NEOPIXEL, true, PinOwner::BusDigital); + //#endif + #ifdef NEOPIXEL_POWER + pinManager.allocatePin(NEOPIXEL_POWER, true, PinOwner::Relay); // just to ensure this GPIO will not get used for other purposes + pinMode(NEOPIXEL_POWER, OUTPUT); + digitalWrite(NEOPIXEL_POWER, HIGH); + #endif +#endif + USER_PRINTLN(); DEBUG_PRINTLN(F("Registering usermods ...")); registerUsermods(); @@ -369,7 +393,7 @@ void WLED::setup() for (uint8_t i=1; i } #else // ESP32 + #include // WLEDMM: needed to get Serial and HWCDC when using arduino-esp32 v2.0.x #include #include #include "esp_wifi.h" @@ -744,7 +745,7 @@ WLED_GLOBAL volatile uint8_t jsonBufferLock _INIT(0); // WLEDMM: macros to print "user messages" to Serial // cannot do this on -S2, due to buggy USBCDC serial driver -#if defined(WLED_DEBUG) || defined(WLED_DEBUG_HOST) || defined(CONFIG_IDF_TARGET_ESP32S2) +#if defined(WLED_DEBUG) || defined(WLED_DEBUG_HOST) // use DEBUG_PRINT #define USER_PRINT(x) DEBUG_PRINT(x) #define USER_PRINTLN(x) DEBUG_PRINTLN(x) @@ -756,10 +757,10 @@ WLED_GLOBAL volatile uint8_t jsonBufferLock _INIT(0); #endif #else // if serial is availeable, we use Serial.print directly - #define USER_PRINT(x) { if (canUseSerial()) Serial.print(x); } - #define USER_PRINTLN(x) { if (canUseSerial()) Serial.println(x); } - #define USER_PRINTF(x...) { if (canUseSerial()) Serial.printf(x); } - #define USER_FLUSH() {Serial.flush();} + #define USER_PRINT(x) { if (canUseSerial()) DEBUGOUT.print(x); } + #define USER_PRINTLN(x) { if (canUseSerial()) DEBUGOUT.println(x); } + #define USER_PRINTF(x...) { if (canUseSerial()) DEBUGOUT.printf(x); } + #define USER_FLUSH() {DEBUGOUT.flush();} #endif // WLEDMM end