Intrinsically-Sublime / FastLED-XY-Map-Generator

WLED and FastLED XY map generator for irregular/gapped LED arrays.
https://intrinsically-sublime.github.io/FastLED-XY-Map-Generator/
3 stars 1 forks source link

Spiral and other maps #3

Closed dosipod closed 6 months ago

dosipod commented 6 months ago

We have used few versions of that tool here https://dosipod.github.io/WLED-Ledmap-Generator/ ( which i borrowed from @lost-hope ) but yours is the most featured so good work , being the lazy that I am i have done most of the mapping for cubes in excel so did not bother to fix the tool so that others could use it for spiral mapping , an example for spiral map for 16x16 matrix is listed below ( could not add large videos which most is in wled discord ) small_auto_spiral_maps correct_ledmap2.json

To do that in your tool ( say call it free style ) i just need the ledmap to follow the clicks but could not do that as in the below example

auto_sprail

in this example the map should be 0,1,2,3,4,5,6,7,15,23,31,39,47,55,63 ..etc , so basically the map should just follow the clicks regardless of anything else as this would allow for unlimited ideas which we only tested few of them . If that is not possible then might be just setup a different version all together . I hope that is clear and you get the idea , demo of a cube using the same spiral mapping is here https://github.com/dosipod/Demos/blob/main/cubes-rings/6mm_1k_cube_1d.gif

Intrinsically-Sublime commented 6 months ago

I totally understand what you mean by spiral mapping. The question I have is does spiral mapping come up often? Are those off the shelf panels or did you design them?

I do see the need for (freestyle) layouts with the things I make.

If how to do that becomes clear to me I will add it.

Maybe add another element to pixelarray[ledpos][3] to store the order in which they are clicked and then a new output to use the order to dump the ledpos. This would not allow any undo function since it would simply be a counter. But it would work.

dosipod commented 6 months ago

Spiral mapping and other free style does come up from time to time but that is the point to have a tool to make that easier as you would be surprised how hard it is for some to test new mapping if no tool is around and have to use sheets instead.On the other hand once a freestyle is there in an easy-way then the limit will be only imagination . I personally no longer experiment with any new mapping because if how tedious it is to do that manually in excel . The fixtures I use are both standard and custom but mostly matrices along with few none standard fixtures mapped as a matrix

Intrinsically-Sublime commented 6 months ago

@dosipod I created a new branch called freestyle https://github.com/Intrinsically-Sublime/FastLED-XY-Map-Generator/tree/Freestyle with the option to create a freestyle layout.

To use it you need to start with an empty array and then just click the LEDs in the order you want them. If you want to undo things you just need to click them in the opposite order. There are NO arrows in freestyle mode you just have the numbers being displayed to tell you the order and direction.

If you could test it locally and find it works as expected I can publish it to the main repo to be live for everyone.

dosipod commented 6 months ago

@Intrinsically-Sublime Appreciate the work , I do not see what we aim for which is for the map pixels to just follow the clicks regardless of anything else . I have actually done this before in excel macro but lost the file and unfortunately only have office web now which does not allow macros .

As this would be really for advanced mapping so having the tool being wip or poc or with other quarks is not an issue at all , even having that in a separate branch is also okay if that will reduce the changes needed for your original tool .Noticed other very minor things that we will comeback to but not important now one of which is that the physical led number should show when freestyle is selected same as if you select wLED ledmap option but it is defaulted to -1 as in the pic

I have taken a short video and painted a small pic of what we are after which is very primitive but will allow the physical led number to be added to the map once clicked ( effects like Android and Gradient in this case will follow that order and give nice result ) , please feel free to just say go away and I would in that case go back and try to do something with a script as the matrix is mostly fixed ( those mostly pre-built and also with a fake matrix we will assume the same wiring to simplify that ) free_style02

image

Intrinsically-Sublime commented 6 months ago

@dosipod I once though the array worked as you are saying, but as far as I understand the way WLED reads the array is as if it is a rectangle in the order it is set in the 2D settings.

The only way I figured out how to make that work when I first made the WLED changes was to always set the 2D array in WLED as starting in the top left so that it would read the array the correct way.

Also you say the Physical LED number should be mapped once it is clicked and that is exactly what it is doing. You can see it shows 1-16 have been clicked and the map below shows exactly where they are in the array. I think you should give it a try with actual LEDs and the 2D settings set to top left striped (Not Sepentine).

