more precision for debug info (FFT timing)

keep more detailed timing info for FFT and I2S (WLED_DEBUG)
This commit is contained in:
Frank 2022-09-08 22:45:32 +02:00
parent 228890aa19
commit cf93d6bb65

View File

@ -145,8 +145,8 @@ static float fftResultMax[NUM_GEQ_CHANNELS] = {0.0f}; // A table
#endif #endif
#ifdef WLED_DEBUG #ifdef WLED_DEBUG
static unsigned long fftTime = 0; static uint64_t fftTime = 0;
static unsigned long sampleTime = 0; static uint64_t sampleTime = 0;
#endif #endif
// Table of multiplication factors so that we can even out the frequency response. // Table of multiplication factors so that we can even out the frequency response.
@ -202,7 +202,7 @@ void FFTcode(void * parameter)
#ifdef WLED_DEBUG #ifdef WLED_DEBUG
if (start < esp_timer_get_time()) { // filter out overflows 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 sampleTime = (sampleTimeInMillis*3 + sampleTime*7)/10; // smooth
} }
#endif #endif
@ -382,7 +382,7 @@ void FFTcode(void * parameter)
#ifdef WLED_DEBUG #ifdef WLED_DEBUG
if (start < esp_timer_get_time()) { // filter out overflows 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 fftTime = (fftTimeInMillis*3 + fftTime*7)/10; // smooth
} }
#endif #endif
@ -1359,10 +1359,10 @@ class AudioReactive : public Usermod {
#ifdef WLED_DEBUG #ifdef WLED_DEBUG
infoArr = user.createNestedArray(F("Sampling time")); infoArr = user.createNestedArray(F("Sampling time"));
infoArr.add(sampleTime); infoArr.add(float(sampleTime)/100.0f);
infoArr.add(" ms"); infoArr.add(" ms");
infoArr = user.createNestedArray(F("FFT time")); infoArr = user.createNestedArray(F("FFT time"));
infoArr.add(fftTime-sampleTime); infoArr.add(float(fftTime-sampleTime)/100.0f);
infoArr.add(" ms"); infoArr.add(" ms");
#endif #endif
} }