Fix disbling AudioReactive usermod
Reduce IRAM pressure for ESP8266
This commit is contained in:
parent
64fd207533
commit
9519c8edbd
@ -110,7 +110,7 @@ static float fftResultPink[16] = { 1.70f, 1.71f, 1.73f, 1.78f, 1.68f, 1.56f, 1.5
|
||||
|
||||
// Create FFT object
|
||||
static arduinoFFT FFT = arduinoFFT(vReal, vImag, samplesFFT, SAMPLE_RATE);
|
||||
static TaskHandle_t FFT_Task;
|
||||
static TaskHandle_t FFT_Task = nullptr;
|
||||
|
||||
float fftAddAvg(int from, int to) {
|
||||
float result = 0.0f;
|
||||
@ -987,9 +987,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
|
||||
@ -997,7 +1001,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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,23 @@
|
||||
#include "FX.h"
|
||||
#include "palettes.h"
|
||||
|
||||
#ifdef SEGMENT
|
||||
#undef SEGMENT
|
||||
#define SEGMENT _segments[_segment_index]
|
||||
#endif
|
||||
#ifdef SEGCOLOR
|
||||
#undef SEGCOLOR
|
||||
#define SEGCOLOR(x) _colors_t[x]
|
||||
#endif
|
||||
#ifdef SEGENV
|
||||
#undef SEGENV
|
||||
#define SEGENV _segment_runtimes[_segment_index]
|
||||
#endif
|
||||
#ifdef SEGLEN
|
||||
#undef SEGLEN
|
||||
#define SEGLEN _virtualSegmentLength
|
||||
#endif
|
||||
|
||||
// setUpMatrix() - constructs ledmap array from matrix of panels with WxH pixels
|
||||
// this converts physical (possibly irregular) LED arrangement into well defined
|
||||
// array of logical pixels: fist entry corresponds to left-topmost logical pixel
|
||||
@ -151,21 +168,16 @@ void IRAM_ATTR WS2812FX::setPixelColorXY(int x, int y, byte r, byte g, byte b, b
|
||||
uint16_t index, xX = (x+g), yY = (y+j);
|
||||
if (xX >= SEGMENT.width() || yY >= SEGMENT.height()) continue; // we have reached one dimension's end
|
||||
|
||||
//if (SEGMENT.getOption(SEG_OPTION_REVERSED) ) xX = SEGMENT.width() - xX - 1;
|
||||
//if (SEGMENT.getOption(SEG_OPTION_REVERSED_Y)) yY = SEGMENT.height() - yY - 1;
|
||||
|
||||
index = get2DPixelIndex(xX, yY);
|
||||
if (index < customMappingSize) index = customMappingTable[index];
|
||||
busses.setPixelColor(index, col);
|
||||
|
||||
if (SEGMENT.getOption(SEG_OPTION_MIRROR)) { //set the corresponding horizontally mirrored pixel
|
||||
//index = get2DPixelIndex(SEGMENT.width() - xX - 1, yY);
|
||||
index = SEGMENT.getOption(SEG_OPTION_TRANSPOSED) ? get2DPixelIndex(xX, SEGMENT.height() - yY - 1) : get2DPixelIndex(SEGMENT.width() - xX - 1, yY);
|
||||
if (index < customMappingSize) index = customMappingTable[index];
|
||||
busses.setPixelColor(index, col);
|
||||
}
|
||||
if (SEGMENT.getOption(SEG_OPTION_MIRROR_Y)) { //set the corresponding vertically mirrored pixel
|
||||
//index = get2DPixelIndex(xX, SEGMENT.height() - yY - 1);
|
||||
index = SEGMENT.getOption(SEG_OPTION_TRANSPOSED) ? get2DPixelIndex(SEGMENT.width() - xX - 1, yY) : get2DPixelIndex(xX, SEGMENT.height() - yY - 1);
|
||||
if (index < customMappingSize) index = customMappingTable[index];
|
||||
busses.setPixelColor(index, col);
|
||||
|
@ -27,6 +27,23 @@
|
||||
#include "FX.h"
|
||||
#include "palettes.h"
|
||||
|
||||
#ifdef SEGMENT
|
||||
#undef SEGMENT
|
||||
#define SEGMENT _segments[_segment_index]
|
||||
#endif
|
||||
#ifdef SEGCOLOR
|
||||
#undef SEGCOLOR
|
||||
#define SEGCOLOR(x) _colors_t[x]
|
||||
#endif
|
||||
#ifdef SEGENV
|
||||
#undef SEGENV
|
||||
#define SEGENV _segment_runtimes[_segment_index]
|
||||
#endif
|
||||
#ifdef SEGLEN
|
||||
#undef SEGLEN
|
||||
#define SEGLEN _virtualSegmentLength
|
||||
#endif
|
||||
|
||||
/*
|
||||
Custom per-LED mapping has moved!
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user