From da5f6315be4c46800392432b0e88437d5968456c Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 3 Sep 2022 18:43:28 +0200 Subject: [PATCH 1/4] fix for repeating debug message --- usermods/audioreactive/audio_reactive.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usermods/audioreactive/audio_reactive.h b/usermods/audioreactive/audio_reactive.h index e5bda203..13063d70 100644 --- a/usermods/audioreactive/audio_reactive.h +++ b/usermods/audioreactive/audio_reactive.h @@ -1066,7 +1066,7 @@ class AudioReactive : public Usermod { disableSoundProcessing = true; } else { #ifdef WLED_DEBUG - if ((disableSoundProcessing == true) && (audioSyncEnabled == 0)) { // we just switched to "disabled" + if ((disableSoundProcessing == true) && (audioSyncEnabled == 0) && audioSource->isInitialized()) { // we just switched to "enabled" DEBUG_PRINTLN("[AR userLoop] realtime mode ended - audio processing resumed."); DEBUG_PRINTF( " RealtimeMode = %d; RealtimeOverride = %d\n", int(realtimeMode), int(realtimeOverride)); } From 7894389f1de8a8679053a4aab3781b2cc88bb29e Mon Sep 17 00:00:00 2001 From: Frank Date: Sat, 3 Sep 2022 19:03:00 +0200 Subject: [PATCH 2/4] Compiling AR usermod on ESP32-S3 (future support) Encapsulated all parts with #ifdef that will not compile on newer ESP32 variants. It's still a long way to go before we have a working version on -S3 and -C3, bus this should help to get us started. From MoonModule/WLED repo. --- usermods/audioreactive/audio_reactive.h | 31 +++++++++++++++++++++++-- usermods/audioreactive/audio_source.h | 25 +++++++++++++++++++- 2 files changed, 53 insertions(+), 3 deletions(-) diff --git a/usermods/audioreactive/audio_reactive.h b/usermods/audioreactive/audio_reactive.h index 13063d70..88a2a16f 100644 --- a/usermods/audioreactive/audio_reactive.h +++ b/usermods/audioreactive/audio_reactive.h @@ -947,10 +947,20 @@ class AudioReactive : public Usermod { // Reset I2S peripheral for good measure i2s_driver_uninstall(I2S_NUM_0); - periph_module_reset(PERIPH_I2S0_MODULE); - + #if !defined(CONFIG_IDF_TARGET_ESP32C3) + periph_module_reset(PERIPH_I2S0_MODULE); // not possible on -C3 + #endif delay(100); // Give that poor microphone some time to setup. switch (dmType) { + #if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3) + // stub cases for not-yet-supported I2S modes on other ESP32 chips + case 0: //ADC analog + case 3: //MCLK + case 4: //SPH0645 + #if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32C3) + case 5: //PDM Microphone + #endif + #endif case 1: DEBUGSR_PRINT(F("AR: Generic I2S Microphone - ")); DEBUGSR_PRINTLN(F(I2S_MIC_CHANNEL_TEXT)); audioSource = new I2SSource(SAMPLE_RATE, BLOCK_SIZE); @@ -963,24 +973,34 @@ class AudioReactive : public Usermod { delay(100); if (audioSource) audioSource->initialize(sdaPin, sclPin, i2swsPin, i2ssdPin, i2sckPin, mclkPin); break; + #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3) + // SPH0645 is currently only possible on "classic" ESP32 case 3: DEBUGSR_PRINT(F("AR: SPH0645 Microphone - ")); DEBUGSR_PRINTLN(F(I2S_MIC_CHANNEL_TEXT)); audioSource = new SPH0654(SAMPLE_RATE, BLOCK_SIZE); delay(100); audioSource->initialize(i2swsPin, i2ssdPin, i2sckPin); break; + #endif + #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3) + // MCLK routing currently only works on "classic" ESP32 case 4: DEBUGSR_PRINT(F("AR: Generic I2S Microphone with Master Clock - ")); DEBUGSR_PRINTLN(F(I2S_MIC_CHANNEL_TEXT)); audioSource = new I2SSource(SAMPLE_RATE, BLOCK_SIZE); delay(100); if (audioSource) audioSource->initialize(i2swsPin, i2ssdPin, i2sckPin, mclkPin); break; + #endif + #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) case 5: DEBUGSR_PRINT(F("AR: I2S PDM Microphone - ")); DEBUGSR_PRINTLN(F(I2S_MIC_CHANNEL_TEXT)); audioSource = new I2SSource(SAMPLE_RATE, BLOCK_SIZE); delay(100); if (audioSource) audioSource->initialize(i2swsPin, i2ssdPin); break; + #endif + #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3) + // ADC over I2S is only possible on "classic" ESP32 case 0: default: DEBUGSR_PRINTLN(F("AR: Analog Microphone (left channel only).")); @@ -988,6 +1008,7 @@ class AudioReactive : public Usermod { delay(100); if (audioSource) audioSource->initialize(audioPin); break; + #endif } delay(250); // give microphone enough time to initialise @@ -1531,12 +1552,18 @@ class AudioReactive : public Usermod { void appendConfigData() { oappend(SET_F("dd=addDropdown('AudioReactive','digitalmic:type');")); + #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3) oappend(SET_F("addOption(dd,'Generic Analog',0);")); + #endif oappend(SET_F("addOption(dd,'Generic I2S',1);")); oappend(SET_F("addOption(dd,'ES7243',2);")); + #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3) oappend(SET_F("addOption(dd,'SPH0654',3);")); oappend(SET_F("addOption(dd,'Generic I2S with Mclk',4);")); + #endif + #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) oappend(SET_F("addOption(dd,'Generic I2S PDM',5);")); + #endif oappend(SET_F("dd=addDropdown('AudioReactive','cfg:AGC');")); oappend(SET_F("addOption(dd,'Off',0);")); oappend(SET_F("addOption(dd,'Normal',1);")); diff --git a/usermods/audioreactive/audio_source.h b/usermods/audioreactive/audio_source.h index 090b46e6..1f127ece 100644 --- a/usermods/audioreactive/audio_source.h +++ b/usermods/audioreactive/audio_source.h @@ -5,14 +5,21 @@ #include #include #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 4, 0) +#if !defined(CONFIG_IDF_TARGET_ESP32S2) #include #include #endif +#endif //#include //#include //#include +// see https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/chip-series-comparison.html#related-documents +// and https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-reference/peripherals/i2s.html#overview-of-all-modes +#if defined(CONFIG_IDF_TARGET_ESP32C2) || defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32H2) + #error This audio reactive usermod does not support ESP32-C2, ESP32-C3 or ESP32-S2. +#endif /* ToDo: remove. ES7243 is controlled via compiler defines Until this configuration is moved to the webinterface @@ -137,10 +144,12 @@ class I2SSource : public AudioSource { if (i2sckPin != I2S_PIN_NO_CHANGE) { if (!pinManager.allocatePin(i2sckPin, true, PinOwner::UM_Audioreactive)) return; } else { + #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) // This is an I2S PDM microphone, these microphones only use a clock and // data line, to make it simpler to debug, use the WS pin as CLK and SD // pin as DATA - _config.mode = i2s_mode_t(I2S_MODE_MASTER | I2S_MODE_RX | I2S_MODE_PDM); // Change mode to pdm if clock pin not provided + _config.mode = i2s_mode_t(I2S_MODE_MASTER | I2S_MODE_RX | I2S_MODE_PDM); // Change mode to pdm if clock pin not provided. PDM is not supported on ESP32-S2. PDM RX not supported on ESP32-C3 + #endif } // Reserve the master clock pin if provided @@ -222,6 +231,8 @@ class I2SSource : public AudioSource { protected: void _routeMclk(int8_t mclkPin) { +#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3) + // this way of MCLK routing only works on "classic" ESP32 /* Enable the mclk routing depending on the selected mclk pin Only I2S_NUM_0 is supported */ @@ -235,6 +246,9 @@ class I2SSource : public AudioSource { PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0RXD_U, FUNC_U0RXD_CLK_OUT2); WRITE_PERI_REG(PIN_CTRL, 0xFF00); } +#else +#warning FIX ME! +#endif } i2s_config_t _config; @@ -307,6 +321,9 @@ public: int8_t pin_ES7243_SCL; }; +#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3) +// ADC over I2S is only availeable in "classic" ESP32 + /* ADC over I2S Microphone This microphone is an ADC pin sampled via the I2S interval This allows to use the I2S API to obtain ADC samples with high sample rates @@ -489,6 +506,7 @@ class I2SAdcSource : public I2SSource { int8_t _audioPin; int8_t _myADCchannel = 0x0F; // current ADC channel for analog input. 0x0F means "undefined" }; +#endif /* SPH0645 Microphone This is an I2S microphone with some timing quirks that need @@ -502,7 +520,12 @@ class SPH0654 : public I2SSource { void initialize(uint8_t i2swsPin, uint8_t i2ssdPin, uint8_t i2sckPin, int8_t = I2S_PIN_NO_CHANGE, int8_t = I2S_PIN_NO_CHANGE, int8_t = I2S_PIN_NO_CHANGE) { I2SSource::initialize(i2swsPin, i2ssdPin, i2sckPin); +#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3) +// these registers are only existing in "classic" ESP32 REG_SET_BIT(I2S_TIMING_REG(I2S_NUM_0), BIT(9)); REG_SET_BIT(I2S_CONF_REG(I2S_NUM_0), I2S_RX_MSB_SHIFT); +#else + #warning FIX ME! Please. +#endif } }; From ad8512e2463d2b388908f7e1891d8e2fc5e44dcd Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Thu, 8 Sep 2022 20:41:33 +0200 Subject: [PATCH 3/4] Revert "Compiling AR usermod on ESP32-S3 (future support)" This reverts commit 7894389f1de8a8679053a4aab3781b2cc88bb29e. --- usermods/audioreactive/audio_reactive.h | 31 ++----------------------- usermods/audioreactive/audio_source.h | 25 +------------------- 2 files changed, 3 insertions(+), 53 deletions(-) diff --git a/usermods/audioreactive/audio_reactive.h b/usermods/audioreactive/audio_reactive.h index 88a2a16f..13063d70 100644 --- a/usermods/audioreactive/audio_reactive.h +++ b/usermods/audioreactive/audio_reactive.h @@ -947,20 +947,10 @@ class AudioReactive : public Usermod { // Reset I2S peripheral for good measure i2s_driver_uninstall(I2S_NUM_0); - #if !defined(CONFIG_IDF_TARGET_ESP32C3) - periph_module_reset(PERIPH_I2S0_MODULE); // not possible on -C3 - #endif + periph_module_reset(PERIPH_I2S0_MODULE); + delay(100); // Give that poor microphone some time to setup. switch (dmType) { - #if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32C3) || defined(CONFIG_IDF_TARGET_ESP32S3) - // stub cases for not-yet-supported I2S modes on other ESP32 chips - case 0: //ADC analog - case 3: //MCLK - case 4: //SPH0645 - #if defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32C3) - case 5: //PDM Microphone - #endif - #endif case 1: DEBUGSR_PRINT(F("AR: Generic I2S Microphone - ")); DEBUGSR_PRINTLN(F(I2S_MIC_CHANNEL_TEXT)); audioSource = new I2SSource(SAMPLE_RATE, BLOCK_SIZE); @@ -973,34 +963,24 @@ class AudioReactive : public Usermod { delay(100); if (audioSource) audioSource->initialize(sdaPin, sclPin, i2swsPin, i2ssdPin, i2sckPin, mclkPin); break; - #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3) - // SPH0645 is currently only possible on "classic" ESP32 case 3: DEBUGSR_PRINT(F("AR: SPH0645 Microphone - ")); DEBUGSR_PRINTLN(F(I2S_MIC_CHANNEL_TEXT)); audioSource = new SPH0654(SAMPLE_RATE, BLOCK_SIZE); delay(100); audioSource->initialize(i2swsPin, i2ssdPin, i2sckPin); break; - #endif - #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3) - // MCLK routing currently only works on "classic" ESP32 case 4: DEBUGSR_PRINT(F("AR: Generic I2S Microphone with Master Clock - ")); DEBUGSR_PRINTLN(F(I2S_MIC_CHANNEL_TEXT)); audioSource = new I2SSource(SAMPLE_RATE, BLOCK_SIZE); delay(100); if (audioSource) audioSource->initialize(i2swsPin, i2ssdPin, i2sckPin, mclkPin); break; - #endif - #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) case 5: DEBUGSR_PRINT(F("AR: I2S PDM Microphone - ")); DEBUGSR_PRINTLN(F(I2S_MIC_CHANNEL_TEXT)); audioSource = new I2SSource(SAMPLE_RATE, BLOCK_SIZE); delay(100); if (audioSource) audioSource->initialize(i2swsPin, i2ssdPin); break; - #endif - #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3) - // ADC over I2S is only possible on "classic" ESP32 case 0: default: DEBUGSR_PRINTLN(F("AR: Analog Microphone (left channel only).")); @@ -1008,7 +988,6 @@ class AudioReactive : public Usermod { delay(100); if (audioSource) audioSource->initialize(audioPin); break; - #endif } delay(250); // give microphone enough time to initialise @@ -1552,18 +1531,12 @@ class AudioReactive : public Usermod { void appendConfigData() { oappend(SET_F("dd=addDropdown('AudioReactive','digitalmic:type');")); - #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3) oappend(SET_F("addOption(dd,'Generic Analog',0);")); - #endif oappend(SET_F("addOption(dd,'Generic I2S',1);")); oappend(SET_F("addOption(dd,'ES7243',2);")); - #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3) oappend(SET_F("addOption(dd,'SPH0654',3);")); oappend(SET_F("addOption(dd,'Generic I2S with Mclk',4);")); - #endif - #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) oappend(SET_F("addOption(dd,'Generic I2S PDM',5);")); - #endif oappend(SET_F("dd=addDropdown('AudioReactive','cfg:AGC');")); oappend(SET_F("addOption(dd,'Off',0);")); oappend(SET_F("addOption(dd,'Normal',1);")); diff --git a/usermods/audioreactive/audio_source.h b/usermods/audioreactive/audio_source.h index 1f127ece..090b46e6 100644 --- a/usermods/audioreactive/audio_source.h +++ b/usermods/audioreactive/audio_source.h @@ -5,21 +5,14 @@ #include #include #if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(4, 4, 0) -#if !defined(CONFIG_IDF_TARGET_ESP32S2) #include #include #endif -#endif //#include //#include //#include -// see https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/hw-reference/chip-series-comparison.html#related-documents -// and https://docs.espressif.com/projects/esp-idf/en/latest/esp32s3/api-reference/peripherals/i2s.html#overview-of-all-modes -#if defined(CONFIG_IDF_TARGET_ESP32C2) || defined(CONFIG_IDF_TARGET_ESP32S2) || defined(CONFIG_IDF_TARGET_ESP32H2) - #error This audio reactive usermod does not support ESP32-C2, ESP32-C3 or ESP32-S2. -#endif /* ToDo: remove. ES7243 is controlled via compiler defines Until this configuration is moved to the webinterface @@ -144,12 +137,10 @@ class I2SSource : public AudioSource { if (i2sckPin != I2S_PIN_NO_CHANGE) { if (!pinManager.allocatePin(i2sckPin, true, PinOwner::UM_Audioreactive)) return; } else { - #if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) // This is an I2S PDM microphone, these microphones only use a clock and // data line, to make it simpler to debug, use the WS pin as CLK and SD // pin as DATA - _config.mode = i2s_mode_t(I2S_MODE_MASTER | I2S_MODE_RX | I2S_MODE_PDM); // Change mode to pdm if clock pin not provided. PDM is not supported on ESP32-S2. PDM RX not supported on ESP32-C3 - #endif + _config.mode = i2s_mode_t(I2S_MODE_MASTER | I2S_MODE_RX | I2S_MODE_PDM); // Change mode to pdm if clock pin not provided } // Reserve the master clock pin if provided @@ -231,8 +222,6 @@ class I2SSource : public AudioSource { protected: void _routeMclk(int8_t mclkPin) { -#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3) - // this way of MCLK routing only works on "classic" ESP32 /* Enable the mclk routing depending on the selected mclk pin Only I2S_NUM_0 is supported */ @@ -246,9 +235,6 @@ class I2SSource : public AudioSource { PIN_FUNC_SELECT(PERIPHS_IO_MUX_U0RXD_U, FUNC_U0RXD_CLK_OUT2); WRITE_PERI_REG(PIN_CTRL, 0xFF00); } -#else -#warning FIX ME! -#endif } i2s_config_t _config; @@ -321,9 +307,6 @@ public: int8_t pin_ES7243_SCL; }; -#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3) -// ADC over I2S is only availeable in "classic" ESP32 - /* ADC over I2S Microphone This microphone is an ADC pin sampled via the I2S interval This allows to use the I2S API to obtain ADC samples with high sample rates @@ -506,7 +489,6 @@ class I2SAdcSource : public I2SSource { int8_t _audioPin; int8_t _myADCchannel = 0x0F; // current ADC channel for analog input. 0x0F means "undefined" }; -#endif /* SPH0645 Microphone This is an I2S microphone with some timing quirks that need @@ -520,12 +502,7 @@ class SPH0654 : public I2SSource { void initialize(uint8_t i2swsPin, uint8_t i2ssdPin, uint8_t i2sckPin, int8_t = I2S_PIN_NO_CHANGE, int8_t = I2S_PIN_NO_CHANGE, int8_t = I2S_PIN_NO_CHANGE) { I2SSource::initialize(i2swsPin, i2ssdPin, i2sckPin); -#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3) -// these registers are only existing in "classic" ESP32 REG_SET_BIT(I2S_TIMING_REG(I2S_NUM_0), BIT(9)); REG_SET_BIT(I2S_CONF_REG(I2S_NUM_0), I2S_RX_MSB_SHIFT); -#else - #warning FIX ME! Please. -#endif } }; From cf93d6bb653746009770c37f70a61bff899e88dd Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Thu, 8 Sep 2022 22:45:32 +0200 Subject: [PATCH 4/4] more precision for debug info (FFT timing) keep more detailed timing info for FFT and I2S (WLED_DEBUG) --- usermods/audioreactive/audio_reactive.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/usermods/audioreactive/audio_reactive.h b/usermods/audioreactive/audio_reactive.h index 345baa9f..b3d9dbfd 100644 --- a/usermods/audioreactive/audio_reactive.h +++ b/usermods/audioreactive/audio_reactive.h @@ -145,8 +145,8 @@ static float fftResultMax[NUM_GEQ_CHANNELS] = {0.0f}; // A table #endif #ifdef WLED_DEBUG -static unsigned long fftTime = 0; -static unsigned long sampleTime = 0; +static uint64_t fftTime = 0; +static uint64_t sampleTime = 0; #endif // Table of multiplication factors so that we can even out the frequency response. @@ -202,7 +202,7 @@ void FFTcode(void * parameter) #ifdef WLED_DEBUG if (start < esp_timer_get_time()) { // filter out overflows - unsigned long sampleTimeInMillis = (esp_timer_get_time() - start +500ULL) / 1000ULL; // "+500" to ensure proper rounding + unsigned long sampleTimeInMillis = (esp_timer_get_time() - start +5ULL) / 10ULL; // "+5" to ensure proper rounding sampleTime = (sampleTimeInMillis*3 + sampleTime*7)/10; // smooth } #endif @@ -382,7 +382,7 @@ void FFTcode(void * parameter) #ifdef WLED_DEBUG if (start < esp_timer_get_time()) { // filter out overflows - unsigned long fftTimeInMillis = ((esp_timer_get_time() - start) +500ULL) / 1000ULL; // "+500" to ensure proper rounding + unsigned long fftTimeInMillis = ((esp_timer_get_time() - start) +5ULL) / 10ULL; // "+5" to ensure proper rounding fftTime = (fftTimeInMillis*3 + fftTime*7)/10; // smooth } #endif @@ -1359,11 +1359,11 @@ class AudioReactive : public Usermod { #ifdef WLED_DEBUG infoArr = user.createNestedArray(F("Sampling time")); - infoArr.add(sampleTime); - infoArr.add("ms"); + infoArr.add(float(sampleTime)/100.0f); + infoArr.add(" ms"); infoArr = user.createNestedArray(F("FFT time")); - infoArr.add(fftTime-sampleTime); - infoArr.add("ms"); + infoArr.add(float(fftTime-sampleTime)/100.0f); + infoArr.add(" ms"); #endif } }