rpi-rgb-led-matrix
rpi-rgb-led-matrix copied to clipboard
new S-mapper arrangement for pixel-mapper.cc
Allows an infinite S-shape mapping arrangement.
I was using the U mapper for my display when I added a third for widescreen. The U-Mapper doesn't work for anything beyond two panels.
Any desire to see some other built-in mappers added? Or these changes added into the U-mapper.. perhaps with an n-run/pre-fold optional parameter?
Ahh, looks like there's many calls for similar things.
- Issue #606 Rotate 90 not working as expected with multiple panels looks like a very similar request, they just wanted more a repeating N-shape.
- Pull #612 Add support for migrating from SmartMatrix's bottom to top stacking also looks the same, just described very differently.
- #552 5 panels 32x16
So this looks like a specialization for the U-mapper, essentially extending it to rows more than 2. I think it would be nicer if we just made the U-mapper do this, with a parameter with default stripes=2 but can be more. That way, we can do the same with less code and easier to explain to users. Could you adapt your code like that ?
Hi t413 & hzeller,
I am working on a project having below arrangement
[<][<][<][<][<] }-- Pi connector -1 [<][>][>][>][>] [<][<][<][<][<] [<][<][<][<][<] }-- Pi connector -2 [<][>][>][>][>] [<][<][<][<][<] [<][<][<][<][<] }-- Pi connector -3
I am using P10 module having 32 columns and 16 rows each. My board is having 5 P10 modules in each row and having total of 7 rows. I tried using your SArrangementMapper but the result coming is not as expected and now even the fonts are jumbled up and board not showing any font properly. Earlier I used the same arrangement with UArrangementMapper with the below arrangement of modules
[<][<][<][<] }-- Pi connector -1 [>][>][>][>] [<][<][<][<] }--- Pi connector -2 [>][>][>][>] [<][<][<][<] }--- Pi connector -3 [>][>][>][>]
and everything was working fine. The problem was that I need 7 rows and for that I need to use something like SArrangementMapper. I am using the below parameter for running my program.
Rows = 16,
Cols =32,
ChainLength = 15,
Parallel=3,
Multiplexing=4,
PixelMapperConfig="S-mapper",
GpioSlowDown =2
I have tried many combinations by changing the SArrangementMapper but with no luck. I using ZStripeMultiplexMapper for mapping my board pixels with the little bit of modification in it.
`class ZStripeMultiplexMapper : public MultiplexMapperBase { public: ZStripeMultiplexMapper(const char *name, int even_vblock_offset, int odd_vblock_offset) : MultiplexMapperBase(name, 2), even_vblock_offset_(even_vblock_offset), odd_vblock_offset_(odd_vblock_offset) {}
void MapSinglePanel(int x, int y, int *matrix_x, int *matrix_y) const { static const int tile_width = 8; static const int tile_height = 4;
const int vert_block_is_odd = (((**y+4**) / tile_height) % 2);
const int even_vblock_shift = (1 - vert_block_is_odd) * even_vblock_offset_;
const int odd_vblock_shitf = vert_block_is_odd * odd_vblock_offset_;
*matrix_x = x + ((x + even_vblock_shift) / tile_width) * tile_width + odd_vblock_shitf;
*matrix_y = (y % tile_height) + tile_height * (y / (tile_height * 2));
} `
Would highly appreciate if anyone of you can help me in this regard. My Apologies in case if I have wrongly commented on a pull request rather then raising an issue. My only point for commenting over here is that its not yet merged in the main branch. Again my apologies in advance for cluttering this area.
Hey @NeerajShrivastava04, no this is good input to this issue! I'd like to make a mapper that works well for as many arrangements as possible.
Given your 35 panels not being evenly divisible by 3 or 2 you're going to need something like an asymmetric-mapper.. something I haven't considered or explored. @hzeller can help but it looks like the framebuffer will always output for the same number of chains in parallel. It could be up to a mapper to reduce the size of the output space and map only to positions you know exist.
@NeerajShrivastava04 writing a new built-in mapper to do this right now seems pretty out of scope and special-case for now– but writing a special NeerajProjectMapper with hardcoded parameters for your arrangement should be pretty doable! It looks like you know what you're doing, I'd be happy to offer some help :)
And @hzeller I'm working on making an extended U-mapper as we were talking about.
@t413 can you please help me in this regard as I am not able to make this mapper. I would really appreciate if you can give me some pointers or some sort of suodo code.
Thanks in advance for all you help.
@NeerajShrivastava04 Sure thing. This thread isn't well-suited, what's the best way to chat going forward? Send me an email or hangouts chat request [email protected]
Hi Timo...Thanks for responding to my request and my sincere apologies for the delayed response.
Meanwhile I did some changes in the existing U-mapper and have been able to successfully run the below configuration
[<][<][<][<][<] }-- Pi connector -1 [<][>][>][>][>] [<][<][<][<][<] [>][>][>][>][>] [<][<][<][<][<] }-- Pi connector -2 [>][>][>][>][>] [<][<][<][<][<]
If you see this arrangement then its basically an S arrangement and I am using only 2 parallel inputs from PI as I only need to address 7 rows. Over here though PI is sending signals to row no. 8 but I am not using it. Below is the modified code which is running perfectly fine for my project
virtual bool GetSizeMapping(int matrix_width, int matrix_height, int *visible_width, int *visible_height) const { *visible_width = (matrix_width / 64) * 16; // Div at 32px boundary *visible_height = 4 * matrix_height; if (matrix_height % parallel_ != 0) { fprintf(stderr, "%s For parallel=%d we would expect the height=%d " "to be divisible by %d ??\n", GetName(), parallel_, matrix_height, parallel_); return false; } return true; }
`virtual void MapVisibleToMatrix(int matrix_width, int matrix_height, int origX, int origY, int *matrix_x, int *matrix_y) const {
const int panel_height = matrix_height / parallel_;
const int visible_width = (matrix_width / 64) * 16;
const int slab_height = 4 * panel_height;
int y = origY;
int x = origX;
const int base_y = (y / slab_height) * panel_height;
y %= (slab_height)/2;
if (y > panel_height) {
y = (slab_height/2)-y - 1;
}
*matrix_x = x;
int mod_y = origY%slab_height;
if(mod_y <16){
matrix_x = x+matrix_width - visible_width; //640-160=480 to 640
}else if(mod_y >15 && mod_y <32){
matrix_x = x+matrix_width - visible_width-1; //640-160 -1=479 to 320
}else if(mod_y > 31 && mod_y <48){
matrix_x = x+matrix_width - 3*visible_width; //640-3*160=160 to 319
}else {
matrix_x = visible_width - x - 1; //159 to 0
}
*matrix_y = base_y + y;
}`
I am still in a process of modifying it to make it generic and will keep you folks posted in case if I will be able to come up with a generic solution.
Once again Thank you so much for all your help and guidance.
Hi, Thank you for what you're doing here. Please I want you to help. I'm trying to build something like that: ....[<]....}-- Pi connector -1 [<][<][<]}-- Pi connector -2 ....[<]....}-- Pi connector -3 Please help me ?
Any word on this? I have 2 panels but need S not U shape.
>
<
>
<
Hello, I also had the problem, that I need more than 2 rows for every output from the hat. I have nearly the same arrangement. (32x32 P6-panels) [<][<][<][<][<] }-- Pi connector -1 [<][>][>][>][>] [<][<][<][<][<] [>][>][>][>][>] [<][<][<][<][<] }-- Pi connector -2 [<][>][>][>][>] [<][<][<][<][<] [>][>][>][>][>] [<][<][<][<][<] }-- Pi connector -3 [>][>][>][>][>] [<][<][<][<][<] I am also not using the last row from output 3. I made this changes in the pixel-mapper.cc in the U-mapper:
` virtual bool GetSizeMapping(int matrix_width, int matrix_height, int *visible_width, int *visible_height)
const {
int signalrows = 4;
*visible_width = matrix_width / signalrows;
*visible_height = signalrows * matrix_height;
fprintf(stderr,"GetSizeMapping: visible_width: %d; visible_height %d \n", *visible_width,*visible_height);
if (matrix_height % parallel_ != 0) {
fprintf(stderr, "%s For parallel=%d we would expect the height=%d to be divisible by %d ??\n", GetName(), parallel_, matrix_height, parallel_);
return false;
}
return true;
}
virtual void MapVisibleToMatrix(int matrix_width, int matrix_height, int origX, int origY, int *matrix_x, int *matrix_y) const { int signalrows=4; const int panel_height = matrix_height / parallel_; const int slab_height = signalrows * panel_height;
int y = origY;
int x = origX;
const int base_y = (y / slab_height) * panel_height;
y %= (slab_height);
for(int i=1;i<=signalrows;i++)
{
if(i%2==0){
if (y>=panel_height*i && y<panel_height*(i+1)){
x = x+i*(matrix_width/signalrows);
y = y-matrix_height*i/parallel_;
break;
}
}
else{
if (y>=panel_height*i && y<panel_height*(i+1)){
x = (i+1)*(matrix_width/signalrows)-1-x;
y = matrix_height*(i+1)/parallel_ - y-1;
break;
}
}
}
*matrix_x = x;
*matrix_y = base_y + y; `
Dear all,

