Fixed incorrect over-memory indication in LED settings on ESP32

This commit is contained in:
cschwinne 2021-03-06 02:35:49 +01:00
parent 05521bfd3a
commit 71edc3a084
8 changed files with 26 additions and 19 deletions

View File

@ -2,6 +2,10 @@
### Development versions after 0.11.1 release
#### Build 2103050
- Fixed incorrect over-memory indication in LED settings on ESP32
#### Build 2103041
- Added destructor for BusPwm (fixes #1789)

View File

@ -47,7 +47,6 @@ class Bus {
virtual void cleanup() {};
virtual ~Bus() { //throw the bus under the bus
//Serial.println("Destructor!");
}
virtual uint8_t getPins(uint8_t* pinArray) { return 0; }

View File

@ -5,7 +5,7 @@
<meta name="viewport" content="width=500">
<title>LED Settings</title>
<script>
var d=document,laprev=55,maxST=1,bmax=5000,bquot=0; //maximum bytes for LED allocation: 5kB for 8266, 32kB for 32
var d=document,laprev=55,maxB=1,maxM=5000,bquot=0; //maximum bytes for LED allocation: 5kB for 8266, 32kB for 32
function H()
{
window.open("https://github.com/Aircoookie/WLED/wiki/Settings#led-settings");
@ -14,6 +14,9 @@
{
window.open("/settings","_self");
}
function bLimits(b,m) {
maxB = b; maxM = m;
}
function trySubmit() {
var LCs = d.getElementsByTagName("input");
for (i=0; i<LCs.length; i++) {
@ -32,10 +35,10 @@
}
}
}
if (bquot > 100) {var msg = "Too many LEDs for me to handle!"; if (bmax < 10000) msg += " Consider using an ESP32."; alert(msg); return;}
if (bquot > 100) {var msg = "Too many LEDs for me to handle!"; if (maxM < 10000) msg += " Consider using an ESP32."; alert(msg); return;}
if (d.Sf.reportValidity()) d.Sf.submit();
}
function S(){GetV();setABL(); if (maxST>4) bmax=64000; d.getElementById('m1').innerHTML = bmax;}
function S(){GetV();setABL();}
function enABL()
{
var en = d.getElementById('able').checked;
@ -63,16 +66,17 @@
case 255: d.Sf.LAsel.value = 255; break;
default: d.getElementById('LAdis').style.display = 'inline';
}
d.getElementById('m1').innerHTML = maxM;
UI();
}
//returns mem usage
function getMem(type, len, p0) {
//len = parseInt(len);
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
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
return len*6;
@ -117,7 +121,7 @@
LK.value="";
}
}
if (type == 30 || type == 31 || type == 44 || type == 45) isRGBW = true;
if (type == 30 || type == 31 || (type > 40 && type < 46 && type != 43)) isRGBW = true;
d.getElementById("dig"+n).style.display = (type > 31 && type < 48) ? "none":"inline";
d.getElementById("psd"+n).innerHTML = (type > 31 && type < 48) ? "Index:":"Start:";
}
@ -143,7 +147,7 @@
}
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('ledwarning').style.display = (maxLC > 800 || bquot > 80) ? 'inline':'none';
//TODO add warning "Recommended pins on ESP8266 are 1 and 2 (3 only with low LED count)"
@ -176,12 +180,12 @@
}
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 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");
if (n==1) {
@ -229,7 +233,7 @@
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";
UI();

File diff suppressed because one or more lines are too long

View File

@ -120,7 +120,6 @@ void handleSettingsSet(AsyncWebServerRequest *request, byte subPage)
ledCount = request->arg(F("LC")).toInt();
if (t > 0 && t <= MAX_LEDS) ledCount = t;
//DMA method uses too much ram, TODO: limit!
// upate other pins
#ifndef WLED_DISABLE_INFRARED

View File

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

View File

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

View File

@ -254,7 +254,7 @@ void getSettingsJS(byte subPage, char* dest)
}
if (subPage == 2) {
char nS[3];
char nS[8];
// add usermod pins as d.um_p array (TODO: usermod config shouldn't use state. instead we should load "um" object from cfg.json)
/*DynamicJsonDocument doc(JSON_BUFFER_SIZE);
@ -273,8 +273,10 @@ void getSettingsJS(byte subPage, char* dest)
}*/
#if defined(WLED_MAX_BUSSES) && WLED_MAX_BUSSES>1
oappend(SET_F("addLEDs("));
oappend(SET_F("bLimits("));
oappend(itoa(WLED_MAX_BUSSES,nS,10));
oappend(",");
oappend(itoa(MAX_LED_MEMORY,nS,10));
oappend(SET_F(");"));
#endif