From 1ae0dd574df3cf77c5a82e54995f0b473f534413 Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Tue, 4 Oct 2022 16:00:36 +0200 Subject: [PATCH] fix for ADC analog the "wait until I2S buffer fills" trick does not work for ADC sources, as the I2S sampling does not run in background for ADC. --- usermods/audioreactive/audio_reactive.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/usermods/audioreactive/audio_reactive.h b/usermods/audioreactive/audio_reactive.h index 6237d681..2a6efbc6 100644 --- a/usermods/audioreactive/audio_reactive.h +++ b/usermods/audioreactive/audio_reactive.h @@ -411,8 +411,11 @@ void FFTcode(void * parameter) // run peak detection autoResetPeak(); detectSamplePeak(); - - vTaskDelayUntil( &xLastWakeTime, xFrequency); // release CPU, and let I2S fill its buffers + + #if !defined(I2S_GRAB_ADC1_COMPLETELY) + if ((audioSource == nullptr) || (audioSource->getType() != AudioSource::Type_I2SAdc)) // the "delay trick" does not help for analog ADC + #endif + vTaskDelayUntil( &xLastWakeTime, xFrequency); // release CPU, and let I2S fill its buffers } // for(;;)ever } // FFTcode() task end