Intrinsically-Sublime commented 6 months ago

I should add that I do know the 2d-maps.json code it creates is correct for normal mode as I have used it on multiple projects already.

Figuring out that the array is read row by row by WLED and you need to put the LED number in the array and a -1 if that spot has no physical LED took me a while to figure out. This is why empty it starts with -1's since that tells WLED that it has NO LEDs in the 2d array you have set in WLED 2D settings. Then you tell it where each LED is in that array starting with 0 it shows that LED number in the grid. When in Normal mode it constantly reorders them in a grid as set by the serpentine, vertical and flip buttons are set.

dosipod commented 6 months ago

@Intrinsically-Sublime As you can see in the working spiral ledmap and video i attached in the being of the post the resulted map need to follow the numbers 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,47,48,79,80,111,112,143,144,175,176,207..etc .

And please take a note that once you have a ledmap active then the matrix setting under the 2D page is ignored and will have no impact on the ledmap ( that is what you will see if you used that map and tried to change any setting under 2D page )

image

Regardless if we see different result or not for whatever reason ( which might be possible ) the reason we say free style is as the name implies should allow you to create the ledmap entries without taking any other factor into account .

I could be very well misunderstanding how does 2D works in wled since the start but mapping in the same way I give the example works for us on multiple fixtures so at the end we just aim to simplify that with your tool

Intrinsically-Sublime commented 6 months ago

@dosipod If you do not use the 2D settings, do you still get 2D effects? That is the entire reason I modified the tool, I wanted 2D effects on irregular matrices.

Are you trying to map 1D effects onto a 2D array in an unusual order?

So right now I am mapping the physical LED number to the position on the 2D matrix. Which as I said does work, I did notice it would reset the 2d settings sometimes though. But it is way easier with a gaps file which is why I added that option. So if that is not the official way I can try it the way you suggest.

So what you want is to map the 2D matrix location onto the physical order of the string. That should be easy to add. Give me a little while.

dosipod commented 6 months ago

@Intrinsically-Sublime I do use the 2D settings , it is just when you select a ledmap the setting in 2D page is ignored ( Sepentine, orientation ..etc ) and the map will work the same way if you setup your unit as 2D or 1D. In my setup if I use a ledmap then it is mostly for 1D effects , once i want to use 2D effects i change the map to default map .

And yes to your last statement I want to map the 2D matrix location onto the physical order of the string so as you click a pixel it will be added in sequence .

If there is any other way you could also think of that I could get a spiral map ( or any other order I click ) then by all means i am up for testing that as really all the info I have and did for mapping is done by a lot ( I really mean a lot ) of trial and error so might be we have a fundamental misunderstanding of 2D in wled and we built on that unfortunately but that does work in practice .

Intrinsically-Sublime commented 6 months ago

@dosipod I have updated the freestyle branch with a setting that lets you output a 2d-map either way, LED # to grid # or grid # to LED #.

So now in either normal or freestyle mode you can output the array either way just in case there is a use for either version.

dosipod commented 6 months ago

@Intrinsically-Sublime I could not get that to work ( or i might have not realized how you aim to do it ) , as the matrix led numbers are removed and default to -1 when you select free style ( not really sure why is that ) and the page is now too big it is very hard to take videos or explain any further then I did which i am partly to blame for that as I am multitasking with students for other project even not related to wled .

If you were able to produce a spiral map for 16x16 with any option like the below picture or the ledmap [correct_ledmap2.json] i posted in the start then we are there .Also if any other map you made can have the same effect then that is also fine

image

Otherwise might be we should drop the free style and I will do that in my tool but after sometime as I will be away for business in coming days . Thank you again for taking time to do this and I do hope your tool will be used by the guys which might need a bit of publicity if you can drop by discord then might be a good idea to post about it else I will try to have some of the guys test it as is and provide you will any comments they may have . Cheers

Intrinsically-Sublime commented 6 months ago

@dosipod You need to stop looking at the numbers in the grid as if they are the LED number, they only tell you the order you have clicked them in freestyle mode, otherwise you would never know the order. Look at the array below for the output.

But I do see now that you are trying to remap this over a serpentine array so my output although what you want still only does striped and not serpentine. Serpentine poses some issues.

So my current version does what you want minus over a serpentine array.

Screenshot from 2024-04-22 22-01-59 Screenshot from 2024-04-22 22-02-07

