I want mapping to work so bad

But I just can’t figure it out with a 1d strip. Maybe it’s not even possible. I understand I could use segments but I just can’t fine tune it like I want to. I’m attaching this picture for an example (the pixels are not exact but just to prove the point). Let’s say I want all of the pixels OFF except for pixels 1, 45, 76, 92, 150 and 325. I try to create a map and my peek shows those pixels off but it does not reflect in the strip. Is this a lost cause since it is not a matrix?

Led maps do not require a matrix of any kind.

I would suggest you start small and try and remap the order of the first 30 pixels (or so).
Try to get the middle (or end, or 1st 1/3, etc) to be addressed as pixels 1,2,3 (etc).

Once you prove that, you can try something more esoteric like 2,7,12, and 23 as the 1st 4 pixels.

Checkout the KB for examples.

Ledmap creates a “virtual” strip used in segments. Those virtual pixels are “mapped” into physical pixels via values stored in ledmap. Ledmap acts as a LUT.

I.e: Let’s say your strip is 10 pixels and your ledmap is {"map":[5,4,3,2,1,0]} (note the ledmap does not contain all pixels; this is perfectly normal and allowed). What happens when you “paint” a pixel is a bit of LUT work.
With your 10 pixels, actual in-memory ledmap is constructed as [5,4,3,2,1,0,6,7,8,9]. So when you want to turn on “virtual” pixel 3 (they are zero based) you do a LUT lookup and see that “virtual” pixel 3 corresponds to “physical” pixel 2, “virtual” pixel 0 corresponds to “physical” pixel 5, etc.
As far as WLED goes (effects and UI) it operates on “virtual” pixels so if you create 2 segments, i.e. 5 pixels each, first starting from 0 to 5 and second starting from 5 to 10 (note that last value in segment is excluded) and then you set segment 0 to red and segment 1 to blue, “physical” pixels with indexes 5,4,3,2,1 will light up in red but “physical” pixels 0,6,7,8,9 will light up in blue.
If you select an animation from effects you will notice that in segment 0 it will run “in the opposite direction” and for segment 1 it will skip pixels (it will have a gap from pixel 1 to pixel 5).

hi @flyover_deplorable its quite easy
1st make a CSV or a python to a TEXT file where all Numbers are in !
then copy the Sections you want to be in NEW order
so no numer is lost

THEN save the File to the ESP
RESTART the ESP its only requirerd once
MAKE A preset from the NON LEDMAP first
Then start with the LEDMAP on the next preset

THEN you got the lights in the NUMBERS YOU Want

so from there the SEGMENTS are in your Number order MEANS LED 0-10 is the Order you made

Ok. I’m reading this a few times to try and make sense of it. Bear with me. I feel I’m pretty good at everything WLED but this is new. Let’s start with a strip of 23 leds. I want 1, 8, 17, and 23 to be lit up with the others off. Can you show me what that would look like in a spreadsheet? Does this site not work for doing this? WLED-Ledmap.json-Generator

I saw a note about maximum size elsewhere, which distinguised between internal mapping and external mapping, and seemed to imply that (1) there is limited room for “external” mapping and (2) external mapping is set up via JSON (via ledmapN.json files??). Is that correct?

Is there any way to determine which ledmap is currently being used? Ideal would be to report it via the JSON api.

I’m finding the mapping + segmens to be a very powerful tool in applying effects to a display.

I am not sure if this is the right way to do this or not, but it seems like it may be more help in understanding it than has been posted thus far and it should work for what you want to have happen.

If you create a map file with the LEDs you want to light up:

{“map”:[1,45,76,92,150,325]}

Save that to the controller

Now with your controller ON (power button top left in GUI)

Set the Effect to Solid

Set the color to Black

Set the Ledmap to the one you uploaded to the controller.

Change segment0 to the # of LEDs you want lit (the # of them in the ledmap). So from your example picture that would be 6.

