diff --git a/platformio.ini b/platformio.ini index 0622e9a3..273759e9 100644 --- a/platformio.ini +++ b/platformio.ini @@ -1247,6 +1247,8 @@ build_flags = ${common.build_flags_esp8266} ;; -D WLED_DISABLE_INFRARED ;RAM 136 bytes; FLASH 24492 bytes ; -D WLED_DISABLE_2D ; -UWLED_USE_MY_CONFIG + -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 ; -D WLED_DEBUG ; monitor_filters = esp8266_exception_decoder ;; lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation @@ -1267,6 +1269,8 @@ build_flags = ${common.build_flags_esp8266} ;; -D WLED_DISABLE_INFRARED ;RAM 136 bytes; FLASH 24492 bytes ; -D WLED_DISABLE_2D ; -UWLED_USE_MY_CONFIG + -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 ; -D WLED_DEBUG ; monitor_filters = esp8266_exception_decoder ;; lib_ignore = IRremoteESP8266 ; use with WLED_DISABLE_INFRARED for faster compilation @@ -1350,6 +1354,8 @@ build_flags = ${common.build_flags_esp8266} -D WLED_DISABLE_ALEXA -D WLED_DISABLE_HUESYNC ; -D WLED_DEBUG ${common.debug_flags} ;; un-comment for debug messages + -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 ;; -D WLED_DISABLE_ESPNOW ;; might help in case of WiFi connectivity problems ; -D WLED_DISABLE_LOXONE ; FLASH 1272 bytes ; -D WLED_DISABLE_MQTT ; RAM 216 bytes; FLASH 16496 bytes @@ -1389,6 +1395,8 @@ build_flags = ${common.build_flags_esp8266} -D USERMOD_FOUR_LINE_DISPLAY -D USERMOD_MPU6050_IMU ; gyro/accelero for USERMOD_GAMES (ONLY WORKS IF USERMOD_FOUR_LINE_DISPLAY NOT INCLUDED - I2C SHARING BUG) -D USERMOD_GAMES ; WLEDMM usermod + -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 ; -D WLED_DEBUG monitor_filters = esp8266_exception_decoder lib_deps = ${esp8266.lib_deps} diff --git a/usermods/audioreactive/audio_reactive.h b/usermods/audioreactive/audio_reactive.h index ca364d10..9de947ae 100644 --- a/usermods/audioreactive/audio_reactive.h +++ b/usermods/audioreactive/audio_reactive.h @@ -37,7 +37,7 @@ #endif // high-resolution type for input filters -#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) +#if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) #define SR_HIRES_TYPE double // ESP32 and ESP32-S3 (with FPU) are fast enough to use "double" #else #define SR_HIRES_TYPE float // prefer faster type on slower boards (-S2, -C3) @@ -987,11 +987,11 @@ 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 +#ifdef ARDUINO_ARCH_ESP32 // used for AGC int last_soundAgc = -1; // used to detect AGC mode change (for resetting AGC internal error buffers) double control_integrated = 0.0; // persistent across calls to agcAvg(); "integrator control" = accumulated error -#ifdef ARDUINO_ARCH_ESP32 // variables used by getSample() and agcAvg() int16_t micIn = 0; // Current sample starts with negative values and large values, which is why it's 16 bit signed double sampleMax = 0.0; // Max sample over a few seconds. Needed for AGC controler. @@ -1018,7 +1018,7 @@ class AudioReactive : public Usermod { static const char _name[]; static const char _enabled[]; static const char _inputLvl[]; -#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3) +#if defined(ARDUINO_ARCH_ESP32) && !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3) static const char _analogmic[]; #endif static const char _digitalmic[]; @@ -1724,11 +1724,11 @@ class AudioReactive : public Usermod { delay(250); // give microphone enough time to initialise if (!audioSource) enabled = false; // audio failed to initialise - if (FFT_Task == nullptr) enabled = false; // FFT task creation failed #endif - if (enabled) onUpdateBegin(false); // create FFT task - if (enabled) disableSoundProcessing = false; // all good - enable audio processing + if (enabled) onUpdateBegin(false); // create FFT task, and initailize network + #ifdef ARDUINO_ARCH_ESP32 + if (FFT_Task == nullptr) enabled = false; // FFT task creation failed if((!audioSource) || (!audioSource->isInitialized())) { // audio source failed to initialize. Still stay "enabled", as there might be input arriving via UDP Sound Sync #ifdef WLED_DEBUG DEBUG_PRINTLN(F("AR: Failed to initialize sound input driver. Please check input PIN settings.")); @@ -1740,12 +1740,16 @@ class AudioReactive : public Usermod { USER_PRINTLN(F("AR: sound input driver initialized successfully.")); } #endif + if (enabled) disableSoundProcessing = false; // all good - enable audio processing // try to start UDP last_UDPTime = 0; receivedFormat = 0; delay(100); if (enabled) connectUDPSoundSync(); initDone = true; + DEBUGSR_PRINT(F("AR: init done, enabled = ")); + DEBUGSR_PRINTLN(enabled ? F("true.") : F("false.")); + USER_FLUSH(); } @@ -1995,7 +1999,7 @@ class AudioReactive : public Usermod { memset(fftAvg, 0, sizeof(fftAvg)); memset(fftResult, 0, sizeof(fftResult)); for(int i=(init?0:1); i