diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index f850ad43..afa06c9b 100644 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -2660,6 +2660,7 @@ bool WS2812FX::deserializeMap(uint8_t n) { //DEBUG_PRINTF(" (\"width\": %s) ", fileName) memset(fileName, 0, sizeof(fileName)); // clear old buffer + f.seek(0); // rewind to start f.find("\"height\":"); f.readBytesUntil('\n', fileName, sizeof(fileName)-1); uint16_t maxHeight = atoi(cleanUpName(fileName)); @@ -2677,7 +2678,7 @@ bool WS2812FX::deserializeMap(uint8_t n) { #endif } - USER_PRINTF("deserializeMap %d x %d\n", Segment::maxWidth, Segment::maxHeight); + DEBUG_PRINTF("deserializeMap %d x %d\n", Segment::maxWidth, Segment::maxHeight); //WLEDMM recreate customMappingTable if more space needed if (Segment::maxWidth * Segment::maxHeight > customMappingTableSize) { @@ -2707,21 +2708,27 @@ bool WS2812FX::deserializeMap(uint8_t n) { // WLEDMM reset mapping table before loading //memset(customMappingTable, 0xFF, customMappingTableSize * sizeof(uint16_t)); // FFFF = no pixel for (unsigned i=0; i0?',':' ', mapi, i); if (i < customMappingSize) customMappingTable[i++] = (uint16_t) (mapi<0 ? 0xFFFFU : mapi); // WLEDMM do not write past array bounds - } while (f.available() && (i < customMappingSize)); + endOfArray = entry.indexOf("]") >= 0; // if we hit "]", stop reading + } while (f.available() && (i < customMappingSize) && !endOfArray); + //DEBUG_PRINTLN(""); loadedLedmap = n; f.close(); - USER_PRINTF("Custom ledmap: %d size=%d\n", loadedLedmap, customMappingSize); + if ((customMappingTable != nullptr) && (customMappingSize>0)) { + USER_PRINTF(PSTR("Ledmap #%d read. Size=%d (%d x %d); %d items found.\n"), loadedLedmap, customMappingSize, Segment::maxWidth, Segment::maxHeight, i); + } #ifdef WLED_DEBUG_MAPS for (uint16_t j=0; j