Merge branch 'dev' into full-seg-sync

pull/2737/head
Blaz Kristan 2022-01-09 00:03:41 +01:00
commit 523752b263
9 zmienionych plików z 2755 dodań i 2750 usunięć

Wyświetl plik

@ -187,6 +187,7 @@ build_flags =
-DFP_IN_IROM
;-Wno-deprecated-declarations
;-Wno-register
-Wno-misleading-indentation
; NONOSDK22x_190703 = 2.2.2-dev(38a443e)
-DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_190703
; lwIP 2 - Higher Bandwidth no Features

Wyświetl plik

@ -111,17 +111,17 @@ class Animated_Staircase : public Usermod {
}
if (i >= onIndex && i < offIndex) {
segments->setOption(SEG_OPTION_ON, 1, 1);
segments->setOption(SEG_OPTION_ON, 1, i);
// We may need to copy mode and colors from segment 0 to make sure
// changes are propagated even when the config is changed during a wipe
// segments->mode = mainsegment.mode;
// segments->colors[0] = mainsegment.colors[0];
} else {
segments->setOption(SEG_OPTION_ON, 0, 1);
segments->setOption(SEG_OPTION_ON, 0, i);
}
// Always mark segments as "transitional", we are animating the staircase
segments->setOption(SEG_OPTION_TRANSITIONAL, 1, 1);
segments->setOption(SEG_OPTION_TRANSITIONAL, 1, i);
}
colorUpdated(CALL_MODE_DIRECT_CHANGE);
}
@ -296,7 +296,7 @@ class Animated_Staircase : public Usermod {
maxSegmentId = i - 1;
break;
}
segments->setOption(SEG_OPTION_ON, 1, 1);
segments->setOption(SEG_OPTION_ON, 1, i);
}
colorUpdated(CALL_MODE_DIRECT_CHANGE);
DEBUG_PRINTLN(F("Animated Staircase disabled."));

Wyświetl plik