I am building a bigger version of a Red pixel mirror that lets you see yourself in 3 seconds delay. It is an Art piece I made and the original screen was 96x96 pixels
I am building a big screen that needs some help. It is 72 pieces P10 32x16 panels arranged in a 6x8 setup. The final screen is 128 pixels wide and 192 pixels height
[<][<][<][<][<][<] }-- Pi connector #1 [>][>][>][>][>][>] [<][<][<][<][<][<] [<][<][<][<][<][<] }— Pi connector #2 [>][>][>][>][>][>] [<][<][<][<][<][<] [<][<][<][<][<][<] }— Pi connector #3 [>][>][>][>][>][>]
I need help with the mapping of the LED matrix. As you can see in the image it is standing and the chain is 3 columns of modules. I have tested the S-Mapper by t413, but it does not work. There is something wrong with the registration. I also tested to make a hard coded version, but my c programming is not good, so that was a fail.
Can someone please help me. The exhibition opens in three weeks and I am desperate. I do understand that this is a enthusiast forum and it is your free time you are giving up. But I am willing to pay you for your help. I really really need help.
You can contact me directly at: [email protected]
Later we can post the solution GitHub
All my best Thomas Broomè
You can try https://github.com/ledvinap/rpi-rgb-led-matrix/tree/feature-remap-mapper. It will be a lot of panel mapping parameters, but it shall work fine.
Thank you ledvinap,
I have replaced: pixel-mapper.cc led-matrix.cc pixel-mapper.h with your files. But it says Remap: No such mapper. when I try to run it. Is there something I missed?
Thank you again for your help Thomas
Can you try again, please? New changes are hopefully merged. I'll test it, but it will take some time