Minor warning suppressions.

Conflicts:
	wled00/FX.cpp
	wled00/FX_fcn.cpp
	wled00/cfg.cpp
	wled00/wled.h
	wled00/xml.cpp
This commit is contained in:
Blaz Kristan 2021-03-02 11:00:07 +01:00
commit 071281c13a
26 changed files with 115 additions and 104 deletions

View File

@ -95,16 +95,6 @@ debug_flags = -D DEBUG=1 -D WLED_DEBUG -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_CLIENT
# This reduces the OTA size with ~45KB, so it's especially useful on low memory boards (512k/1m).
# ------------------------------------------------------------------------------
build_flags =
-Wno-switch
-Wno-deprecated-declarations
-Wno-write-strings
-Wno-unused-variable
-Wno-unused-value
-Wno-sign-compare
-Wno-unused-but-set-variable
-Wno-return-type
-Wno-sequence-point
-Wno-narrowing
-DMQTT_MAX_PACKET_SIZE=1024
-DSECURE_CLIENT=SECURE_CLIENT_BEARSSL
-DBEARSSL_SSL_BASIC
@ -121,9 +111,6 @@ build_flags =
; -D USERMOD_SENSORSTOMQTT
build_unflags =
-Wall
-Wreorder
-Wdeprecated-declarations
# enables all features for travis CI
build_flags_all_features =
@ -159,7 +146,7 @@ build_flags =
-DMIMETYPE_MINIMAL
[esp32]
build_flags = -w -g
build_flags = -g
-DARDUINO_ARCH_ESP32
-DCONFIG_LITTLEFS_FOR_IDF_3_2
@ -197,7 +184,7 @@ lib_deps =
AsyncTCP @ 1.0.3
IRremoteESP8266 @ 2.7.3
https://github.com/lorol/LITTLEFS.git
https://github.com/Aircoookie/ESPAsyncWebServer.git @ ~2.0.0
https://github.com/Aircoookie/ESPAsyncWebServer.git @ ~2.0.2
#For use of the TTGO T-Display ESP32 Module with integrated TFT display uncomment the following line
#TFT_eSPI
#For use SSD1306 OLED display uncomment following

View File

