json mapping: refactor

- virtualLength back to const
- rename getjMap() to createjMap()
- rename initjMapDoc to updatejMapDoc
- rename jMapC to jMap
- updatejMapDoc: delete if no name, reset name if no file found
- case M12_jMap: do not use getjMap
- deserializeSegment: create or delete jMap
This commit is contained in:
Ewowi
2022-09-08 11:37:23 +02:00
parent 5b4c3dce1f
commit a1fa1ff105
3 changed files with 35 additions and 31 deletions

View File

@@ -82,6 +82,12 @@ void deserializeSegment(JsonObject elem, byte it, byte presetId)
uint8_t soundSim = elem["ssim"] | seg.soundSim;
uint8_t map1D2D = elem["mp12"] | seg.map1D2D;
//WLEDSR jMap
if (map1D2D == M12_jMap && !seg.jMap)
seg.createjMap();
if (map1D2D != M12_jMap && seg.jMap)
seg.deletejMap();
if ((spc>0 && spc!=seg.spacing) || seg.map1D2D!=map1D2D) seg.fill(BLACK); // clear spacing gaps
seg.map1D2D = constrain(map1D2D, 0, 7);