Help with mapping

Hi… just converted over from a teensy+octows to a pixelblaze+expander =)

(decently easy, if anyone else is thinking of it, I just added a cat6 keystone to the extender output pins, using the pinout from the octows documentation… and unplugged my rj45 from the teensy+octows and plugged it into the pixelblaze+expander, all good)

Anyways… my room is arranged with 4 strips, 2 on the left wall, 2 on the right wall… each strip runs from the center of the wall to the edge…

I know how many leds are in each strip, but how do I define a sensible mapping in the mapping tab to enable a light to travel around the edge of the room?

Guessing the ring mapping is best, although there’ll be gaps at say 45’-315’ and 135’-225’ for the walls without leds… and due to the walls unhelpfully not being the same length, due to walls, each strip is a slightly different length…

I kinda expected the mappings tab to have some way of saying ‘strip/ledno’ → ‘somethingelse’ … but I don’t see that, so I’m a bit lost.

Any quick pointers for to help out?

The mapping gives 2d/3d coords to a pixel’s index, but there isn’t anything to reindex them at the moment. For any 2D/3D aware pattern, thats usually all you need. Some of the 1D patterns that assume a linear pixel index could be modified by swapping out any instance of index/PixelCount with some 0-1 value derived from the map, like x, y, or the radial angle (via atan2) or something.

So the map returned, is…

absoluteindexofpixel → (2d|3d)coord

where absoluteindexofpixel is derived (in the case of an expander), by it’s position within a sequence that starts at 0, and runs until the sum of all the counts per channel. (potentially with gaps?)

So in a way, the default mapping of a a channel is a sequence running in increasing order from startindex until startindex + countforchannel.

And if I wanted an led to cycle around my room, given that my strips feed outwards from the center, assuming starting at the center on one side, I’d need to increment until I hit the end of that channel, then decrement down the count for the next, then increment up the next, then decrement down the last. As the expander config doesn’t really allow me to reverse the count for a strip, I’ll need to do that in the mapping… and I guess I could just define a 2d array with only one dimension, and then alter calls by index into 2d calls with a fixed 2nd dimension.

For a ring, I guess I’d take my count per channel, and divide the leds per channel into a 90’ arc, giving a ring with uneven, but correct counts per quarter face… That would give a continuous ring, so an led leaving one wall would immediately appear on the other… Or I could reduce the arc from 90’ to 45’, and have sections that have no leds, and then a travelling led at fixed speed would reappear after going ‘behind’ the wall without leds on :wink: (in each case each arc needs to be anchored appropriately)…

I see the total pixel count is available to the mapping javascript, wondering if the count-per-channel is available too (as a map, or similar)… can make this work without, but I hate having that count be hardcoded in the map, and also in the settings panel… Although by it’s nature the mapping is going to be reasonably installation specific, just feels wrong duplicating values like that =)

Sorry, it’s not. A duplicate array is probably the way to go.

I did something similar for the firework. You can make a function that reverses certain ranges of indices, or cache that result in an array for O(1) linear remapping of indices.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.