@ -516,7 +516,7 @@ uint16_t WS2812FX::dissolve(uint32_t color) {
}
}
if (SEGENV.call > (255 - SEGMENT.speed) + 15)
if (SEGENV.call > (255 - SEGMENT.speed) + 15U)
{
SEGENV.aux0 = !SEGENV.aux0;
SEGENV.call = 0;
@ -1003,7 +1003,7 @@ uint16_t WS2812FX::mode_running_random(void) {
}
SEGENV.step++;
if (SEGENV.step > ((255-SEGMENT.intensity) >> 4))
if (SEGENV.step > (uint8_t)((255-SEGMENT.intensity) >> 4))
{
SEGENV.step = 0;
}
@ -1537,9 +1537,9 @@ uint16_t WS2812FX::mode_oscillate(void)
if (SEGENV.call == 0)
{
oscillators[0] = {SEGLEN/4, SEGLEN/8, 1, 1};
oscillators[1] = {SEGLEN/4*3, SEGLEN/8, 1, 2};
oscillators[2] = {SEGLEN/4*2, SEGLEN/8, -1, 1};
oscillators[0] = {(int16_t)(SEGLEN/4), (int8_t)(SEGLEN/8), 1, 1};
oscillators[1] = {(int16_t)(SEGLEN/4*3), (int8_t)(SEGLEN/8), 1, 2};
oscillators[2] = {(int16_t)(SEGLEN/4*2), (int8_t)(SEGLEN/8), -1, 1};
}
uint32_t cycleTime = 20 + (2 * (uint32_t)(255 - SEGMENT.speed));
@ -1888,7 +1888,6 @@ uint16_t WS2812FX::mode_noise16_2()
for (uint16_t i = 0; i < SEGLEN; i++) {
uint16_t shift_x = SEGENV.step >> 6; // x as a function of time
uint16_t shift_y = SEGENV.step/42;
uint32_t real_x = (i + shift_x) * scale; // calculate the coordinates within the noise field
@ -3126,7 +3125,7 @@ uint16_t WS2812FX::mode_tetrix(void) {
}
if (SEGENV.step == 0) { //init
drop->speed = 0.0238 * (SEGMENT.speed ? (SEGMENT.speed>>3)+1 : random8(6,40)); // set speed
drop->speed = 0.0238 * (SEGMENT.speed ? (SEGMENT.speed>>2)+1 : random8(6,64)); // set speed
drop->pos = SEGLEN; // start at end of segment (no need to subtract 1)
drop->col = color_from_palette(random8(0,15)<<4,false,false,0); // limit color choices so there is enough HUE gap
SEGENV.step = 1; // drop state (0 init, 1 forming, 2 falling)

View File

@ -76,7 +76,7 @@
#define SEGENV _segment_runtimes[_segment_index]
#define SEGLEN _virtualSegmentLength
#define SEGACT SEGMENT.stop
#define SPEED_FORMULA_L 5 + (50*(255 - SEGMENT.speed))/SEGLEN
#define SPEED_FORMULA_L (uint16_t)(5 + (50*(255 - SEGMENT.speed))/SEGLEN)
#define RESET_RUNTIME memset(_segment_runtimes, 0, sizeof(_segment_runtimes))
// some common colors

View File

@ -69,6 +69,11 @@ void WS2812FX::finalizeInit(void)
_useRgbw |= bus->isRgbw();
_length += bus->getLength();
}
/*
//make segment 0 cover the entire strip
_segments[0].start = 0;
_segments[0].stop = _length;
*/
setBrightness(_brightness);
@ -360,7 +365,6 @@ uint8_t WS2812FX::getPaletteCount()
bool WS2812FX::setEffectConfig(uint8_t m, uint8_t s, uint8_t in, uint8_t p) {
uint8_t mainSeg = getMainSegmentId();
Segment& seg = _segments[getMainSegmentId()];
uint8_t modePrev = seg.mode, speedPrev = seg.speed, intensityPrev = seg.intensity, palettePrev = seg.palette;

View File

@ -338,6 +338,29 @@ class BusManager {
BusManager() {
};
//utility to get the approx. memory usage of a given BusConfig
uint32_t memUsage(BusConfig &bc) {
uint8_t type = bc.type;
uint16_t len = bc.count;
if (type < 32) {
#ifdef ESP8266
if (bc.pins[0] == 3) { //8266 DMA uses 5x the mem
if (type > 29) return len*20; //RGBW
return len*15;
}
if (type > 29) return len*4; //RGBW
return len*3;
#else //ESP32 RMT uses double buffer?
if (type > 29) return len*8; //RGBW
return len*6;
#endif
}
if (type > 31 && type < 48) return 5;
if (type == 44 || type == 45) return len*4; //RGBW
return len*3;
}
int add(BusConfig &bc) {
if (numBusses >= WLED_MAX_BUSSES) return -1;
@ -357,7 +380,6 @@ class BusManager {
for (uint8_t i = 0; i < numBusses; i++) delete busses[i];
numBusses = 0;
}
//void remove(uint8_t id);
void show() {
for (uint8_t i = 0; i < numBusses; i++) {

View File

@ -100,10 +100,11 @@ void deserializeConfig() {
CJSON(strip.rgbwMode, hw_led[F("rgbwm")]);
JsonArray ins = hw_led["ins"];
uint8_t s = 0;
uint8_t s = 0; // bus iterator
bool skipFirst = skipFirstLed = false;
useRGBW = false;
busses.removeAll();
uint32_t mem = 0;
for (JsonObject elm : ins) {
if (s >= WLED_MAX_BUSSES) break;
uint8_t pins[5] = {255, 255, 255, 255, 255};
@ -132,7 +133,8 @@ void deserializeConfig() {
s++;
lC += length;
BusConfig bc = BusConfig(ledType, pins, start, length, colorOrder, reversed, skipFirst);
busses.add(bc);
mem += busses.memUsage(bc);
if (mem <= MAX_LED_MEMORY) busses.add(bc);
}
if (lC > ledCount) ledCount = lC; // fix incorrect total length (honour analog setup)
strip.finalizeInit();
@ -449,7 +451,6 @@ void serializeConfig() {
JsonArray hw_led_ins = hw_led.createNestedArray("ins");
uint16_t start = 0;
for (uint8_t s = 0; s < busses.getNumBusses(); s++) {
Bus *bus = busses.getBus(s);
if (!bus || bus->getLength()==0) break;

View File

@ -188,13 +188,19 @@
// 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
#ifdef ESP8266
#define MAX_LEDS 1536
#define MAX_LEDS 1664
#else
#define MAX_LEDS 8192
#endif
#endif
#define MAX_LEDS_DMA 500
#ifndef MAX_LED_MEMORY
#ifdef ESP8266
#define MAX_LED_MEMORY 5000
#else
#define MAX_LED_MEMORY 64000
#endif
#endif
// string temp buffer (now stored in stack locally)
#define OMAX 2048

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,maxST=2,bmax=5000,LCmax=1536,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");
@ -31,10 +31,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 (bmax < 10000) msg += "\n\rConsider 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(); d.getElementById('m1').innerHTML = bmax;}
function enABL()
{
var en = d.getElementById('able').checked;
@ -62,19 +62,17 @@
case 255: d.Sf.LAsel.value = 255; break;
default: d.getElementById('LAdis').style.display = 'inline';
}
d.getElementById('wreason2').innerText = d.LDmax?d.LDmax:'500';
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 (bmax < 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?
{
if (type > 29) return len*8; //RGBW
} else if (bmax > 10000) { //ESP32 RMT uses double buffer?
if (type > 29) return len*8; //RGBW
return len*6;
}
if (type > 29) return len*4; //RGBW
@ -149,13 +147,11 @@
}
if (nm=="L0" || nm=="L1") {
var lc=d.getElementsByName("LC"+LCs[i].name.substring(2))[0];
p3u|=(LCs[i].value==3);
if(d.LDmax && p3u) lc.max=d.LDmax;
else lc.max=d.LCmax;
lc.max=LCmax;
}
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 (d.um_p && d.um_p.some((e)=>e==parseInt(LCs[i].value,10))) {alert("Usermod/reserved pin conflict!");LCs[i].value="";LCs[i].focus();continue;}
if (d.um_p && d.um_p.some((e)=>e==parseInt(LCs[i].value,10))) {alert("Usermod/reserved pin conflict!");/*LCs[i].value=""*/;LCs[i].focus();continue;}
for (j=0; j<LCs.length; j++) {
if (i==j) continue;
var n2 = LCs[j].name.substring(0,2);
@ -174,14 +170,11 @@
d.getElementById('m0').innerHTML = memu;
bquot = memu / bmax * 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 > d.LCmax || maxLC > 800 || bquot > 80) ? 'inline':'none';
d.getElementById('ledwarning2').style.display = (d.LDmax && p3u && (sLC > d.LDmax || maxLC > d.LDmax)) ? 'inline':'none';
//TODO add warning "Recommended pins on ESP8266 are 1 and 2 (3 only with low LED count)"
//TODO add overmemory warning
d.getElementById('wreason').innerHTML = (bquot > 80) ? "than 60%% of max. LED memory" : "800 LEDs per pin";
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.color = (sLC > LCmax || maxLC > LCmax || 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";
//var val = Math.ceil((100 + d.Sf.LC.value * laprev)/500)/2;
var val = Math.ceil((100 + sLC * laprev)/500)/2;
val = (val > 5) ? Math.ceil(val) : val;
var s = "";
@ -270,7 +263,7 @@ Reverse (rotated 180°): <input type="checkbox" name="CV${i}">
function GetV()
{
//values injected by server while sending HTML
//d.LCmax=1536;d.LDmax=500;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;
//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;
}
</script>
<style>
@ -320,10 +313,6 @@ Reverse (rotated 180°): <input type="checkbox" name="CV${i}">
<div id="ledwarning" style="color: orange; display: none;">
&#9888; You might run into stability or lag issues.<br>
Use less than <span id="wreason">800 LEDs per pin</span> for the best experience!<br>
</div>
<div id="ledwarning2" style="color: orangered; display: none;">
&#9888; Pin 3 has memory restrictions.<br>
Use less than <span id="wreason2">500</span> LEDs in total to avoid memory issues!<br>
</div><hr style="width:260px">
Relay pin: <input type="number" min="-1" max="40" name="RL" onchange="UI()"> Active high <input type="checkbox" name="RM"><br>
Button pin: <input type="number" min="-1" max="40" name="BT" onchange="UI()"><br>

View File

@ -35,7 +35,8 @@ void handleDDPPacket(e131_packet_t* p) {
realtimeLock(realtimeTimeoutMs, REALTIME_MODE_DDP);
for (uint16_t i = start; i < stop; i++) {
setRealtimePixel(i, data[c++], data[c++], data[c++], 0);
setRealtimePixel(i, data[c], data[c+1], data[c+2], 0);
c+=3;
}
bool push = p->flags & DDP_PUSH_FLAG;
@ -187,11 +188,13 @@ void handleE131Packet(e131_packet_t* p, IPAddress clientIP, byte protocol){
uint16_t ledsTotal = previousLeds + (dmxChannels - dmxOffset +1) / dmxChannelsPerLed;
if (!is4Chan) {
for (uint16_t i = previousLeds; i < ledsTotal; i++) {
setRealtimePixel(i, e131_data[dmxOffset++], e131_data[dmxOffset++], e131_data[dmxOffset++], 0);
setRealtimePixel(i, e131_data[dmxOffset], e131_data[dmxOffset+1], e131_data[dmxOffset+2], 0);
dmxOffset+=3;
}
} else {
for (uint16_t i = previousLeds; i < ledsTotal; i++) {
setRealtimePixel(i, e131_data[dmxOffset++], e131_data[dmxOffset++], e131_data[dmxOffset++], e131_data[dmxOffset++]);
setRealtimePixel(i, e131_data[dmxOffset], e131_data[dmxOffset+1], e131_data[dmxOffset+2], e131_data[dmxOffset+3]);
dmxOffset+=4;
}
}
break;

View File

@ -33,8 +33,10 @@ File f;
//wrapper to find out how long closing takes
void closeFile() {
DEBUGFS_PRINT(F("Close -> "));
uint32_t s = millis();
#ifdef WLED_DEBUG_FS
DEBUGFS_PRINT(F("Close -> "));
uint32_t s = millis();
#endif
f.close();
DEBUGFS_PRINTF("took %d ms\n", millis() - s);
doCloseFile = false;
@ -53,7 +55,6 @@ bool bufferedFind(const char *target, bool fromStart = true) {
size_t targetLen = strlen(target);
size_t index = 0;
byte c;
uint16_t bufsize = 0, count = 0;
byte buf[FS_BUFSIZE];
if (fromStart) f.seek(0);

File diff suppressed because one or more lines are too long

View File

@ -42,7 +42,7 @@ const size_t numBrightnessSteps = sizeof(brightnessSteps) / sizeof(uint8_t);
void incBrightness()
{
// dumb incremental search is efficient enough for so few items
for (int index = 0; index < numBrightnessSteps; ++index)
for (uint8_t index = 0; index < numBrightnessSteps; ++index)
{
if (brightnessSteps[index] > bri)
{

View File

@ -136,7 +136,7 @@ void deserializeSegment(JsonObject elem, byte it)
if (sz == 0 && sz > 4) break;
int rgbw[] = {0,0,0,0};
byte cp = copyArray(icol, rgbw);
copyArray(icol, rgbw);
if (set < 2) stop = start + 1;
for (uint16_t i = start; i < stop; i++) {
@ -202,8 +202,8 @@ bool deserializeState(JsonObject root)
receiveNotifications = udpn[F("recv")] | receiveNotifications;
bool noNotification = udpn[F("nn")]; //send no notification just for this request
unsigned long timein = root[F("time")] | -1;
if (timein != -1) {
unsigned long timein = root[F("time")] | UINT32_MAX;
if (timein != UINT32_MAX) {
if (millis() - ntpLastSyncTime > 50000000L) setTime(timein);
if (presetsModifiedTime == 0) presetsModifiedTime = timein;
}

View File

@ -23,10 +23,9 @@ bool parseLx(int lxValue, byte rgbw[4])
ok = true;
float tmpBri = floor((lxValue - 200000000) / 10000); ;
uint16_t ct = (lxValue - 200000000) - (((uint8_t)tmpBri) * 10000);
float temp = 0;
tmpBri *= 2.55;
constrain(tmpBri, 0, 255);
tmpBri = constrain(tmpBri, 0, 255);
colorKtoRGB(ct, rgbw);
lxRed = rgbw[0]; lxGreen = rgbw[1]; lxBlue = rgbw[2];

View File

@ -37,10 +37,10 @@ AsyncMqttClient::AsyncMqttClient()
_client.onPoll([](void* obj, AsyncClient* c) { (static_cast<AsyncMqttClient*>(obj))->_onPoll(c); }, this);
#ifdef ESP32
sprintf(_generatedClientId, "esp32%06x", ESP.getEfuseMac());
sprintf(_generatedClientId, "esp32%06x", (uint32_t)ESP.getEfuseMac());
_xSemaphore = xSemaphoreCreateMutex();
#elif defined(ESP8266)
sprintf(_generatedClientId, "esp8266%06x", ESP.getChipId());
sprintf(_generatedClientId, "esp8266%06x", (uint32_t)ESP.getChipId());
#endif
_clientId = _generatedClientId;

View File

@ -93,7 +93,9 @@ struct BlynkHeader
}
BLYNK_ATTR_PACKED;
#if !defined(htons) && (defined(ARDUINO) || defined(ESP8266) || defined(PARTICLE) || defined(__MBED__))
#if defined(ESP32)
#include <lwip/ip_addr.h>
#elif !defined(htons) && (defined(ARDUINO) || defined(ESP8266) || defined(PARTICLE) || defined(__MBED__))
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
#define htons(x) ( ((x)<<8) | (((x)>>8)&0xFF) )
#define htonl(x) ( ((x)<<24 & 0xFF000000UL) | \

View File

@ -45,8 +45,7 @@ public:
}
BLYNK_LOG1(BLYNK_F("Connected to WiFi"));
IPAddress myip = WiFi.localIP();
BLYNK_LOG_IP("IP: ", myip);
BLYNK_LOG_IP("IP: ", WiFi.localIP());
}
void config(const char* auth,

View File

@ -77,10 +77,9 @@ void DMXESPSerial::write(int Channel, uint8_t value) {
}
void DMXESPSerial::end() {
delete dmxData;
chanSize = 0;
Serial1.end();
dmxStarted == false;
dmxStarted = false;
}
void DMXESPSerial::update() {

View File

@ -101,8 +101,8 @@ private:
case EspalexaDeviceType::whitespectrum: return PSTR("Color temperature light");
case EspalexaDeviceType::color: return PSTR("Color light");
case EspalexaDeviceType::extendedcolor: return PSTR("Extended color light");
default: return "";
}
return "";
}
const char* modelidString(EspalexaDeviceType t)
@ -113,8 +113,8 @@ private:
case EspalexaDeviceType::whitespectrum: return "LWT010";
case EspalexaDeviceType::color: return "LST001";
case EspalexaDeviceType::extendedcolor: return "LCT015";
default: return "";
}
return "";
}
void encodeLightId(uint8_t idx, char* out)

View File

@ -112,7 +112,6 @@ uint32_t EspalexaDevice::getRGB()
{
if (_rgb != 0) return _rgb; //color has not changed
byte rgb[4]{0, 0, 0, 0};
float r, g, b, w;
if (_mode == EspalexaColorMode::none) return 0;

View File

@ -144,7 +144,7 @@ public:
virtual void handleBody(AsyncWebServerRequest *request, uint8_t *data, size_t len, size_t index, size_t total) override final {
if (_onRequest) {
_contentLength = total;
if (total > 0 && request->_tempObject == NULL && total < _maxContentLength) {
if (total > 0 && request->_tempObject == NULL && (int)total < _maxContentLength) {
request->_tempObject = malloc(total);
}
if (request->_tempObject != NULL) {

View File

@ -32,6 +32,7 @@ bool UsermodManager::add(Usermod* um)
if (numMods >= WLED_MAX_USERMODS || um == nullptr) return false;
ums[numMods] = um;
numMods++;
return true;
}
byte UsermodManager::getModCount() {return numMods;}

View File

@ -136,8 +136,10 @@ void prepareHostname(char* hostname)
//handle Ethernet connection event
void WiFiEvent(WiFiEvent_t event)
{
#ifdef WLED_USE_ETHERNET
char hostname[25] = "wled-";
#endif
switch (event) {
#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_USE_ETHERNET)
case SYSTEM_EVENT_ETH_START:
@ -218,9 +220,11 @@ void WLED::loop()
//LED settings have been saved, re-init busses
if (busConfigs[0] != nullptr) {
busses.removeAll();
uint32_t mem = 0;
for (uint8_t i = 0; i < WLED_MAX_BUSSES; i++) {
if (busConfigs[i] == nullptr) break;
busses.add(*busConfigs[i]);
mem += busses.memUsage(*busConfigs[i]);
if (mem <= MAX_LED_MEMORY) busses.add(*busConfigs[i]);
delete busConfigs[i]; busConfigs[i] = nullptr;
}
strip.finalizeInit();
@ -303,7 +307,6 @@ void WLED::setup()
pinManager.allocatePin(1,true); // GPIO1 reserved for debug output
#endif
#endif
int heapPreAlloc = ESP.getFreeHeap();
DEBUG_PRINT("heap ");
DEBUG_PRINTLN(ESP.getFreeHeap());
registerUsermods();

View File

@ -8,7 +8,7 @@
*/
// version code in format yymmddb (b = daily build)
#define VERSION 2103012
#define VERSION 2103020
//uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG
@ -65,7 +65,9 @@
#include <ESPmDNS.h>
#include <AsyncTCP.h>
//#include "SPIFFS.h"
#define CONFIG_LITTLEFS_FOR_IDF_3_2
#ifndef CONFIG_LITTLEFS_FOR_IDF_3_2
#define CONFIG_LITTLEFS_FOR_IDF_3_2
#endif
#include <LITTLEFS.h>
#endif
@ -307,7 +309,7 @@ WLED_GLOBAL bool huePollingEnabled _INIT(false); // poll hue bridge fo
WLED_GLOBAL uint16_t huePollIntervalMs _INIT(2500); // low values (< 1sec) may cause lag but offer quicker response
WLED_GLOBAL char hueApiKey[47] _INIT("api"); // key token will be obtained from bridge
WLED_GLOBAL byte huePollLightId _INIT(1); // ID of hue lamp to sync to. Find the ID in the hue app ("about" section)
WLED_GLOBAL IPAddress hueIP _INIT((0, 0, 0, 0)); // IP address of the bridge
WLED_GLOBAL IPAddress hueIP _INIT_N(((0, 0, 0, 0))); // IP address of the bridge
WLED_GLOBAL bool hueApplyOnOff _INIT(true);
WLED_GLOBAL bool hueApplyBri _INIT(true);
WLED_GLOBAL bool hueApplyColor _INIT(true);
@ -470,14 +472,14 @@ WLED_GLOBAL int16_t currentPlaylist _INIT(0);
// realtime
WLED_GLOBAL byte realtimeMode _INIT(REALTIME_MODE_INACTIVE);
WLED_GLOBAL byte realtimeOverride _INIT(REALTIME_OVERRIDE_NONE);
WLED_GLOBAL IPAddress realtimeIP _INIT((0, 0, 0, 0));
WLED_GLOBAL IPAddress realtimeIP _INIT_N(((0, 0, 0, 0)));;
WLED_GLOBAL unsigned long realtimeTimeout _INIT(0);
WLED_GLOBAL uint8_t tpmPacketCount _INIT(0);
WLED_GLOBAL uint16_t tpmPayloadFrameSize _INIT(0);
// mqtt
WLED_GLOBAL unsigned long lastMqttReconnectAttempt _INIT(0);
WLED_GLOBAL long lastInterfaceUpdate _INIT(0);
WLED_GLOBAL unsigned long lastInterfaceUpdate _INIT(0);
WLED_GLOBAL byte interfaceUpdateCallMode _INIT(NOTIFIER_CALL_MODE_INIT);
WLED_GLOBAL char mqttStatusTopic[40] _INIT(""); // this must be global because of async handlers

View File

@ -245,7 +245,7 @@ bool handleIfNoneMatchCacheHeader(AsyncWebServerRequest* request)
return false;
}
bool setStaticContentCacheHeaders(AsyncWebServerResponse *response)
void setStaticContentCacheHeaders(AsyncWebServerResponse *response)
{
response->addHeader(F("Cache-Control"),"max-age=2592000");
response->addHeader(F("ETag"), String(VERSION));

View File

@ -294,15 +294,13 @@ void getSettingsJS(byte subPage, char* dest)
#endif
// set limit for LED count
oappend(SET_F("d.LCmax="));
oappend(SET_F("LCmax="));
oappendi(MAX_LEDS);
oappend(";");
#ifdef ESP8266
// set limit for DMA LED count
oappend(SET_F("d.LDmax="));
oappendi(MAX_LEDS_DMA);
// set limit for LED memory
oappend(SET_F("bmax="));
oappendi(MAX_LED_MEMORY);
oappend(";");
#endif
sappend('v',SET_F("LC"),ledCount);
@ -333,7 +331,7 @@ void getSettingsJS(byte subPage, char* dest)
sappend('v',SET_F("LA"),strip.milliampsPerLed);
if (strip.currentMilliamps)
{
sappends('m',SET_F("(\"pow\")[0]"),"");
sappends('m',SET_F("(\"pow\")[0]"),(char*)"");
olen -= 2; //delete ";
oappendi(strip.currentMilliamps);
oappend(SET_F("mA\";"));