Minor cleanup & fix for connected().

This commit is contained in:
Blaz Kristan 2022-08-21 09:51:15 +02:00
parent bbc8049832
commit ea363a8764

View File

@ -185,16 +185,12 @@ void FFTcode(void * parameter)
delay(1); // DO NOT DELETE THIS LINE! It is needed to give the IDLE(0) task enough time and to keep the watchdog happy. delay(1); // DO NOT DELETE THIS LINE! It is needed to give the IDLE(0) task enough time and to keep the watchdog happy.
// taskYIELD(), yield(), vTaskDelay() and esp_task_wdt_feed() didn't seem to work. // taskYIELD(), yield(), vTaskDelay() and esp_task_wdt_feed() didn't seem to work.
vTaskDelayUntil( &xLastWakeTime, xFrequency); // release CPU, and let I2S fill its buffers
// Only run the FFT computing code if we're not in Receive mode and not in realtime mode // Only run the FFT computing code if we're not in Receive mode and not in realtime mode
if (disableSoundProcessing || (audioSyncEnabled & 0x02)) { if (disableSoundProcessing || (audioSyncEnabled & 0x02)) {
//delay(7); // release CPU - delay is implemeted using vTaskDelay(). cannot use yield() because we are out of arduino loop context
vTaskDelayUntil( &xLastWakeTime, xFrequency); // release CPU, by doing nothing for FFT_MIN_CYCLE millis
continue; continue;
} }
vTaskDelayUntil( &xLastWakeTime, xFrequency); // release CPU, and let I2S fill its buffers
//vTaskDelayUntil( &xLastWakeTime, xFrequency_2); // release CPU, and let I2S fill its buffers
#ifdef WLED_DEBUG #ifdef WLED_DEBUG
uint64_t start = esp_timer_get_time(); uint64_t start = esp_timer_get_time();
#endif #endif
@ -401,10 +397,9 @@ void FFTcode(void * parameter)
} }
#endif #endif
//vTaskDelayUntil( &xLastWakeTime, xFrequency_2); // release CPU, by waiting until FFT_MIN_CYCLE is over
// release second sample to volume reactive effects. // release second sample to volume reactive effects.
// Releasing a second sample now effectively doubles the "sample rate" // Releasing a second sample now effectively doubles the "sample rate"
micDataReal = maxSample2; micDataReal = maxSample2; // do we really need this? FFT now takes only about 2ms so no need for this
} // for(;;) } // for(;;)
} // FFTcode() } // FFTcode()
@ -1008,7 +1003,7 @@ class AudioReactive : public Usermod {
*/ */
void connected() void connected()
{ {
if (audioSyncPort > 0 || (audioSyncEnabled & 0x03)) { if (audioSyncPort > 0 && (audioSyncEnabled & 0x03)) {
#ifndef ESP8266 #ifndef ESP8266
udpSyncConnected = fftUdp.beginMulticast(IPAddress(239, 0, 0, 1), audioSyncPort); udpSyncConnected = fftUdp.beginMulticast(IPAddress(239, 0, 0, 1), audioSyncPort);
#else #else