Open multimarcus opened 4 years ago
You might need to custom-implement a PixelMapper for this https://github.com/hzeller/rpi-rgb-led-matrix/blob/master/include/pixel-mapper.h . This should be a fairly simple implementation; here some rough pseudocode of the meat:
include "pixel-mapper.h"
class ShiftMapper : public rgb_matrix::PixelMapper {
virtual const char *GetName() const { return "ThirdShiftMapper"; }
virtual bool GetSizeMapping(int matrix_width, int matrix_height,
int *visible_width, int *visible_height) const {
*visible_height = matrix_height;
*visible_width = matrix_width + 32; // because our square we cover is one panel wider
return true;
}
void MapVisibleToMatrix(int matrix_width, int matrix_height,
int visible_x, int visible_y,
int *matrix_x, int *matrix_y) const {
*matrix_y = visible_y; // y always stays the same
*matrix_x = visible_x;
if (visible_y > 64) { // third chain
*matrix_x += 32; // or minus, depending on shift
}
}
};
Then somewhere before you call RGBMatrix::CreateFromFlags()
, register it:
rgb_matrix::RegisterPixelMapper(new ShiftMapper());
You then can use your new mapper by specifying on the command line --led-pixel-mapper=ThirdShiftMapper
If you have trouble with the c++, ask someone you know who does; they will be able to make something out of the above.
? where would you murder the CPU ?
The mapper is applied once at initialization time; nothing is used at runtime. And the code pushing data to the panels is only concerned about the actual panels, so there is now overhead in memory or runtime.
(David, I'd like you to please only respond to user issues if you know the details. You have helped users with the correct information before, so please more of that. But for things you can only speculate it is probably better to not add confusing information).
Yes you are mistaken. The mapper is used to set-up a look-up table initially, then never used again.
Hey! Thanks a lot for all of the above! I will have a go at it over the next few days and will send an update!!!
Dear Zeller, Thank you for writing this amazing library and thanks to everyone for adding to it.
This might be a bit of silly question, I am new to C+ and I am learning bit by bit as I go. Is there a function/way to offset the x or y coordinate of just one chain out of three? I am working on a custom shape screen and would like to achieve the following, while still retaining a complete image? Yep, I can edit the image/animation in Photoshop/After Effects, but it would be much quicker to do it through code.
Thanks a lot for your help!