diff --git a/wled00/FX.h b/wled00/FX.h index 81f5e7d1..57d4cf04 100644 --- a/wled00/FX.h +++ b/wled00/FX.h @@ -53,7 +53,7 @@ /* each segment uses 52 bytes of SRAM memory, so if you're application fails because of insufficient memory, decreasing MAX_NUM_SEGMENTS may help */ #ifdef ESP8266 - #define MAX_NUM_SEGMENTS 24 + #define MAX_NUM_SEGMENTS 18 /* How many color transitions can run at once */ #define MAX_NUM_TRANSITIONS 8 /* How much data bytes all segments combined may allocate */ diff --git a/wled00/data/index.js b/wled00/data/index.js index e0f03f50..dbbb1f3d 100644 --- a/wled00/data/index.js +++ b/wled00/data/index.js @@ -28,6 +28,13 @@ var cfg = { theme:{base:"dark", bg:{url:""}, alpha:{bg:0.6,tab:0.8}, color:{bg:""}}, comp :{colors:{picker: true, rgb: false, quick: true, hex: false}, labels:true, pcmbot:false, pid:true, seglen:false} }; +var hol = [ + [0,11,24,4,"https://aircoookie.github.io/xmas.png"], // christmas + [0,2,17,1,"https://images.alphacoders.com/491/491123.jpg"], // st. Patrick's day + [2022,3,17,2,"https://aircoookie.github.io/easter.png"], + [2023,3,9,2,"https://aircoookie.github.io/easter.png"], + [2024,2,31,2,"https://aircoookie.github.io/easter.png"] +]; var cpick = new iro.ColorPicker("#picker", { width: 260, @@ -151,33 +158,12 @@ function loadBg(iUrl) img.src = iUrl; if (iUrl == "") { var today = new Date(); - var hol = [ - [0,11,24,4,"https://aircoookie.github.io/xmas.png"], // christmas - [0,2,17,1,"https://images.alphacoders.com/491/491123.jpg"], // st. Patrick's day - [2022,3,17,2,"https://aircoookie.github.io/easter.png"], - [2023,3,9,2,"https://aircoookie.github.io/easter.png"], - [2024,2,31,2,"https://aircoookie.github.io/easter.png"] - ]; - fetch("./holidays.json", { - method: 'get' - }) - .then(res => { - //if (!res.ok) showErrorToast(); - return res.json(); - }) - .then(json => { - if (Array.isArray(json)) hol = json; - //TODO: do some parsing first - }) - .catch(function (error) { - console.log("holidays.json does not contain array of holidays."); - }); for (var i=0; i=hs && today<=he) img.src = hol[i][4]; + if (today>=hs && today { @@ -198,7 +184,7 @@ function loadSkinCSS(cId) l.id = cId; l.rel = 'stylesheet'; l.type = 'text/css'; - l.href = '/skin.css'; + l.href = (loc?`http://${locip}`:'.') + '/skin.css'; l.media = 'all'; h.appendChild(l); } @@ -221,7 +207,25 @@ function onLoad() resetPUtil(); applyCfg(); - loadBg(cfg.theme.bg.url); + if (cfg.theme.bg.url=="") { + fetch((loc?`http://${locip}`:'.') + "/holidays.json", { + method: 'get' + }) + .then(res => { + //if (!res.ok) showErrorToast(); + return res.json(); + }) + .then(json => { + if (Array.isArray(json)) hol = json; + //TODO: do some parsing first + loadBg(cfg.theme.bg.url); + }) + .catch(function (error) { + loadBg(cfg.theme.bg.url); + console.log("holidays.json does not contain array of holidays. Defaults loaded."); + }); + } else + loadBg(cfg.theme.bg.url); loadSkinCSS('skinCss'); var cd = gId('csl').children; diff --git a/wled00/data/settings_sec.htm b/wled00/data/settings_sec.htm index 211fa467..2711e999 100644 --- a/wled00/data/settings_sec.htm +++ b/wled00/data/settings_sec.htm @@ -5,6 +5,7 @@ Misc Settings