diff --git a/platformio.ini b/platformio.ini index 273759e9..2802084e 100644 --- a/platformio.ini +++ b/platformio.ini @@ -1094,7 +1094,7 @@ build_unflags = ; bin entries (with WLED_RELEASE_NAME) - +;; ESP32, 4MB, optimized for speed, basic features and audioreactive only [env:esp32_4MB_S] extends = esp32_4MB_S_base build_unflags = ${esp32_4MB_S_base.build_unflags} @@ -1109,12 +1109,15 @@ build_flags = ${esp32_4MB_S_base.build_flags} -D WLED_DISABLE_LOXONE ;-D WLED_DISABLE_MQTT ;-D WLED_DISABLE_INFRARED + ;WLEDMM: disable the next two lines if you don't need "net Debug". It will free ~2% of flash + -D WLED_DEBUG_HOST='"192.168.x.x"' ;; to send debug messages over network to host 192.168.x.y - FQDN is also possible + -D WLED_DEBUG_PORT=1768 ;; port for network debugging. default = 7868 ;; normal build ; RAM: [=== ] 25.0% (used 81988 bytes from 327680 bytes) ; Flash: [========= ] 87.4% (used 1374677 bytes from 1572864 bytes) WLEDMM: Earlier 85.7 ;; optimized-for-speed build -; RAM: [=== ] 25.1% (used 82092 bytes from 327680 bytes) -; Flash: [==========] 98.8% (used 1553629 bytes from 1572864 bytes) +; RAM: [=== ] 25.8% (used 84628 bytes from 327680 bytes) +; Flash: [==========] 99.4% (used 1562869 bytes from 1572864 bytes) [env:esp32_4MB_M] extends = esp32_4MB_M_base diff --git a/usermods/audioreactive/audio_reactive.h b/usermods/audioreactive/audio_reactive.h index 9de947ae..c7fd194a 100644 --- a/usermods/audioreactive/audio_reactive.h +++ b/usermods/audioreactive/audio_reactive.h @@ -98,7 +98,12 @@ static float micDataReal = 0.0f; // MicIn data with full 24bit re static float multAgc = 1.0f; // sample * multAgc = sampleAgc. Our AGC multiplier static float sampleAvg = 0.0f; // Smoothed Average sample - sampleAvg < 1 means "quiet" (simple noise gate) static float sampleAgc = 0.0f; // Smoothed AGC sample +#ifdef SR_SQUELCH +static uint8_t soundAgc = 1; // Automagic gain control: 0 - none, 1 - normal, 2 - vivid, 3 - lazy (config value) - enable AGC if default "squelch" was provided +#else static uint8_t soundAgc = 0; // Automagic gain control: 0 - none, 1 - normal, 2 - vivid, 3 - lazy (config value) +#endif + #endif static float volumeSmth = 0.0f; // either sampleAvg or sampleAgc depending on soundAgc; smoothed sample static float FFT_MajorPeak = 1.0f; // FFT: strongest (peak) frequency @@ -987,6 +992,8 @@ class AudioReactive : public Usermod { const uint16_t delayMs = 10; // I don't want to sample too often and overload WLED uint16_t audioSyncPort= 11988;// default port for UDP sound sync + bool updateIsRunning = false; // true during OTA. + #ifdef ARDUINO_ARCH_ESP32 // used for AGC int last_soundAgc = -1; // used to detect AGC mode change (for resetting AGC internal error buffers) @@ -1431,6 +1438,7 @@ class AudioReactive : public Usermod { } if (udpSyncConnected) return; // already connected if (millis() - last_connection_attempt < 15000) return; // only try once in 15 seconds + if (updateIsRunning) return; // don't reconect during OTA // if we arrive here, we need a UDP connection but don't have one last_connection_attempt = millis(); @@ -2031,6 +2039,7 @@ class AudioReactive : public Usermod { } micDataReal = 0.0f; // just to be sure if (enabled) disableSoundProcessing = false; + updateIsRunning = init; } #else // reduced function for 8266 @@ -2051,8 +2060,8 @@ class AudioReactive : public Usermod { receivedFormat = 0; } } - yield(); // to make sure that Wifi stays alive - if (enabled) disableSoundProcessing = false; + if (enabled) disableSoundProcessing = init; // init = true means that OTA is just starting --> don't process audio + updateIsRunning = init; } #endif diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index 51c4889f..6b45977f 100644 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -1775,16 +1775,18 @@ void WS2812FX::show(void) { estimateCurrentAndLimitBri(); + #if defined(ARDUINO_ARCH_ESP32) && defined(WLEDMM_FASTPATH) + unsigned long b4show = millis(); // WLEDMM the time before calling "show" + #endif // some buses send asynchronously and this method will return before // all of the data has been sent. // See https://github.com/Makuna/NeoPixelBus/wiki/ESP32-NeoMethods#neoesp32rmt-methods - unsigned long b4show = millis(); // WLEDMM the time before calling "show" busses.show(); unsigned long now = millis(); unsigned long diff = now - _lastShow; uint16_t fpsCurr = 200; if (diff > 0) fpsCurr = 1000 / diff; - _cumulativeFps = (3 * _cumulativeFps + fpsCurr) >> 2; + _cumulativeFps = (3 * _cumulativeFps + fpsCurr +2) >> 2; // "+2" for proper rounding (2/4 = 0.5) #if defined(ARDUINO_ARCH_ESP32) && defined(WLEDMM_FASTPATH) _lastShow = b4show; // WLEDMM this is more accurate, however it also icreases CPU load - strip.service will run more frequently #else diff --git a/wled00/pin_manager.cpp b/wled00/pin_manager.cpp index dd8eb16e..d7c7a21c 100644 --- a/wled00/pin_manager.cpp +++ b/wled00/pin_manager.cpp @@ -270,7 +270,7 @@ String PinManagerClass::getPinConflicts(int gpio) { if ((gpio == 0xFF) || (gpio < 0)) return(F("")); // explicitly allow -1 as a no-op if (!isPinOk(gpio, false)) return(F("")); // invalid GPIO - if (ownerConflict[gpio] == PinOwner::None) { + if ((ownerConflict[gpio] == PinOwner::None) || (ownerTag[gpio] == ownerConflict[gpio])) { // no conflict, or "fake" conflict with current owner return(F("")); // no conflict fot this GPIO } else { // found previous conflic! return String("!! Conflict with ") + getOwnerText(ownerConflict[gpio]) + String(" !!"); diff --git a/wled00/wled.h b/wled00/wled.h index 976df74d..9473e9d8 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2308240 +#define VERSION 2308250 //uncomment this if you have a "my_config.h" file you'd like to use //#define WLED_USE_MY_CONFIG