8266 audioreactive: fix crash during OTA

* fix crash when starting OTA: `Panic core_esp8266_main.cpp:191 __yield `
* prevent sound sync reconnect during OTA
This commit is contained in:
Frank
2023-08-25 16:18:37 +02:00
parent 07d204e431
commit 523893be02
2 changed files with 7 additions and 3 deletions

View File

@@ -992,6 +992,8 @@ class AudioReactive : public Usermod {
const uint16_t delayMs = 10; // I don't want to sample too often and overload WLED 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 uint16_t audioSyncPort= 11988;// default port for UDP sound sync
bool updateIsRunning = false; // true during OTA.
#ifdef ARDUINO_ARCH_ESP32 #ifdef ARDUINO_ARCH_ESP32
// used for AGC // used for AGC
int last_soundAgc = -1; // used to detect AGC mode change (for resetting AGC internal error buffers) 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 (udpSyncConnected) return; // already connected
if (millis() - last_connection_attempt < 15000) return; // only try once in 15 seconds 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 // if we arrive here, we need a UDP connection but don't have one
last_connection_attempt = millis(); last_connection_attempt = millis();
@@ -2036,6 +2039,7 @@ class AudioReactive : public Usermod {
} }
micDataReal = 0.0f; // just to be sure micDataReal = 0.0f; // just to be sure
if (enabled) disableSoundProcessing = false; if (enabled) disableSoundProcessing = false;
updateIsRunning = init;
} }
#else // reduced function for 8266 #else // reduced function for 8266
@@ -2056,8 +2060,8 @@ class AudioReactive : public Usermod {
receivedFormat = 0; receivedFormat = 0;
} }
} }
yield(); // to make sure that Wifi stays alive if (enabled) disableSoundProcessing = init; // init = true means that OTA is just starting --> don't process audio
if (enabled) disableSoundProcessing = false; updateIsRunning = init;
} }
#endif #endif

View File

@@ -8,7 +8,7 @@
*/ */
// version code in format yymmddb (b = daily build) // 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 //uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG //#define WLED_USE_MY_CONFIG