From 523893be02f90be7e643f9fe4ab65682e15691fd Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Fri, 25 Aug 2023 16:18:37 +0200 Subject: [PATCH] 8266 audioreactive: fix crash during OTA * fix crash when starting OTA: `Panic core_esp8266_main.cpp:191 __yield ` * prevent sound sync reconnect during OTA --- usermods/audioreactive/audio_reactive.h | 8 ++++++-- wled00/wled.h | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/usermods/audioreactive/audio_reactive.h b/usermods/audioreactive/audio_reactive.h index 4f978607..c7fd194a 100644 --- a/usermods/audioreactive/audio_reactive.h +++ b/usermods/audioreactive/audio_reactive.h @@ -992,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) @@ -1436,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(); @@ -2036,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 @@ -2056,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/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