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 -DFP_IN_IROM
;-Wno-deprecated-declarations ;-Wno-deprecated-declarations
;-Wno-register ;-Wno-register
-Wno-misleading-indentation
; NONOSDK22x_190703 = 2.2.2-dev(38a443e) ; NONOSDK22x_190703 = 2.2.2-dev(38a443e)
-DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_190703 -DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_190703
; lwIP 2 - Higher Bandwidth no Features ; lwIP 2 - Higher Bandwidth no Features

Wyświetl plik

@ -111,17 +111,17 @@ class Animated_Staircase : public Usermod {
} }
if (i >= onIndex && i < offIndex) { 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 // 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 // changes are propagated even when the config is changed during a wipe
// segments->mode = mainsegment.mode; // segments->mode = mainsegment.mode;
// segments->colors[0] = mainsegment.colors[0]; // segments->colors[0] = mainsegment.colors[0];
} else { } 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 // 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); colorUpdated(CALL_MODE_DIRECT_CHANGE);
} }
@ -296,7 +296,7 @@ class Animated_Staircase : public Usermod {
maxSegmentId = i - 1; maxSegmentId = i - 1;
break; break;
} }
segments->setOption(SEG_OPTION_ON, 1, 1); segments->setOption(SEG_OPTION_ON, 1, i);
} }
colorUpdated(CALL_MODE_DIRECT_CHANGE); colorUpdated(CALL_MODE_DIRECT_CHANGE);
DEBUG_PRINTLN(F("Animated Staircase disabled.")); DEBUG_PRINTLN(F("Animated Staircase disabled."));

Wyświetl plik

@ -58,7 +58,6 @@ private:
byte prevPreset = 0; byte prevPreset = 0;
byte prevPlaylist = 0; byte prevPlaylist = 0;
bool savedState = false;
uint32_t offTimerStart = 0; // off timer start time 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 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) 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) // 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_offOnly = false;
bool m_offMode = offMode;
// strings to reduce flash memory usage (used more than twice) // strings to reduce flash memory usage (used more than twice)
static const char _name[]; static const char _name[];
@ -123,13 +123,15 @@ private:
PIRtriggered = switchOn; PIRtriggered = switchOn;
if (switchOn) { if (switchOn) {
if (m_onPreset) { if (m_onPreset) {
if (currentPlaylist>0) prevPlaylist = currentPlaylist; if (currentPlaylist>0 && !offMode) {
else if (currentPreset>0) prevPreset = currentPreset; prevPlaylist = currentPlaylist;
else { unloadPlaylist();
} else if (currentPreset>0 && !offMode) {
prevPreset = currentPreset;
} else {
saveTemporaryPreset(); saveTemporaryPreset();
savedState = true;
prevPlaylist = 0; prevPlaylist = 0;
prevPreset = 0; prevPreset = 255;
} }
applyPreset(m_onPreset, NotifyUpdateMode); applyPreset(m_onPreset, NotifyUpdateMode);
return; return;
@ -148,13 +150,10 @@ private:
prevPlaylist = 0; prevPlaylist = 0;
return; return;
} else if (prevPreset) { } else if (prevPreset) {
applyPreset(prevPreset, NotifyUpdateMode); if (prevPreset<255) applyPreset(prevPreset, NotifyUpdateMode);
else applyTemporaryPreset();
prevPreset = 0; prevPreset = 0;
return; return;
} else if (savedState) {
applyTemporaryPreset();
savedState = false;
return;
} }
// preset not assigned // preset not assigned
if (bri != 0) { if (bri != 0) {

Wyświetl plik

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

Wyświetl plik

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

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; if (!errorFlag && presetToApply < 255) currentPreset = presetToApply;
effectChanged = true; //force UDP notification
colorUpdated(callModeToApply); colorUpdated(callModeToApply);
updateInterfaces(callModeToApply); updateInterfaces(callModeToApply);

Wyświetl plik

@ -8,7 +8,7 @@
*/ */
// version code in format yymmddb (b = daily build) // 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 //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