dosipod commented 6 months ago

@Intrinsically-Sublime That is fine but in practice if you use such map on the flexible matrix panels that everyone is having which are mostly serpentine does the end result provide the same result we did in the picture and video . I have tried with one of the students ( even tried to switch the matrix configuration in 2D when I know that does not matter ) but the result is that leds do not follow the sequence we clicked . I think I also have custom none Serpentine matrix somewhere I might try that but as said it might be a while .

Intrinsically-Sublime commented 6 months ago

@dosipod The problem up until now is I never really understood what you were trying to do. For me I make custom matrices in crazy shapes and need to map them to represent pixels in a rectangular array. This is what the tool was originally made to do by Garret Mace.

I though up until now you were basically doing the same and had a spiral wired matrix since when I asked in my first response what kind of panel it was, you responded in can be anything. So I assumed you meant you wanted to map the order you had laid out the LEDs so you could wire them in any order. So in your spiral example I thought it was a spiral wired matrix.

I now get that you are trying to map 2D patterns over premade fixed X/Y matrices with any possible normal wiring scheme. Not a big deal and kind of makes me laugh. I just wish I knew that from the beginning. I always have issues communicating and it is one of the reasons I do not do any social networking or forums. I will see what I can do about applying the serpentine/vertical/v_flip/hflip functions to this which should make it complete.

dosipod commented 6 months ago

@Intrinsically-Sublime I am not aware of what you do really but I think in the start of the post i linked a gif that shows what is the aim on a cube https://github.com/dosipod/Demos/blob/main/cubes-rings/6mm_1k_cube_1d.gif , might be you messed that , no worries i was able to do the same in a simple html page so problem is solved and will add that to my tool

Intrinsically-Sublime commented 6 months ago

@dosipod this entire tool was made to create maps of unusually wired matrices and your gif made it look like you were showing me how it was wired in a spiral. I then asked "Are those off the shelf panels or did you design them?" since I though they were spiral mapped panels and unusually mapped matrices is what this tool is made for. You then answered with "but that is the point to have a tool to make that easier as you would be surprised how hard it is for some to test new mapping" which again just made it look like you knew this tool was for making maps of unusually wired matrices. At NO point did you say you were using off the shelf panels and trying to map them OUT of order.

I have pushed a new version to the main Repo with Tri-State gaps support but I do not think I will put much effort in to adding the style of freestyle you want since this too is not designed for that. At this point the freestyle branch is close but you would need to apply the transforms to the ledindex during printMap() for serpentine/vertical/h-flip/v-flip.

dosipod commented 6 months ago

@Intrinsically-Sublime Yeah no need to cover the free style as we already have a working html that can do that and also select multiple pixels at once to simplify the mapping . Your page added gap files which is good if others want to use it for simple setups ( we do not use gap files as they are inferior to ledmaps so we did not bother to add it them ) . Having multiple tools and effort from the community is okay and we do encourage that as at some point if a tool is not marinated others can take over which is the case with us as we did not have time to maintain it and we may even try to borrow some of the changes you did at some point if we can not do that on our own . One small thing you might want to add is support for MM ledmaps with width and height and also have an text box for the ledmap name same as we did earlier here https://dosipod.github.io/WLED-Ledmap-Generator/ . Cheers

Intrinsically-Sublime commented 6 months ago

@dosipod

You say gap files are inferior to ledmaps but for what Garret Mace wrote this too for and what I modified this tool for which is to display 2D effects on non-rectangular matrices or matrices with holes etc, then gap files are better and far simplier.

The problem stems from your misunderstanding what this tool was made to do and my misunderstanding is from thinking you knew this tool was for dealing with unusually wired matrices. Not for mapping paths over regular matrices with standard wiring.

I think I understand now what you want and what it would take. Basically take my original version before I added WLED features and then just capture the displayed LED numbers as you click them and shove them in an array. Really easy compared to what this tool is made for.

Again no harm and no bad feelings. Just more of why I avoid forums and other places of discussion. Everyone assumes something and for some reason I never see it the same. It is not that either is wrong, just that we were reading form different books.

Intrinsically-Sublime commented 6 months ago

@dosipod After cleaning up the code and making them all separate apps it was fairly clear how to do what you wanted. Here is Arbitrary Paths version https://intrinsically-sublime.github.io/WLED-Arbitrary-Path-Ledmap.json-Generator/