report out-of-memory situations to the user
This commit is contained in:
@@ -80,7 +80,10 @@ void WS2812FX::setUpMatrix() {
|
||||
if ((size > 0) && (customMappingTable == nullptr)) { // second try
|
||||
DEBUG_PRINTLN("setUpMatrix: trying to get fresh memory block.");
|
||||
customMappingTable = (uint16_t*) calloc(size, sizeof(uint16_t));
|
||||
if (customMappingTable == nullptr) USER_PRINTLN("setUpMatrix: alloc failed");
|
||||
if (customMappingTable == nullptr) {
|
||||
USER_PRINTLN("setUpMatrix: alloc failed");
|
||||
errorFlag = ERR_LOW_MEM; // WLEDMM raise errorflag
|
||||
}
|
||||
}
|
||||
if (customMappingTable != nullptr) customMappingTableSize = size;
|
||||
}
|
||||
@@ -159,6 +162,7 @@ void WS2812FX::setUpMatrix() {
|
||||
} else { // memory allocation error
|
||||
customMappingTableSize = 0;
|
||||
USER_PRINTLN(F("Ledmap alloc error."));
|
||||
errorFlag = ERR_LOW_MEM; // WLEDMM raise errorflag
|
||||
isMatrix = false; //WLEDMM does not like this done in teh background while end users are confused whats happened...
|
||||
panels = 0;
|
||||
panel.clear();
|
||||
|
||||
Reference in New Issue
Block a user