Some fixes.
Remove (*) palettes if not all 3 color selectors shown Updated comments
This commit is contained in:
parent
f3364e1327
commit
0daddf9896
File diff suppressed because it is too large
Load Diff
@ -5946,6 +5946,48 @@ static const char *_data_FX_MODE_DRIFT_ROSE PROGMEM = "2D Drift Rose@Fade,Blur;;
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
/******************** audio enhanced routines ************************/
|
/******************** audio enhanced routines ************************/
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
/* use the following code to pass AudioReactive usermod variables to effect
|
||||||
|
|
||||||
|
uint8_t *binNum = (uint8_t*)&SEGENV.aux1, *maxVol = (uint8_t*)(&SEGENV.aux1+1); // just in case assignment
|
||||||
|
uint16_t sample = 0;
|
||||||
|
uint8_t soundAgc = 0, soundSquelch = 10;
|
||||||
|
uint8_t samplePeak = 0;
|
||||||
|
float sampleAgc = 0.0f, sampleAgv = 0.0f, multAgc = 0.0f, sampleReal = 0.0f;
|
||||||
|
float *fftBin = nullptr;
|
||||||
|
double FFT_MajorPeak = 0.0, FFT_Magnitude = 0.0;
|
||||||
|
uint8_t *fftResult = nullptr;
|
||||||
|
uint16_t *myVals = nullptr;
|
||||||
|
um_data_t *um_data;
|
||||||
|
if (usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||||
|
maxVol = (uint8_t*)um_data->u_data[0]; // requires UI element (SEGMENT.customX?)
|
||||||
|
fftResult = (uint8_t*)um_data->u_data[1];
|
||||||
|
sample = *(uint16_t*)um_data->u_data[2];
|
||||||
|
rawSampleAgc = *(uint16_t*)um_data->u_data[3];
|
||||||
|
samplePeak = *(uint8_t*)um_data->u_data[4];
|
||||||
|
binNum = (uint8_t*)um_data->u_data[5]; // requires UI element (SEGMENT.customX?)
|
||||||
|
FFT_MajorPeak = *(double*)um_data->u_data[6];
|
||||||
|
FFT_Magnitude = *(double*)um_data->u_data[7];
|
||||||
|
sampleAvg = *(float*)um_data->u_data[8];
|
||||||
|
soundAgc = *(uint8_t*)um_data->u_data[9];
|
||||||
|
sampleAgc = *(float*)um_data->u_data[10];
|
||||||
|
multAgc = *(float*)um_data->u_data[11];
|
||||||
|
sampleReal = *(float*)um_data->u_data[12];
|
||||||
|
sampleGain = *(float*)um_data->u_data[13];
|
||||||
|
myVals = (uint16_t*)um_data->u_data[14];
|
||||||
|
soundSquelch = *(uint8_t*)um_data->u_data[15];
|
||||||
|
fftBin = (float*)um_data->u_data[16];
|
||||||
|
inputLevel = (uint8_t*)um_data->u_data[17]; // requires UI element (SEGMENT.customX?)
|
||||||
|
} else {
|
||||||
|
// add support for no audio data
|
||||||
|
uint32_t ms = millis();
|
||||||
|
sample = inoise8(beatsin8(120, 10, 30)*10 + (ms>>14), ms>>3);
|
||||||
|
sample = map(sample, 50, 190, 0, 224);
|
||||||
|
sampleAvg = inoise8(beatsin8(90, 0, 200)*15 + (ms>>10), ms>>3);
|
||||||
|
samplePeak = random8() > 250; // or use: sample==224
|
||||||
|
FFT_MajorPeak = inoise8(beatsin8(90, 0, 200)*15 + (ms>>10), ms>>3);
|
||||||
|
}
|
||||||
|
if (!myVals || !fftBin || ...) return mode_static();
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////
|
/////////////////////////////////
|
||||||
@ -5965,7 +6007,7 @@ uint16_t WS2812FX::mode_ripplepeak(void) { // * Ripple peak. By A
|
|||||||
double FFT_MajorPeak = 0.0;
|
double FFT_MajorPeak = 0.0;
|
||||||
um_data_t *um_data;
|
um_data_t *um_data;
|
||||||
if (usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
if (usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||||
FFT_MajorPeak = *(double*)um_data->u_data[8];
|
FFT_MajorPeak = *(double*)um_data->u_data[6];
|
||||||
binNum = (uint8_t*)um_data->u_data[5];
|
binNum = (uint8_t*)um_data->u_data[5];
|
||||||
maxVol = (uint8_t*)um_data->u_data[0];
|
maxVol = (uint8_t*)um_data->u_data[0];
|
||||||
samplePeak = *(uint8_t*)um_data->u_data[4];
|
samplePeak = *(uint8_t*)um_data->u_data[4];
|
||||||
@ -5978,8 +6020,8 @@ uint16_t WS2812FX::mode_ripplepeak(void) { // * Ripple peak. By A
|
|||||||
|
|
||||||
if (SEGENV.call == 0) SEGENV.aux0 = 255;
|
if (SEGENV.call == 0) SEGENV.aux0 = 255;
|
||||||
|
|
||||||
*binNum = SEGMENT.custom2; // Select a bin.
|
*binNum = SEGMENT.custom2; // Select a bin.
|
||||||
*maxVol = SEGMENT.custom3/2; // Our volume comparator.
|
*maxVol = SEGMENT.custom3/2; // Our volume comparator.
|
||||||
|
|
||||||
fade_out(240); // Lower frame rate means less effective fading than FastLED
|
fade_out(240); // Lower frame rate means less effective fading than FastLED
|
||||||
fade_out(240);
|
fade_out(240);
|
||||||
@ -6054,7 +6096,7 @@ uint16_t WS2812FX::mode_2DSwirl(void) {
|
|||||||
float sampleAvg = 0.0f;
|
float sampleAvg = 0.0f;
|
||||||
um_data_t *um_data;
|
um_data_t *um_data;
|
||||||
if (usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
if (usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||||
soundAgc = *(uint8_t*)um_data->u_data[9];
|
soundAgc = *(uint8_t*)um_data->u_data[9];
|
||||||
rawSampleAgc = *(int16_t*)um_data->u_data[3];
|
rawSampleAgc = *(int16_t*)um_data->u_data[3];
|
||||||
sample = *(int16_t*)um_data->u_data[2];
|
sample = *(int16_t*)um_data->u_data[2];
|
||||||
sampleAvg = *(float*)um_data->u_data[8];
|
sampleAvg = *(float*)um_data->u_data[8];
|
||||||
@ -7277,6 +7319,7 @@ uint16_t WS2812FX::mode_waterfall(void) { // Waterfall. By: An
|
|||||||
um_data_t *um_data;
|
um_data_t *um_data;
|
||||||
if (usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
if (usermods.getUMData(&um_data, USERMOD_ID_AUDIOREACTIVE)) {
|
||||||
maxVol = (uint8_t*)um_data->u_data[0];
|
maxVol = (uint8_t*)um_data->u_data[0];
|
||||||
|
samplePeak = *(uint8_t*)um_data->u_data[4];
|
||||||
binNum = (uint8_t*)um_data->u_data[5];
|
binNum = (uint8_t*)um_data->u_data[5];
|
||||||
FFT_MajorPeak = *(double*)um_data->u_data[6];
|
FFT_MajorPeak = *(double*)um_data->u_data[6];
|
||||||
FFT_Magnitude = *(double*)um_data->u_data[7];
|
FFT_Magnitude = *(double*)um_data->u_data[7];
|
||||||
|
@ -1328,6 +1328,7 @@ function setSliderAndColorControl(idx, applyDef=false)
|
|||||||
var cslLabel = '';
|
var cslLabel = '';
|
||||||
var sep = '';
|
var sep = '';
|
||||||
var hide = true;
|
var hide = true;
|
||||||
|
var cslCnt = 0;
|
||||||
for (let i=0; i<gId("csl").children.length; i++) {
|
for (let i=0; i<gId("csl").children.length; i++) {
|
||||||
var btn = gId("csl" + i);
|
var btn = gId("csl" + i);
|
||||||
// if no controlDefined or coOnOff has a value
|
// if no controlDefined or coOnOff has a value
|
||||||
@ -1345,10 +1346,12 @@ function setSliderAndColorControl(idx, applyDef=false)
|
|||||||
else if (i==1) btn.innerHTML = "Bg";
|
else if (i==1) btn.innerHTML = "Bg";
|
||||||
else btn.innerHTML = "Cs";
|
else btn.innerHTML = "Cs";
|
||||||
hide = false;
|
hide = false;
|
||||||
|
cslCnt++;
|
||||||
} else if (!controlDefined /*|| paOnOff.length>0*/) { // if no controls then all buttons should be shown for color 1..3
|
} else if (!controlDefined /*|| paOnOff.length>0*/) { // if no controls then all buttons should be shown for color 1..3
|
||||||
btn.style.display = "inline";
|
btn.style.display = "inline";
|
||||||
btn.innerHTML = `${i+1}`;
|
btn.innerHTML = `${i+1}`;
|
||||||
hide = false;
|
hide = false;
|
||||||
|
cslCnt++;
|
||||||
} else {
|
} else {
|
||||||
btn.style.display = "none";
|
btn.style.display = "none";
|
||||||
if (i>0 && csel==i) selectSlot(0);
|
if (i>0 && csel==i) selectSlot(0);
|
||||||
@ -1382,6 +1385,10 @@ function setSliderAndColorControl(idx, applyDef=false)
|
|||||||
// if numeric set as selected palette
|
// if numeric set as selected palette
|
||||||
if (paOnOff.length>0 && paOnOff[0]!="" && !isNaN(paOnOff[0]) && parseInt(paOnOff[0])!=selectedPal) obj.seg.pal = parseInt(paOnOff[0]);
|
if (paOnOff.length>0 && paOnOff[0]!="" && !isNaN(paOnOff[0]) && parseInt(paOnOff[0])!=selectedPal) obj.seg.pal = parseInt(paOnOff[0]);
|
||||||
}
|
}
|
||||||
|
// not all color selectors shown, hide palettes created from color selectors
|
||||||
|
for (let e of (gId('pallist').querySelectorAll('.lstI')||[])) {
|
||||||
|
if (cslCnt < 3 && e.querySelector('.lstIname').innerText.indexOf("* ")>=0) e.classList.add('hide'); else e.classList.remove('hide');
|
||||||
|
}
|
||||||
if (!isEmpty(obj.seg) && applyDef) requestJson(obj); // update default values (may need throttling on ESP8266)
|
if (!isEmpty(obj.seg) && applyDef) requestJson(obj); // update default values (may need throttling on ESP8266)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
3529
wled00/html_ui.h
3529
wled00/html_ui.h
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user