Ledmaps without width and height specified

This commit is contained in:
Ewoud
2023-06-13 17:58:00 +02:00
parent 794e3a8671
commit 07fdeb3ab7
2 changed files with 8 additions and 10 deletions

View File

@@ -2204,7 +2204,7 @@ bool WS2812FX::deserializeMap(uint8_t n) {
USER_PRINT(F("Reading LED map from ")); //WLEDMM use USER_PRINT USER_PRINT(F("Reading LED map from ")); //WLEDMM use USER_PRINT
USER_PRINTLN(fileName); USER_PRINTLN(fileName);
//WLEDMM: read width and height (mandatory in file!!) //WLEDMM: read width and height
f.find("\"width\":"); f.find("\"width\":");
f.readBytesUntil('\n', fileName, sizeof(fileName)); //hack: use fileName as we have this allocated already f.readBytesUntil('\n', fileName, sizeof(fileName)); //hack: use fileName as we have this allocated already
uint16_t maxWidth = atoi(fileName); uint16_t maxWidth = atoi(fileName);
@@ -2214,15 +2214,13 @@ bool WS2812FX::deserializeMap(uint8_t n) {
uint16_t maxHeight = atoi(fileName); uint16_t maxHeight = atoi(fileName);
USER_PRINTF("deserializeMap %d x %d\n", maxWidth, maxHeight); USER_PRINTF("deserializeMap %d x %d\n", maxWidth, maxHeight);
if (maxWidth * maxHeight <= 0) {
releaseJSONBufferLock();
return false;
}
//WLEDMM: support ledmap file properties width and height //WLEDMM: support ledmap file properties width and height: if found change segment
Segment::maxWidth = maxWidth; if (maxWidth * maxHeight > 0) {
Segment::maxHeight = maxHeight; Segment::maxWidth = maxWidth;
resetSegments(true); //WLEDMM not makeAutoSegments() as we only want to change bounds Segment::maxHeight = maxHeight;
resetSegments(true); //WLEDMM not makeAutoSegments() as we only want to change bounds
}
//WLEDMM recreate customMappingTable if more space needed //WLEDMM recreate customMappingTable if more space needed
if (Segment::maxWidth * Segment::maxHeight > customMappingTableSize) { if (Segment::maxWidth * Segment::maxHeight > customMappingTableSize) {

View File

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