small improvements
* optimized fadeToBlackBy() - don't repaint unchanged pixels * made MIN_HEAP_SIZE configurable by build_flags * specific error message when not enough memory for LEDs buffer
This commit is contained in:
@@ -132,7 +132,7 @@ void Segment::allocLeds() {
|
|||||||
ledsrgbSize = ledsrgb?size:0;
|
ledsrgbSize = ledsrgb?size:0;
|
||||||
if (ledsrgb == nullptr) {
|
if (ledsrgb == nullptr) {
|
||||||
USER_PRINTLN("allocLeds failed!!");
|
USER_PRINTLN("allocLeds failed!!");
|
||||||
errorFlag = ERR_LOW_MEM; // WLEDMM raise errorflag
|
errorFlag = ERR_LOW_BUF; // WLEDMM raise errorflag
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -1442,8 +1442,10 @@ void Segment::fadeToBlackBy(uint8_t fadeBy) {
|
|||||||
|
|
||||||
// WLEDMM minor optimization
|
// WLEDMM minor optimization
|
||||||
if(is2D()) {
|
if(is2D()) {
|
||||||
for (uint_fast16_t y = 0; y < rows; y++) for (uint_fast16_t x = 0; x < cols; x++) {
|
for (int y = 0; y < rows; y++) for (int x = 0; x < cols; x++) {
|
||||||
setPixelColorXY((uint16_t)x, (uint16_t)y, CRGB(getPixelColorXY(x,y)).nscale8(scaledown));
|
uint32_t cc = getPixelColorXY(x,y); // WLEDMM avoid RGBW32 -> CRGB -> RGBW32 conversion
|
||||||
|
uint32_t cc2 = color_fade(cc, scaledown); // fade
|
||||||
|
if (cc2 != cc) setPixelColorXY((uint16_t)x, (uint16_t)y, cc2); // WLEDMM only re-paint if faded color is different
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (uint_fast16_t x = 0; x < cols; x++) {
|
for (uint_fast16_t x = 0; x < cols; x++) {
|
||||||
|
|||||||
@@ -352,6 +352,7 @@
|
|||||||
#define ERR_LOW_SEG_MEM 34 // WLEDMM: low memory (segment data RAM)
|
#define ERR_LOW_SEG_MEM 34 // WLEDMM: low memory (segment data RAM)
|
||||||
#define ERR_LOW_WS_MEM 35 // WLEDMM: low memory (ws)
|
#define ERR_LOW_WS_MEM 35 // WLEDMM: low memory (ws)
|
||||||
#define ERR_LOW_AJAX_MEM 36 // WLEDMM: low memory (oappend)
|
#define ERR_LOW_AJAX_MEM 36 // WLEDMM: low memory (oappend)
|
||||||
|
#define ERR_LOW_BUF 37 // WLEDMM: low memory (LED buffer from allocLEDs)
|
||||||
|
|
||||||
// Timer mode types
|
// Timer mode types
|
||||||
#define NL_MODE_SET 0 //After nightlight time elapsed, set to target brightness
|
#define NL_MODE_SET 0 //After nightlight time elapsed, set to target brightness
|
||||||
@@ -480,7 +481,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//#define MIN_HEAP_SIZE (8k for AsyncWebServer)
|
//#define MIN_HEAP_SIZE (8k for AsyncWebServer)
|
||||||
|
#if !defined(MIN_HEAP_SIZE)
|
||||||
#define MIN_HEAP_SIZE 8192
|
#define MIN_HEAP_SIZE 8192
|
||||||
|
#endif
|
||||||
|
|
||||||
// Maximum size of node map (list of other WLED instances)
|
// Maximum size of node map (list of other WLED instances)
|
||||||
#ifdef ESP8266
|
#ifdef ESP8266
|
||||||
|
|||||||
@@ -2008,6 +2008,9 @@ function readState(s,command=false)
|
|||||||
case 36:
|
case 36:
|
||||||
errstr = "Low Memory (oappend buffer).";
|
errstr = "Low Memory (oappend buffer).";
|
||||||
break;
|
break;
|
||||||
|
case 37:
|
||||||
|
errstr = "no memory for LEDs buffer.";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
showToast('Error ' + s.error + ": " + errstr, true);
|
showToast('Error ' + s.error + ": " + errstr, true);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user