Click the check mark.

Now set your color(s). Save to a preset, selecting the uploaded ledmap when saving.

maptest

@blazoncek This was the only reliably way I was able to get the correct LEDs to show. Doing it any other way would have the first 5 LEDs messed up with 4 after the first 1 always matching the prior settings of the full string. It seems like when clicking the check mark to update the segment it is not clearing some old values when set to the ledmap or something. If I am on an ledmap and I switch back to default and edit the segment size and hit the check to update, it does clear and functions as a whole. Unless how I am doing this is 100% wrong…

Crap!

Actually it’s still not working.

If I use this map: {“map”:[0,5,10,15,20]} and create a preset like I described above, it will display correctly. There will be 1 ON then 4 OFF and 1 ON then 4 OFF and 1 ON… on my strip. But if I look at the Peek it is showing the screwed up display that I will get to farther down…

Now if I go to another of my presets, full strip (159 pixels) solid blue, default ledmap, I will get all pixels as blue as well as full blue peek

If I now click on the preset I created with the ledmap from above it will display the correct red LEDs BUT will have 4 blue (from the previous all blue preset) between pixels 1 and 5. :face_with_raised_eyebrow:

The only time this does not happen is when I set a full string seg0, default map to black and then go and switch to the custom ledmap and again enter the total of 5 leds (from the map). If I change back to a default map preset after, it is again messed up when calling the custom mapped preset.

Any ideas?

I don’t ever use LED Maps, but the OP had me wanting to figure this out and to some degree I did as long as I don’t call any other presets that use the default map :grin:

v15-b5

Sorry to open a can of worms but it can be frustrating! Thanks for all the help. I appreciate it!

1 Like

@Jinx let’s continue with my example. We have 10 LEDs (physical indexes 0 to 9). We map only first 6 LEDs (indexes 0 to 5) into reverse order.

We have options to create mapfile with every LED mapped, i.e. [5,4,3,2,1,0,6,7,8,9] or we can skip trailing LEDs that remain at their respective indexes (6,7,8,9) and have ledmap with only [5,4,3,2,1,0]. In the second case WLED will automatically append indexes 6,7,8,9 to the ledmap (as there are 10 LEDs in total).

