Fix for enable/disable FFT task.
This commit is contained in:
parent
96e04f1c54
commit
377a11b160
@ -1026,9 +1026,13 @@ class AudioReactive : public Usermod {
|
||||
#ifdef WLED_DEBUG
|
||||
fftTime = sampleTime = 0;
|
||||
#endif
|
||||
if (init) vTaskDelete(FFT_Task); // update is about to begin, remove task to prevent crash
|
||||
else { // update has failed or create task requested
|
||||
// Define the FFT Task and lock it to core 0
|
||||
if (init && FFT_Task) {
|
||||
vTaskSuspend(FFT_Task); // update is about to begin, disable task to prevent crash
|
||||
} else {
|
||||
// update has failed or create task requested
|
||||
if (FFT_Task)
|
||||
vTaskResume(FFT_Task);
|
||||
else
|
||||
xTaskCreatePinnedToCore(
|
||||
FFTcode, // Function to implement the task
|
||||
"FFT", // Name of the task
|
||||
@ -1036,7 +1040,8 @@ class AudioReactive : public Usermod {
|
||||
NULL, // Task input parameter
|
||||
1, // Priority of the task
|
||||
&FFT_Task, // Task handle
|
||||
0); // Core where the task should run
|
||||
0 // Core where the task should run
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user