Conflicts:
	wled00/cfg.cpp
	wled00/const.h
	wled00/data/settings_leds.htm
	wled00/html_settings.h
	wled00/set.cpp
	wled00/wled.h
	wled00/xml.cpp
This commit is contained in:
Blaz Kristan 2021-03-07 17:53:15 +01:00
commit 43677685bb
10 changed files with 79 additions and 46 deletions

View File

@ -2,6 +2,32 @@
### Development versions after 0.11.1 release ### Development versions after 0.11.1 release
#### Build 2103060
- Auto start field population in bus config
#### Build 2103050
- Fixed incorrect over-memory indication in LED settings on ESP32
#### Build 2103041
- Added destructor for BusPwm (fixes #1789)
#### Build 2103040
- Fixed relay mode inverted when upgrading from 0.11.0
- Fixed no more than 2 pins per bus configurable in UI
- Changed to non-linear IR brightness steps (PR #1742)
- Fixed various warnings (PR #1744)
- Added UDP DNRGBW Mode (PR #1704)
- Added dynamic LED mapping with ledmap.json file (PR #1738)
- Added support for QuinLED-ESP32-Ethernet board
- Added support for WESP32 ethernet board (PR #1764)
- Added Caching for main UI (PR #1704)
- Added Tetrix mode (PR #1729)
- Added memory check on Bus creation
#### Build 2102050 #### Build 2102050
- Version bump to 0.12.0-a0 "Hikari" - Version bump to 0.12.0-a0 "Hikari"

View File

@ -55,7 +55,6 @@ class Bus {
virtual void cleanup() {}; virtual void cleanup() {};
virtual ~Bus() { //throw the bus under the bus virtual ~Bus() { //throw the bus under the bus
//Serial.println("Destructor!");
} }
virtual uint8_t getPins(uint8_t* pinArray) { return 0; } virtual uint8_t getPins(uint8_t* pinArray) { return 0; }
@ -243,10 +242,6 @@ class BusPwm : public Bus {
_valid = true; _valid = true;
}; };
~BusPwm() {
cleanup();
}
void setPixelColor(uint16_t pix, uint32_t c) { void setPixelColor(uint16_t pix, uint32_t c) {
if (pix != 0 || !_valid) return; //only react to first pixel if (pix != 0 || !_valid) return; //only react to first pixel
uint8_t r = c >> 16; uint8_t r = c >> 16;
@ -309,6 +304,10 @@ class BusPwm : public Bus {
deallocatePins(); deallocatePins();
} }
~BusPwm() {
cleanup();
}
private: private:
uint8_t _pins[5] = {255, 255, 255, 255, 255}; uint8_t _pins[5] = {255, 255, 255, 255, 255};
uint8_t _data[5] = {255, 255, 255, 255, 255}; uint8_t _data[5] = {255, 255, 255, 255, 255};

View File

@ -30,8 +30,8 @@ void deserializeConfig() {
return; return;
} }
//int rev_major = doc[F("rev")][0]; // 1 //int rev_major = doc["rev"][0]; // 1
//int rev_minor = doc[F("rev")][1]; // 0 //int rev_minor = doc["rev"][1]; // 0
//long vid = doc[F("vid")]; // 2010020 //long vid = doc[F("vid")]; // 2010020
@ -127,7 +127,7 @@ void deserializeConfig() {
//(this shouldn't have been in ins obj. but remains here for compatibility) //(this shouldn't have been in ins obj. but remains here for compatibility)
skipFirstLed |= skipFirst = (bool) elm[F("skip")]; skipFirstLed |= skipFirst = (bool) elm[F("skip")];
uint8_t ledType = elm[F("type")] | TYPE_WS2812_RGB; uint8_t ledType = elm[F("type")] | TYPE_WS2812_RGB;
bool reversed = elm[F("rev")]; bool reversed = elm["rev"];
//RGBW mode is enabled if at least one of the strips is RGBW //RGBW mode is enabled if at least one of the strips is RGBW
if ((bool)elm[F("rgbw")]) SET_BIT(ledType,7); else UNSET_BIT(ledType,7); // hack bit 7 to indicate RGBW (as an override if necessary) if ((bool)elm[F("rgbw")]) SET_BIT(ledType,7); else UNSET_BIT(ledType,7); // hack bit 7 to indicate RGBW (as an override if necessary)
useRGBW |= (bool)elm[F("rgbw")]; useRGBW |= (bool)elm[F("rgbw")];

View File

@ -190,7 +190,7 @@
// maximum number of LEDs - more than 1500 LEDs (or 500 DMA "LEDPIN 3" driven ones) will cause a low memory condition on ESP8266 // maximum number of LEDs - more than 1500 LEDs (or 500 DMA "LEDPIN 3" driven ones) will cause a low memory condition on ESP8266
#ifndef MAX_LEDS #ifndef MAX_LEDS
#ifdef ESP8266 #ifdef ESP8266
#define MAX_LEDS 1664 #define MAX_LEDS 8192 //rely on memory limit to limit this to 1600 LEDs
#else #else
#define MAX_LEDS 8192 #define MAX_LEDS 8192
#endif #endif
@ -204,6 +204,10 @@
#endif #endif
#endif #endif
#ifndef MAX_LEDS_PER_BUS
#define MAX_LEDS_PER_BUS 4096
#endif
// string temp buffer (now stored in stack locally) // string temp buffer (now stored in stack locally)
#define OMAX 2048 #define OMAX 2048

View File

@ -5,7 +5,7 @@
<meta name="viewport" content="width=500"> <meta name="viewport" content="width=500">
<title>LED Settings</title> <title>LED Settings</title>
<script> <script>
var d=document,laprev=55,maxST=2,bmax=5000,LCmax=1536,bquot=0; //maximum bytes for LED allocation: 5kB for 8266, 32kB for 32 var d=document,laprev=55,maxB=1,maxM=5000,maxPB=4096,bquot=0; //maximum bytes for LED allocation: 5kB for 8266, 32kB for 32
function H() function H()
{ {
window.open("https://github.com/Aircoookie/WLED/wiki/Settings#led-settings"); window.open("https://github.com/Aircoookie/WLED/wiki/Settings#led-settings");
@ -14,6 +14,9 @@
{ {
window.open("/settings","_self"); window.open("/settings","_self");
} }
function bLimits(b,p,m) {
maxB = b; maxM = m; maxPB = p;
}
function trySubmit() { function trySubmit() {
var LCs = d.getElementsByTagName("input"); var LCs = d.getElementsByTagName("input");
for (i=0; i<LCs.length; i++) { for (i=0; i<LCs.length; i++) {
@ -31,10 +34,10 @@
} }
} }
} }
if (bquot > 100) {var msg = "Too many LEDs for me to handle!"; if (bmax < 10000) msg += "\n\rConsider using an ESP32."; alert(msg); return;} if (bquot > 100) {var msg = "Too many LEDs for me to handle!"; if (maxM < 10000) msg += "\n\rConsider using an ESP32."; alert(msg); return;}
if (d.Sf.reportValidity()) d.Sf.submit(); if (d.Sf.reportValidity()) d.Sf.submit();
} }
function S(){GetV();setABL(); d.getElementById('m1').innerHTML = bmax;} function S(){GetV();setABL(); d.getElementById('m1').innerHTML = maxM;}
function enABL() function enABL()
{ {
var en = d.getElementById('able').checked; var en = d.getElementById('able').checked;
@ -68,10 +71,10 @@
function getMem(type, len, p0) { function getMem(type, len, p0) {
//len = parseInt(len); //len = parseInt(len);
if (type < 32) { if (type < 32) {
if (bmax < 10000 && p0==3) { //8266 DMA uses 5x the mem if (maxM < 10000 && p0==3) { //8266 DMA uses 5x the mem
if (type > 29) return len*20; //RGBW if (type > 29) return len*20; //RGBW
return len*15; return len*15;
} else if (bmax > 10000) { //ESP32 RMT uses double buffer? } else if (maxM > 10000) { //ESP32 RMT uses double buffer?
if (type > 29) return len*8; //RGBW if (type > 29) return len*8; //RGBW
return len*6; return len*6;
} }
@ -84,7 +87,7 @@
} }
function UI(change=false) function UI(change=false)
{ {
var isRGBW = false, memu = 0, p3u = false; var isRGBW = false, memu = 0;
d.getElementById('ampwarning').style.display = (d.Sf.MA.value > 7200) ? 'inline':'none'; d.getElementById('ampwarning').style.display = (d.Sf.MA.value > 7200) ? 'inline':'none';
@ -147,7 +150,7 @@
} }
if (nm=="L0" || nm=="L1") { if (nm=="L0" || nm=="L1") {
var lc=d.getElementsByName("LC"+LCs[i].name.substring(2))[0]; var lc=d.getElementsByName("LC"+LCs[i].name.substring(2))[0];
lc.max=LCmax; lc.max=maxPB;
} }
if (nm=="L0" || nm=="L1" || nm=="L2" || nm=="L3" || nm=="L4" || nm=="RL" || nm=="BT" || nm=="IR" || nm=="AX") if (nm=="L0" || nm=="L1" || nm=="L2" || nm=="L3" || nm=="L4" || nm=="RL" || nm=="BT" || nm=="IR" || nm=="AX")
if (LCs[i].value!="" && LCs[i].value!="-1") { if (LCs[i].value!="" && LCs[i].value!="-1") {
@ -169,11 +172,11 @@
} }
d.getElementById('m0').innerHTML = memu; d.getElementById('m0').innerHTML = memu;
bquot = memu / bmax * 100; bquot = memu / maxM * 100;
d.getElementById('dbar').style.background = `linear-gradient(90deg, ${bquot > 60 ? (bquot > 90 ? "red":"orange"):"#ccc"} 0 ${bquot}%%, #444 ${bquot}%% 100%%)`; d.getElementById('dbar').style.background = `linear-gradient(90deg, ${bquot > 60 ? (bquot > 90 ? "red":"orange"):"#ccc"} 0 ${bquot}%%, #444 ${bquot}%% 100%%)`;
d.getElementById('ledwarning').style.display = (sLC > LCmax || maxLC > 800 || bquot > 80) ? 'inline':'none'; d.getElementById('ledwarning').style.display = (sLC > maxPB || maxLC > 800 || bquot > 80) ? 'inline':'none';
d.getElementById('ledwarning').style.color = (sLC > LCmax || maxLC > LCmax || bquot > 100) ? 'red':'orange'; d.getElementById('ledwarning').style.color = (sLC > maxPB || maxLC > maxPB || bquot > 100) ? 'red':'orange';
d.getElementById('wreason').innerHTML = (bquot > 80) ? "80% of max. LED memory" +(bquot>100 ? ` (<b>WARNING: Using over ${bmax}B!</b>)` : "") : "800 LEDs per pin"; d.getElementById('wreason').innerHTML = (bquot > 80) ? "80% of max. LED memory" +(bquot>100 ? ` (<b>WARNING: Using over ${maxM}B!</b>)` : "") : "800 LEDs per pin";
var val = Math.ceil((100 + sLC * laprev)/500)/2; var val = Math.ceil((100 + sLC * laprev)/500)/2;
val = (val > 5) ? Math.ceil(val) : val; val = (val > 5) ? Math.ceil(val) : val;
@ -197,14 +200,20 @@
d.getElementById('psu').innerHTML = s; d.getElementById('psu').innerHTML = s;
d.getElementById('psu2').innerHTML = isWS2815 ? "" : s2; d.getElementById('psu2').innerHTML = isWS2815 ? "" : s2;
} }
function lastEnd(i) {
if (i<1) return 0;
v = parseInt(d.getElementsByName("LS"+(i-1))[0].value) + parseInt(d.getElementsByName("LC"+(i-1))[0].value);
if (isNaN(v)) return 0;
return v;
}
function addLEDs(n) function addLEDs(n)
{ {
if (n>1) {maxST=n; d.getElementById("+").style.display="inline"; return;} if (n>1) {maxB=n; d.getElementById("+").style.display="inline"; return;}
var o = d.getElementsByClassName("iST"); var o = d.getElementsByClassName("iST");
var i = o.length; var i = o.length;
if ((n==1 && i>=maxST) || (n==-1 && i==0)) return; if ((n==1 && i>=maxB) || (n==-1 && i==0)) return;
var f = d.getElementById("mLC"); var f = d.getElementById("mLC");
if (n==1) { if (n==1) {
@ -242,7 +251,7 @@ Color Order:
<span id="p3d${i}"></span><input type="number" name="L3${i}" min="0" max="40" style="width:35px" onchange="UI()"/> <span id="p3d${i}"></span><input type="number" name="L3${i}" min="0" max="40" style="width:35px" onchange="UI()"/>
<span id="p4d${i}"></span><input type="number" name="L4${i}" min="0" max="40" style="width:35px" onchange="UI()"/> <span id="p4d${i}"></span><input type="number" name="L4${i}" min="0" max="40" style="width:35px" onchange="UI()"/>
<br> <br>
<span id="psd${i}">Start:</span> <input type="number" name="LS${i}" id="ls${i}" min="0" max="8191" value="0" required />&nbsp; <span id="psd${i}">Start:</span> <input type="number" name="LS${i}" id="ls${i}" min="0" max="8191" value="${lastEnd(i)}" required />&nbsp;
<div id="dig${i}" style="display:inline"> <div id="dig${i}" style="display:inline">
Count: <input type="number" name="LC${i}" min="0" max="2048" value="1" required oninput="UI()" /><br> Count: <input type="number" name="LC${i}" min="0" max="2048" value="1" required oninput="UI()" /><br>
Reverse (rotated 180°): <input type="checkbox" name="CV${i}"> Reverse (rotated 180°): <input type="checkbox" name="CV${i}">
@ -255,7 +264,7 @@ Reverse (rotated 180°): <input type="checkbox" name="CV${i}">
o[--i].remove();--i; o[--i].remove();--i;
} }
d.getElementById("+").style.display = (i<maxST-1) ? "inline":"none"; d.getElementById("+").style.display = (i<maxB-1) ? "inline":"none";
d.getElementById("-").style.display = (i>0) ? "inline":"none"; d.getElementById("-").style.display = (i>0) ? "inline":"none";
UI(); UI();
@ -263,7 +272,7 @@ Reverse (rotated 180°): <input type="checkbox" name="CV${i}">
function GetV() function GetV()
{ {
//values injected by server while sending HTML //values injected by server while sending HTML
//bmax=5000;LCmax=1536;d.um_p=[1,6,7,8,9,10,...];addLEDs(3);d.Sf.LC.value=250;addLEDs(1);d.Sf.L00.value=2;d.Sf.L10.value=0;d.Sf.LC0.value=250;d.Sf.LT0.value=22;d.Sf.CO0.value=0;d.Sf.LS0.value=0;d.Sf.LS0.checked=0;d.Sf.MA.value=5400;d.Sf.LA.value=55;d.getElementsByClassName("pow")[0].innerHTML="350mA";d.Sf.CA.value=40;d.Sf.AW.value=3;d.Sf.BO.checked=0;d.Sf.BP.value=3;d.Sf.GB.checked=0;d.Sf.GC.checked=1;d.Sf.TF.checked=1;d.Sf.TD.value=700;d.Sf.PF.checked=0;d.Sf.BF.value=64;d.Sf.TB.value=0;d.Sf.TL.value=60;d.Sf.TW.value=1;d.Sf.PB.selectedIndex=0;d.Sf.RV.checked=0;d.Sf.SL.checked=0;d.Sf.RL.value=12;d.Sf.RM.checked=0;d.Sf.BT.value=-1;d.Sf.IR.value=-1;d.Sf.AX.value=-1; //maxM=5000;maxPB=1536;d.um_p=[1,6,7,8,9,10,...];addLEDs(3);d.Sf.LC.value=250;addLEDs(1);d.Sf.L00.value=2;d.Sf.L10.value=0;d.Sf.LC0.value=250;d.Sf.LT0.value=22;d.Sf.CO0.value=0;d.Sf.LS0.value=0;d.Sf.LS0.checked=0;d.Sf.MA.value=5400;d.Sf.LA.value=55;d.getElementsByClassName("pow")[0].innerHTML="350mA";d.Sf.CA.value=40;d.Sf.AW.value=3;d.Sf.BO.checked=0;d.Sf.BP.value=3;d.Sf.GB.checked=0;d.Sf.GC.checked=1;d.Sf.TF.checked=1;d.Sf.TD.value=700;d.Sf.PF.checked=0;d.Sf.BF.value=64;d.Sf.TB.value=0;d.Sf.TL.value=60;d.Sf.TW.value=1;d.Sf.PB.selectedIndex=0;d.Sf.RV.checked=0;d.Sf.SL.checked=0;d.Sf.RL.value=12;d.Sf.RM.checked=0;d.Sf.BT.value=-1;d.Sf.IR.value=-1;d.Sf.AX.value=-1;
} }
</script> </script>
<style> <style>

File diff suppressed because one or more lines are too long

View File

@ -89,7 +89,7 @@ void deserializeSegment(JsonObject elem, byte it)
//if (pal != seg.palette && pal < strip.getPaletteCount()) strip.setPalette(pal); //if (pal != seg.palette && pal < strip.getPaletteCount()) strip.setPalette(pal);
seg.setOption(SEG_OPTION_SELECTED, elem[F("sel")] | seg.getOption(SEG_OPTION_SELECTED)); seg.setOption(SEG_OPTION_SELECTED, elem[F("sel")] | seg.getOption(SEG_OPTION_SELECTED));
seg.setOption(SEG_OPTION_REVERSED, elem[F("rev")] | seg.getOption(SEG_OPTION_REVERSED)); seg.setOption(SEG_OPTION_REVERSED, elem["rev"] | seg.getOption(SEG_OPTION_REVERSED));
seg.setOption(SEG_OPTION_MIRROR , elem[F("mi")] | seg.getOption(SEG_OPTION_MIRROR )); seg.setOption(SEG_OPTION_MIRROR , elem[F("mi")] | seg.getOption(SEG_OPTION_MIRROR ));
//temporary, strip object gets updated via colorUpdated() //temporary, strip object gets updated via colorUpdated()
@ -329,7 +329,7 @@ void serializeSegment(JsonObject& root, WS2812FX::Segment& seg, byte id, bool fo
root[F("ix")] = seg.intensity; root[F("ix")] = seg.intensity;
root[F("pal")] = seg.palette; root[F("pal")] = seg.palette;
root[F("sel")] = seg.isSelected(); root[F("sel")] = seg.isSelected();
root[F("rev")] = seg.getOption(SEG_OPTION_REVERSED); root["rev"] = seg.getOption(SEG_OPTION_REVERSED);
root[F("mi")] = seg.getOption(SEG_OPTION_MIRROR); root[F("mi")] = seg.getOption(SEG_OPTION_MIRROR);
} }

View File

@ -66,7 +66,7 @@ ethernet_settings ethernetBoards[] = {
5, // eth_power, 5, // eth_power,
23, // eth_mdc, 23, // eth_mdc,
18, // eth_mdio, 18, // eth_mdio,
ETH_PHY_LAN8720, // eth_type, (confirm this is right?) ETH_PHY_LAN8720, // eth_type,
ETH_CLOCK_GPIO17_OUT // eth_clk_mode ETH_CLOCK_GPIO17_OUT // eth_clk_mode
} }
}; };
@ -353,8 +353,7 @@ void WLED::setup()
WiFi.persistent(false); WiFi.persistent(false);
WiFi.onEvent(WiFiEvent); WiFi.onEvent(WiFiEvent);
// Serial.println(F("Ada")); Serial.println(F("Ada"));
DEBUG_PRINTLN(F("Ada"));
// generate module IDs // generate module IDs
escapedMac = WiFi.macAddress(); escapedMac = WiFi.macAddress();

View File

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

View File

@ -256,6 +256,9 @@ void getSettingsJS(byte subPage, char* dest)
if (subPage == 2) if (subPage == 2)
{ {
char nS[8];
// (TODO: usermod config shouldn't use state. instead we should load "um" object from cfg.json)
// add reserved and usermod pins as d.um_p array // add reserved and usermod pins as d.um_p array
DynamicJsonDocument doc(JSON_BUFFER_SIZE/2); DynamicJsonDocument doc(JSON_BUFFER_SIZE/2);
JsonObject mods = doc.createNestedObject(F("um")); JsonObject mods = doc.createNestedObject(F("um"));
@ -284,21 +287,14 @@ void getSettingsJS(byte subPage, char* dest)
} }
oappend(SET_F("];")); oappend(SET_F("];"));
// set limit for number of busses // set limits
#if defined(WLED_MAX_BUSSES) && WLED_MAX_BUSSES>1 oappend(SET_F("bLimits("));
oappend(SET_F("addLEDs(")); oappend(itoa(WLED_MAX_BUSSES,nS,10));
oappendi(WLED_MAX_BUSSES); oappend(",");
oappend(itoa(MAX_LEDS_PER_BUS,nS,10));
oappend(",");
oappend(itoa(MAX_LED_MEMORY,nS,10));
oappend(SET_F(");")); oappend(SET_F(");"));
#endif
// set limit for LED count
oappend(SET_F("LCmax="));
oappendi(MAX_LEDS);
oappend(";");
// set limit for LED memory
oappend(SET_F("bmax="));
oappendi(MAX_LED_MEMORY);
oappend(";");
sappend('v',SET_F("LC"),ledCount); sappend('v',SET_F("LC"),ledCount);