enumerateLedmaps and deserializeMap bugfix
Also xOffset and yOffset 8 instead of 16 bit
This commit is contained in:
@@ -842,8 +842,8 @@ class WS2812FX { // 96 bytes
|
|||||||
} panelO; //WLEDMM panelOrientation
|
} panelO; //WLEDMM panelOrientation
|
||||||
|
|
||||||
typedef struct panel_t {
|
typedef struct panel_t {
|
||||||
uint16_t xOffset; // x offset relative to the top left of matrix in LEDs
|
uint8_t xOffset; // x offset relative to the top left of matrix in LEDs. WLEDMM 8 bits/256 is enough
|
||||||
uint16_t yOffset; // y offset relative to the top left of matrix in LEDs
|
uint8_t yOffset; // y offset relative to the top left of matrix in LEDs. WLEDMM 8 bits/256 is enough
|
||||||
uint8_t width; // width of the panel
|
uint8_t width; // width of the panel
|
||||||
uint8_t height; // height of the panel
|
uint8_t height; // height of the panel
|
||||||
union {
|
union {
|
||||||
|
|||||||
@@ -1298,12 +1298,12 @@ void WS2812FX::enumerateLedmaps() {
|
|||||||
bool isFile = WLED_FS.exists(fileName);
|
bool isFile = WLED_FS.exists(fileName);
|
||||||
if (isFile) ledMaps |= 1 << i;
|
if (isFile) ledMaps |= 1 << i;
|
||||||
}
|
}
|
||||||
|
//WLEDMM add segment names to be used as ledmap names
|
||||||
uint8_t segment_index = 0;
|
uint8_t segment_index = 0;
|
||||||
for (segment &seg : _segments) {
|
for (segment &seg : _segments) {
|
||||||
if (strcmp(seg.name, "") != 0) {
|
if (seg.name != nullptr && strcmp(seg.name, "") != 0) {
|
||||||
char fileName[32];
|
char fileName[32];
|
||||||
sprintf_P(fileName, PSTR("/lm%s.json"), seg.name);
|
sprintf_P(fileName, PSTR("/lm%s.json"), seg.name);
|
||||||
Serial.printf("Filename %s\n", fileName);
|
|
||||||
bool isFile = WLED_FS.exists(fileName);
|
bool isFile = WLED_FS.exists(fileName);
|
||||||
if (isFile) ledMaps |= 1 << (10+segment_index);
|
if (isFile) ledMaps |= 1 << (10+segment_index);
|
||||||
}
|
}
|
||||||
@@ -1945,14 +1945,12 @@ void WS2812FX::deserializeMap(uint8_t n) {
|
|||||||
if (n) sprintf(fileName +7, "%d", n);
|
if (n) sprintf(fileName +7, "%d", n);
|
||||||
strcat(fileName, ".json");
|
strcat(fileName, ".json");
|
||||||
isFile = WLED_FS.exists(fileName);
|
isFile = WLED_FS.exists(fileName);
|
||||||
} else {
|
} else { //WLEDM add segment name as ledmap.name
|
||||||
Serial.printf("deserializeMap Filename search %d\n", n);
|
|
||||||
uint8_t segment_index = 0;
|
uint8_t segment_index = 0;
|
||||||
for (segment &seg : _segments) {
|
for (segment &seg : _segments) {
|
||||||
if (n == 10 + segment_index && !isFile) {
|
if (n == 10 + segment_index && !isFile && seg.name != nullptr) {
|
||||||
sprintf_P(fileName, PSTR("/lm%s.json"), seg.name);
|
sprintf_P(fileName, PSTR("/lm%s.json"), seg.name);
|
||||||
isFile = WLED_FS.exists(fileName);
|
isFile = WLED_FS.exists(fileName);
|
||||||
Serial.printf("deserializeMap Filename %s %d\n", fileName, isFile);
|
|
||||||
}
|
}
|
||||||
if (isFile) break;
|
if (isFile) break;
|
||||||
segment_index++;
|
segment_index++;
|
||||||
|
|||||||
Reference in New Issue
Block a user