WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit fa530f5

Browse files
authored
Merge pull request #1723 from brooksrow/master
Rebased version of old pull request for P4Outdoor80x40
2 parents b962f3f + dde1995 commit fa530f5

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

lib/multiplex-mappers.cc

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,31 @@ class DoubleZMultiplexMapper : public MultiplexMapperBase {
524524
}
525525
};
526526

527+
/*
528+
* P4 Outdoor panel 80x40 pixels
529+
* https://nl.aliexpress.com/item/1005003999341251.html?spm=a2g0o.order_list.order_list_main.11.408679d2q5LwTb&gatewayAdapt=glo2nld
530+
*/
531+
class P4Outdoor80x40Mapper : public MultiplexMapperBase {
532+
public:
533+
P4Outdoor80x40Mapper() : MultiplexMapperBase("P4Outdoor80x40Mapper", 2) {}
534+
535+
void MapSinglePanel(int x, int y, int *matrix_x, int *matrix_y) const {
536+
537+
const int tile_width_ = 8;
538+
const int tile_height_ = 10;
539+
const int vblock_is_odd = (y / tile_height_) % 2;
540+
const int hblock = x / tile_width_;
541+
542+
if (vblock_is_odd) {
543+
*matrix_x = (x % tile_width_) + (2 * tile_width_ * hblock) + tile_width_;
544+
} else {
545+
// even tiles have reverse x-order
546+
*matrix_x = -((x % tile_width_) - tile_width_ + 1) + (2 * tile_width_ * hblock);
547+
}
548+
*matrix_y = (y % tile_height_) + tile_height_ * (y / (tile_height_ * 2));
549+
}
550+
};
551+
527552
/*
528553
* Here is where the registration happens.
529554
* If you add an instance of the mapper here, it will automatically be
@@ -554,6 +579,7 @@ static MuxMapperList *CreateMultiplexMapperList() {
554579
result->push_back(new P10Outdoor32x16QuarterScanMapper());
555580
result->push_back(new P3Outdoor64x64MultiplexMapper());
556581
result->push_back(new DoubleZMultiplexMapper());
582+
result->push_back(new P4Outdoor80x40Mapper());
557583
return result;
558584
}
559585

0 commit comments

Comments
 (0)