@ -58,7 +58,6 @@ private:
byte prevPreset = 0;
byte prevPlaylist = 0;
bool savedState = false;
uint32_t offTimerStart = 0; // off timer start time
byte NotifyUpdateMode = CALL_MODE_NO_NOTIFY; // notification mode for colorUpdated(): CALL_MODE_NO_NOTIFY or CALL_MODE_DIRECT_CHANGE
@ -77,6 +76,7 @@ private:
bool m_mqttOnly = false; // flag to send MQTT message only (assuming it is enabled)
// flag to enable triggering only if WLED is initially off (LEDs are not on, preventing running effect being overwritten by PIR)
bool m_offOnly = false;
bool m_offMode = offMode;
// strings to reduce flash memory usage (used more than twice)
static const char _name[];
@ -123,13 +123,15 @@ private:
PIRtriggered = switchOn;
if (switchOn) {
if (m_onPreset) {
if (currentPlaylist>0) prevPlaylist = currentPlaylist;
else if (currentPreset>0) prevPreset = currentPreset;
else {
if (currentPlaylist>0 && !offMode) {
prevPlaylist = currentPlaylist;
unloadPlaylist();
} else if (currentPreset>0 && !offMode) {
prevPreset = currentPreset;
} else {
saveTemporaryPreset();
savedState = true;
prevPlaylist = 0;
prevPreset = 0;
prevPreset = 255;
}
applyPreset(m_onPreset, NotifyUpdateMode);
return;
@ -148,13 +150,10 @@ private:
prevPlaylist = 0;
return;
} else if (prevPreset) {
applyPreset(prevPreset, NotifyUpdateMode);
if (prevPreset<255) applyPreset(prevPreset, NotifyUpdateMode);
else applyTemporaryPreset();
prevPreset = 0;
return;
} else if (savedState) {
applyTemporaryPreset();
savedState = false;
return;
}
// preset not assigned
if (bri != 0) {

Wyświetl plik

@ -198,15 +198,15 @@ function onLoad()
fetch((loc?`http://${locip}`:'.') + "/holidays.json", { // may be loaded from external source
method: 'get'
})
.then(res => {
.then((res)=>{
//if (!res.ok) showErrorToast();
return res.json();
})
.then(json => {
.then((json)=>{
if (Array.isArray(json)) hol = json;
//TODO: do some parsing first
})
.catch(function (error) {
.catch((e)=>{
console.log("holidays.json does not contain array of holidays. Defaults loaded.");
})
.finally(()=>{
@ -421,9 +421,8 @@ function loadPresets(callback = null)
pJson = json;
populatePresets();
})
.catch(function (error) {
showToast(error, true);
console.log(error);
.catch((e)=>{
showToast(e, true);
presetError(false);
})
.finally(()=>{
@ -438,17 +437,17 @@ function loadPalettes(callback = null)
fetch(url, {
method: 'get'
})
.then(res => {
.then((res)=>{
if (!res.ok) showErrorToast();
return res.json();
})
.then(json => {
.then((json)=>{
clearErrorToast();
lJson = Object.entries(json);
populatePalettes();
})
.catch(function (error) {
showToast(error, true);
.catch((e)=>{
showToast(e, true);
presetError(false);
})
.finally(()=>{
@ -464,17 +463,17 @@ function loadFX(callback = null)
fetch(url, {
method: 'get'
})
.then(res => {
.then((res)=>{
if (!res.ok) showErrorToast();
return res.json();
})
.then(json => {
.then((json)=>{
clearErrorToast();
eJson = Object.entries(json);
populateEffects();
})
.catch(function (error) {
showToast(error, true);
.catch((e)=>{
showToast(e, true);
presetError(false);
})
.finally(()=>{
@ -490,20 +489,20 @@ function loadFXData(callback = null)
fetch(url, {
method: 'get'
})
.then(res => {
.then((res)=>{
if (!res.ok) showErrorToast();
return res.json();
})
.then(json => {
.then((json)=>{
clearErrorToast();
fxdata = json||[];
// add default value for Solid
fxdata.shift()
fxdata.unshift("@;!;");
})
.catch(function (error) {
.catch((e)=>{
fxdata = [];
showToast(error, true);
showToast(e, true);
})
.finally(()=>{
if (callback) callback();
@ -910,17 +909,16 @@ function loadNodes()
fetch(url, {
method: 'get'
})
.then(res => {
.then((res)=>{
if (!res.ok) showToast('Could not load Node list!', true);
return res.json();
})
.then(json => {
.then((json)=>{
clearErrorToast();
populateNodes(lastinfo, json);
})
.catch(function (error) {
showToast(error, true);
console.log(error);
.catch((e)=>{
showToast(e, true);
});
}
@ -1074,8 +1072,8 @@ function cmpP(a, b)
function makeWS() {
if (ws) return;
ws = new WebSocket('ws://'+(loc?locip:window.location.hostname)+'/ws');
ws.onmessage = function(event) {
var json = JSON.parse(event.data);
ws.onmessage = (e)=>{
var json = JSON.parse(e.data);
if (json.leds) return; //liveview packet
clearTimeout(jsonTimeout);
jsonTimeout = null;
@ -1095,11 +1093,12 @@ function makeWS() {
displayRover(i, s);
readState(s);
};
ws.onclose = function(event) {
ws.onclose = (e)=>{
gId('connind').style.backgroundColor = "var(--c-r)";
ws = null;
if (lastinfo.ws > -1) setTimeout(makeWS,500); //retry WS connection
}
ws.onopen = function(event) {
ws.onopen = (e)=>{
ws.send("{'v':true}");
reqsLegal = true;
clearErrorToast();
@ -1389,9 +1388,9 @@ function requestJson(command=null)
readState(s);
reqsLegal = true;
})
.catch(function (error) {
showToast(error, true);
console.log(error);
.catch((e)=>{
showToast(e, true);
console.log(e);
});
}
@ -2335,7 +2334,7 @@ function move(e)
}
function showNodes() {
gId('buttonNodes').style.display = (lastinfo.ndc > 0 && (w > 797 || (w > 539 && w < 720))) ? "block":"none";
gId('buttonNodes').style.display = (lastinfo.ndc > 0 && (wW > 797 || (wW > 539 && wW < 720))) ? "block":"none";
}
function size()

Wyświetl plik

@ -176,14 +176,14 @@ async function onLoad()
fetch((loc?`http://${locip}`:'.') + "/holidays.json", {
method: 'get'
})
.then(res => {
.then((res)=>{
return res.json();
})
.then(json => {
.then((json)=>{
if (Array.isArray(json)) hol = json;
//TODO: do some parsing first
})
.catch(function(error){
.catch((e)=>{
console.log("holidays.json does not contain array of holidays. Defaults loaded.");
})
.finally(()=>{
@ -204,7 +204,7 @@ async function onLoad()
var cd = gId('csl').children;
for (var i = 0; i < cd.length; i++) cd[i].style.backgroundColor = "rgb(0, 0, 0)";
selectSlot(0);
cpick.on("input:end", function() {
cpick.on("input:end", ()=>{
setColor(1);
});
pmtLS = localStorage.getItem('wledPmt');
@ -239,7 +239,8 @@ function showToast(text, error = false)
x.className = error ? "error":"show";
clearTimeout(timeout);
x.style.animation = 'none';
timeout = setTimeout(function(){ x.classList.remove("show"); }, 2900);
timeout = setTimeout(()=>{ x.classList.remove("show"); }, 2900);
if (error) console.log(text);
}
function showErrorToast()
@ -547,12 +548,14 @@ function populateSegments(s)
<input type="checkbox" id="seg${i}sel" onchange="selSeg(${i})" ${inst.sel ? "checked":""}>
<span class="checkmark schk"></span>
</label>
<i class="icons slider-icon pwr ${powered[i] ? "act":""}" id="seg${i}pwr" onclick="setSegPwr(${i})" title="${inst.n}">&#xe08f;</i>
<div id="sliderSeg${i}Bri" class="sliderwrap il">
<input id="seg${i}bri" class="noslide" onchange="setSegBri(${i})" oninput="updateTrail(this)" max="255" min="1" type="range" value="${inst.bri}" />
<div class="sliderdisplay"></div>
<div class="il">
<i class="icons slider-icon pwr ${powered[i] ? "act":""}" id="seg${i}pwr" onclick="setSegPwr(${i})" title="${inst.n}">&#xe08f;</i>
<div id="sliderSeg${i}Bri" class="sliderwrap il">
<input id="seg${i}bri" class="noslide" onchange="setSegBri(${i})" oninput="updateTrail(this)" max="255" min="1" type="range" value="${inst.bri}" />
<div class="sliderdisplay"></div>
</div>
<output class="sliderbubble"></output>
</div>
<output class="sliderbubble"></output>
</div>`;
}
//if (gId('buttonBri').className !== 'active') tglBri(true);
@ -769,6 +772,7 @@ function generateListItemHtml(listName, id, name, clickAction, extraHtml = '', e
</div>`;
}
//update the 'sliderdisplay' background div of a slider for a visual indication of slider position
function updateTrail(e)
{
if (e==null) return;
@ -776,15 +780,17 @@ function updateTrail(e)
var perc = e.value * 100 / max;
perc = parseInt(perc);
if (perc < 50) perc += 2;
e.parentNode.getElementsByClassName('sliderdisplay')[0].style.background = `linear-gradient(90deg, var(--c-f) ${perc}%, var(--c-4) ${perc}%)`;
var bubble = e.parentNode.parentNode.getElementsByTagName('output')[0];
if (bubble) bubble.innerHTML = e.value;
var val = `linear-gradient(90deg, var(--c-f) ${perc}%, var(--c-4) ${perc}%)`;
e.parentNode.getElementsByClassName('sliderdisplay')[0].style.background = val;
var b = e.parentNode.parentNode.getElementsByTagName('output')[0];
if (b) b.innerHTML = e.value;
}
//rangetouch slider function
function toggleBubble(e)
{
var bubble = e.target.parentNode.parentNode.getElementsByTagName('output')[0];
bubble.classList.toggle('sliderbubbleshow');
var b = e.target.parentNode.parentNode.getElementsByTagName('output')[0];
b.classList.toggle('sliderbubbleshow');
}
function updatePA()
@ -850,8 +856,8 @@ function cmpP(a, b)
function makeWS() {
if (ws) return;
ws = new WebSocket('ws://'+(loc?locip:window.location.hostname)+'/ws');
ws.onmessage = function(event) {
var json = JSON.parse(event.data);
ws.onmessage = (e)=>{
var json = JSON.parse(e.data);
if (json.leds) return; //liveview packet
clearTimeout(jsonTimeout);
jsonTimeout = null;
@ -869,11 +875,12 @@ function makeWS() {
var s = json.state ? json.state : json;
readState(s);
};
ws.onclose = function(event) {
ws.onclose = (e)=>{
gId('connind').style.backgroundColor = "var(--c-r)";
ws = null;
if (lastinfo.ws > -1) setTimeout(makeWS,500);
}
ws.onopen = function(event) {
ws.onopen = (e)=>{
ws.send("{'v':true}");
reqsLegal = true;
clearErrorToast();
@ -1042,15 +1049,15 @@ function toggleNodes()
gId('nodes').style.transform = (isNodes) ? "translateY(0px)":"translateY(100%)";
gId('buttonNodes').className = (isNodes) ? "active":"";
}
/*
function tglBri(b=null)
{/*
{
if (b===null) b = gId(`briwrap`).style.display === "block";
gId('briwrap').style.display = !b ? "block":"none";
gId('buttonBri').className = !b ? "active":"";
size();
*/}
}
*/
function tglCP()
{
var p = gId('buttonCP').className === "active";
@ -1058,8 +1065,8 @@ function tglCP()
gId('picker').style.display = !p ? "block":"none";
gId('vwrap').style.display = !p ? "block":"none";
gId('rgbwrap').style.display = !p ? "block":"none";
var csl = gId(`csl`).style.display === "block";
gId('csl').style.display = !csl ? "block":"none";
var csl = gId('Slots').style.display === "block";
gId('Slots').style.display = !csl ? "block":"none";
//var ps = gId(`Presets`).style.display === "block";
//gId('Presets').style.display = !ps ? "block":"none";
}
@ -1262,7 +1269,7 @@ function setBalance(b)
}
var hc = 0;
setInterval(function(){if (!isInfo) return; hc+=18; if (hc>300) hc=0; if (hc>200)hc=306; if (hc==144) hc+=36; if (hc==108) hc+=18;
setInterval(()=>{if (!isInfo) return; hc+=18; if (hc>300) hc=0; if (hc>200)hc=306; if (hc==144) hc+=36; if (hc==108) hc+=18;
gId('heart').style.color = `hsl(${hc}, 100%, 50%)`;}, 910);
function openGH() { window.open("https://github.com/Aircoookie/WLED/wiki"); }
@ -1296,7 +1303,7 @@ function loadPalettesData(callback = null)
}
palettesData = {};
getPalettesData(0, function() {
getPalettesData(0, ()=>{
localStorage.setItem(lsKey, JSON.stringify({
p: palettesData,
vid: lastinfo.vid
@ -1315,18 +1322,17 @@ function getPalettesData(page, callback)
"Content-type": "application/json; charset=UTF-8"
}
})
.then(res => {
.then((res)=>{
if (!res.ok) showErrorToast();
return res.json();
})
.then(json => {
.then((json)=>{
palettesData = Object.assign({}, palettesData, json.p);
if (page < json.m) setTimeout(function() { getPalettesData(page + 1, callback); }, 50);
if (page < json.m) setTimeout(()=>{ getPalettesData(page + 1, callback); }, 50);
else callback();
})
.catch(function(error) {
showToast(error, true);
console.log(error);
.catch((e)=>{
showToast(e, true);
});
}

Plik diff jest za duży Load Diff

Plik diff jest za duży Load Diff

Wyświetl plik

@ -63,6 +63,7 @@ void handlePresets()
if (!errorFlag && presetToApply < 255) currentPreset = presetToApply;
effectChanged = true; //force UDP notification
colorUpdated(callModeToApply);
updateInterfaces(callModeToApply);

Wyświetl plik

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