Bugfixes.

- auto segments selected
- slider data aded to data-opt
This commit is contained in:
Blaz Kristan 2022-04-11 22:18:44 +02:00
parent a0e318827d
commit 845aa733b7
4 changed files with 895 additions and 893 deletions

View File

@ -745,6 +745,7 @@ void WS2812FX::makeAutoSegments(bool forceReset) {
s++; s++;
} }
for (uint8_t i = 0; i < MAX_NUM_SEGMENTS; i++) { for (uint8_t i = 0; i < MAX_NUM_SEGMENTS; i++) {
_segments[i].setOption(SEG_OPTION_SELECTED, true, i);
setSegment(i, segStarts[i], segStops[i]); setSegment(i, segStarts[i], segStops[i]);
} }
} else { } else {

View File

@ -241,8 +241,10 @@ function onLoad()
// Load initial data // Load initial data
loadPalettes(()=>{ loadPalettes(()=>{
loadPalettesData(redrawPalPrev); loadPalettesData(redrawPalPrev);
// fill effect extra data array
loadFXData(()=>{
// load and populate effects
loadFX(()=>{ loadFX(()=>{
loadFXData();
setTimeout(()=>{ // ESP8266 can't handle quick requests setTimeout(()=>{ // ESP8266 can't handle quick requests
loadPresets(()=>{ loadPresets(()=>{
requestJson(); // will create WS requestJson(); // will create WS
@ -250,6 +252,7 @@ function onLoad()
},100); },100);
}); });
}); });
});
resetUtil(); resetUtil();
d.addEventListener("visibilitychange", handleVisibilityChange, false); d.addEventListener("visibilitychange", handleVisibilityChange, false);
@ -747,24 +750,19 @@ function populateEffects()
effects.unshift({ effects.unshift({
"id": 0, "id": 0,
"name": "Solid@;!;0" "name": "Solid"
}); });
for (let i = 0; i < effects.length; i++) { for (let i = 0; i < effects.length; i++) {
// WLEDSR: add slider and color control to setX (used by requestjson) // WLEDSR: add slider and color control to setX (used by requestjson)
if (effects[i].name.indexOf("Reserved") < 0) { if (effects[i].name.indexOf("Reserved") < 0) {
var posAt = effects[i].name.indexOf("@"); var extra = !(Array.isArray(fxdata) && fxdata.length>i) ? '' : fxdata[i].substr(1);
var extra = '';
if (posAt > 0)
extra = effects[i].name.substr(posAt);
else
posAt = 999;
html += generateListItemHtml( html += generateListItemHtml(
'fx', 'fx',
effects[i].id, effects[i].id,
effects[i].name.substr(0,posAt), effects[i].name,
'setX', 'setX',
'','', '',
extra extra
); );
} }
@ -862,9 +860,9 @@ function genPalPrevCss(id)
return `background: linear-gradient(to right,${gradient.join()});`; return `background: linear-gradient(to right,${gradient.join()});`;
} }
function generateListItemHtml(listName, id, name, clickAction, extraHtml = '', extraClass = '', extraPar = '') function generateListItemHtml(listName, id, name, clickAction, extraHtml = '', extraPar = '')
{ {
return `<div class="lstI${id==0?' sticky':''} ${extraClass}" data-id="${id}" data-opt="${extraPar}" onClick="${clickAction}(${id})"> return `<div class="lstI${id==0?' sticky':''}" data-id="${id}" data-opt="${extraPar}" onClick="${clickAction}(${id})">
<label class="radio schkl" onclick="event.preventDefault()"> <label class="radio schkl" onclick="event.preventDefault()">
<input type="radio" value="${id}" name="${listName}"> <input type="radio" value="${id}" name="${listName}">
<span class="radiomark schk"></span> <span class="radiomark schk"></span>
@ -2306,10 +2304,13 @@ function search(f,l=null)
f.nextElementSibling.style.display=(f.value!=='')?'block':'none'; f.nextElementSibling.style.display=(f.value!=='')?'block':'none';
if (!l) return; if (!l) return;
var el = gId(l).querySelectorAll('.lstI'); var el = gId(l).querySelectorAll('.lstI');
for (i = 0; i < el.length; i++) { for (i = (l==='pcont'?0:1); i < el.length; i++) {
var it = el[i]; var it = el[i];
var itT = it.querySelector('.lstIname').innerText.toUpperCase(); var itT = it.querySelector('.lstIname').innerText.toUpperCase();
it.style.display = itT.indexOf(f.value.toUpperCase())>-1?'':'none'; it.style.display = itT.indexOf(f.value.toUpperCase())>-1?'':'none';
// cleaner but longer
//if (itT.indexOf(f.value.toUpperCase()) > -1) it.classList.remove('hide');
//else it.classList.add('hide');
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,7 @@
*/ */
// version code in format yymmddb (b = daily build) // version code in format yymmddb (b = daily build)
#define VERSION 2204111 #define VERSION 2204112
//uncomment this if you have a "my_config.h" file you'd like to use //uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG //#define WLED_USE_MY_CONFIG