Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added multiplexing method for P4Outdoor80x40 display #1571

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions lib/multiplex-mappers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,31 @@ class P10Outdoor32x16HalfScanMapper : public MultiplexMapperBase {
}
};

/*
* P4 Outdoor panel 80x40 pixels
* https://nl.aliexpress.com/item/1005003999341251.html?spm=a2g0o.order_list.order_list_main.11.408679d2q5LwTb&gatewayAdapt=glo2nld
*/
class P4Outdoor80x40Mapper : public MultiplexMapperBase {
public:
P4Outdoor80x40Mapper() : MultiplexMapperBase("P4Outdoor80x40Mapper", 2) {}

void MapSinglePanel(int x, int y, int *matrix_x, int *matrix_y) const {

const int tile_width_ = 8;
const int tile_height_ = 10;
const int vblock_is_odd = (y / tile_height_) % 2;
const int hblock = x / tile_width_;

if (vblock_is_odd) {
*matrix_x = (x % tile_width_) + (2 * tile_width_ * hblock) + tile_width_;
} else {
// even tiles have reverse x-order
*matrix_x = -((x % tile_width_) - tile_width_ + 1) + (2 * tile_width_ * hblock);
}
*matrix_y = (y % tile_height_) + tile_height_ * (y / (tile_height_ * 2));
}
};

/*
* Here is where the registration happens.
* If you add an instance of the mapper here, it will automatically be
Expand Down Expand Up @@ -481,6 +506,8 @@ static MuxMapperList *CreateMultiplexMapperList() {
result->push_back(new P8Outdoor1R1G1BMultiplexMapper());
result->push_back(new FlippedStripeMultiplexMapper());
result->push_back(new P10Outdoor32x16HalfScanMapper());
result->push_back(new P4Outdoor80x40Mapper());
//result->push_back(new P4Outdoor80x40Mapper1());
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean to leave this commented-out line here ?

return result;
}

Expand Down