Now let’s assume we do not want 1st LED (physical index 0) to light up. Ever.
We have several options:

  • the most obvious, skip 1st LED in settings
  • create segment that starts at 1 instead of 0 (for your desired effect; will need to be in every preset) and create a segment starting at 0 and only having 1 pixel, color set to black and effect to Solid
  • create a mapfile that remaps index 0 into last possible index (for example above [1,2,3,4,5,6,7,8,9,0] and then create segment that ends with 9 instead of 10

If we want to exclude certain LEDs from lighting up it is easiest to do that with segments. The problem may be grouping those LEDs together to reduce the number of segments or have one continuous segment not including those LEDs.

In such case we need to create a mapfile/ledmap that contains indexes of all LEDs on the strip. In this ledmap we start entering LED indexes in increasing order (assuming we do not want to reorder LEDs). When we are at LED index that we want to exclude, we skip it and continue with next. Once we reach to the end of indexes, we need to continue entering skipped indexes until the length of the array is the same as total LED count. Once this is completed we need to create (at least) 2 segments; first segment will start at 0 and end at the number calculated from the total LED count minus skipped LED count. First segment is then used as the display segment and second segment is set to Solid with black color.

For example: We want to exclude LEDs with indexes 5, 15 and 17 from a strip that is 25 LEDs long. Our ledmap will be [0,1,2,3,4,6,7,8,9,10,11,12,13,14,16,18,19,20,21,22,23,24,5,15,17] and we will create 2 segments, 1st starting with 0 and ending with 22 and 2nd starting at 22 and ending at 25. 2nd segment will contain LEDs that we want excluded from main display.

Thanks for the info. It is wicked confusing but I get the idea now. I actually first thought about doing a similar thing with 2 segments, but did not think it was necessary as I was able to display what I wanted with just the 1 segment. Be it for only while active, till switching to something else…

What I don’t understand is how come I can edit my seg0 segment to be the total # of LEDs in my map and it then get displayed correctly on the physical LEDs, yet shows incorrectly in the peek. So clearly it works in the physical space. How does it then get misconstrued when it is then saved to a preset and recalled after some other regular non mapfile preset is played. If the data is all in each preset why would they act differently from the initial view to when loading it after saved?

If I have my whole string set to ON and Red seg0 0 to 20 and then I edit that segment and change it to 0 to 10. Click Update Check. The pixels no longer in the segment turn OFF and are no longer controlled. Good!

Set it back to the full string of 20 Check. They all light…

Why would the same not happen when using a map of 5 pixels and changing the seg0 to 0 to 5?
It turns on the first 4 pixels from the map ON in w/e color I pick BUT also lights 4 after the first 1 and also the 5th pixel from the map, but with the prior color from the 0 to 20 default? Where do those odd 4 in a row + 1 at the end come from lol? I mean they don’t = 20 nor do they = 5 unless you count the # lit from the default map that show up… This might sound wicked confusing at this point but it’s wicked late here 5am lol. I can try to describe this better tomorrow maybe. :grin: :nerd_face:

Initially (back in 0.10 and in 0.11) there only was one ledmap constructed at compile time. It was always active if it existed in the source files.

With the later releases I added the possibility to store ledmap into a JSON file so you would not need to compile each time LED order changed. If the file existed it was loaded and was always active. If it didn’t LEDs would be ordered in sequential, increasing order (unmodified).

Then came the dynamic loading of mapfiles/ledmaps. So, to avoid a breaking change the original ledmap.json (AKA ledmap 0) is considered default which means it is loaded when WLED starts (if the file exists). Other dynamic ledmaps can be stored in files named ledmap1.json, ledmap2.json, …, ledmap9.json.

If you want to switch ledmaps you can do so either when saving a preset or just using UI when operating WLED manually. As mentioned ledmap.json is special (and default). If it does not exists no LEDs will be remapped (order will be reverted if another ledmap was previously selected) and it is always possible to select “Default” ledmap from UI (regardless of file existence).

So if you want to have unmodified LED order for some displays, do not create ledmap.json. Instead create ledmap1.json (or more than one) and use those in presets that need special (reordered) ledmap. For those presets that do need unmodified LED order, select “Default” ledmap. If some of your displays don’t care about actual ledmap used, select “Unchanged” when saving preset.

LOL ok.

I had a different wicked long thing typed here explaining everything, but went back and reread what you said and I understand what needs to be done now. :face_with_hand_over_mouth:

Basically if you want certain LEDs lit and others unlit, you list the ones you want lit, followed by the ones you don’t want lit and set your segment size = to the # you want lit.

I think I was confused by you talking about what LEDs you want to exclude vs my mindset of what ones I want to include. Duhh me.


This had me thinking that all I needed was the LEDs I wanted mapped and the rest would be auto appended. I guess this is not the case unless they are in order without any skips.

How come it will auto append sequential, but not append sequential, skipping already used values?
If it were able to do that it would save people from having to add all the unused ones after their used ones? It makes things more confusing to have 2 different population methods dependent on how you have chosen your mapped LEDs.

Anyways Thank You for all the work you have done on the WLED project and for putting up with my questions.

:beer: :dollar: :parachute:

Indeed your thinking was incorrect. If I put it another way, this is it: At boot, WLED 1st creates ledmap array with sequential (increasing) numbers from 0 to the total LED count. Then it looks for the ledmap.json and replaces values in the array with values found in JSON file. If there are only 3 values in JSON file, only first three entries are replaced.

Technical implementation differs (for speed and size) but the net effect is as described.

And thank you for the beer!

1 Like