Problem with custom mapping

In another post @tonyno helped me to found the custom mapping option which is what i need for my project.

So i made the changes and i recompile the project and load it in esp32

the custom mapping is like the following :

//enable custom per-LED mapping. This can allow for better effects on matrices or special displays
#define WLED_CUSTOM_LED_MAPPING

#ifdef WLED_CUSTOM_LED_MAPPING
//for my project i need the following mapping is what i need

const uint16_t customMappingTable = {0, 1, 2, 3, 4, 5, 6, 7, 9, 11, 12, 14, 15, 16, 17, 21, 22, 24, 28, 32, 33, 34, 35,
36, 38, 42, 48, 52, 54, 56, 59, 61, 62, 63, 64, 65, 67, 70, 71, 73, 74, 75, 78, 79, 80, 87, 90, 95, 97, 98, 99, 100, 106,
108, 116, 118, 121, 123, 125, 126, 129, 131, 133, 134, 136, 139, 140, 142, 148, 152, 153, 158, 164, 165, 166, 167, 170,
172, 174, 176, 182, 183, 187, 190, 196, 199, 204, 206, 207, 208, 209, 213, 214, 215, 216, 217, 218, 220, 224, 226, 227,
230, 231, 232, 8, 10, 13, 18, 19, 20, 23, 25, 26, 27, 29, 30, 31, 37, 39, 40, 41, 43, 44, 45, 46, 47, 49, 50, 51, 53, 55,
57, 58, 60, 66, 68, 69, 72, 76, 77, 81, 82, 83, 84, 85, 86, 88, 89, 91, 92, 93, 94, 96, 101, 102, 103, 104, 105, 107, 109,
110, 111, 112, 113, 114, 115, 117, 119, 120, 122, 124, 127, 128, 130, 132, 135, 137, 138, 141, 143, 144, 145, 146, 147, 149,
150, 151, 154, 155, 156, 157, 159, 160, 161, 162, 163, 168, 169, 171, 173, 175, 177, 178, 179, 180, 181, 184, 185, 186, 188, 189,
191, 192, 193, 194, 195, 197, 198, 200, 201, 202, 203, 205, 210, 211, 212, 219, 221, 222, 223, 225, 228, 229};
`
But when i test the project in a spare led strip before use it in my project, something is not working as it should…probably something i am missing here.

My project is a tree, the custom mapping start with led’s which are on the wooden parts of the tree and after continues with the led’s which are on the leaves of the tree.

So now i must create 2 segments , 1 will be from led 0 to led 232 (for custom mapping) and the second will be from led 8 to led 229 (for custom mapping) wood and leaves.

But when i create the first segment 0 - 232 lights up all the 232 Led’s in strip, except the 3rd before the end.
when i create the second segment 8 - 229 lights up from led 8 to 229 except led’s 226,225,222,220 which is totally wrong…

i can’t understand why is this happen , can someone have any idea?

Thank you

code screenshot : Screenshot by Lightshot

Segments cannot overlap.

1 Like

So what can i do , to have these 2 groups separated?

My guess is to pretend those are in normal order and create two segments, one for each part like 0-x for the wood and x-232 for the leaves, if that makes sense.

1 Like

This is what i did, not work because as you said “Segments cannot overlap” , what is the point if you cannot overlap segments to create custom mapping? Did you see the code? Do i need to edit anything else?

Thanks

I’d guess that if you do 0-x and x-232 they should not overlap.

1 Like

That’s what i thought , but in fact does not work.

when i create the first segment 0 - 232 lights up all the 232 Led’s in strip, except the 3rd before the end.
when i create the second segment 8 - 229 lights up from led 8 to 229 except led’s 226,225,222,220

0-232 in my custom mapping is not 232 led , it is 104 led. and
8-229 are the rest 128 led for total : 232 that i use,

**The problem is simple : **

at custom mapping you set : 0,5,14,27,45,128,32,8,200,2 …

**After if you set in segment from 14 to 128 you expect to light up 4 led’s (14,27,45,128) **
instead that it will light up 114 led’s (the hole range, ignoring the custom mapping)

No, what I meant was 0-104 (wood?) and 104-232 (leaves).

1 Like

Sorry i do not understand what you mean.

Let talk with the example which exist in FX_fcp. (Which i just tested to see what will happen)

const uint16_t customMappingTable[] = {
  0, 1, 2, 3, 4, 9, 8, 7, 6, 5, 10, 11, 12, 13, 14,
  19, 18, 17, 16, 15, 20, 21, 22, 23, 24, 29, 28, 27, 26, 25};

With this custom mapping loaded.

I create a segment from 15 to 21 and i was expected 3 led’s to light up ( led’s 15,20 and 21)

but instead lights up led’s 15,16,17,18,19, and 20

code : http://prntscr.com/vwlrpr
segment : http://prntscr.com/vwls1x
result : http://prntscr.com/vwlvel

My expectation is, if you use that custom mapping…

const uint16_t customMappingTable[] = {
  0, 1, 2, 3, 4, 9, 8, 7, 6, 5, 10, 11, 12, 13, 14,
  19, 18, 17, 16, 15, 20, 21, 22, 23, 24, 29, 28, 27, 26, 25};

Then a segment defined as 0-9 would translate to LEDs 0, 1, 2, 3, 4, 9, 8, 7, 6, 5.

Make sense now?

1 Like

YES works great now! A tiny misunderstanding that cost me a day. But at least i learn a lot from this.

Something last , until your last post i check the JSON API , it was the easiest way to setup individual colors for each led.

Using the i property of the segment object, you can set the LED colors in the segment using the JSON API

{"seg":{"i":[[255,0,0], [0,255,0], [0,0,255]]}}

and worked great

But i could not manage to enable any effect to segment when i property used, is this something that supported from JSON API or not?

thanks again for your help.

1 Like

Not sure if you need more, but have you tried an "fx":n in there where n is the effect number?

1 Like

Indeed i do not need it , remapping worked great.

Just curious, {“bri”:120} works for brightness , {“fx”:2} does not. (or any other effect number.)