From 5c7e30e07a4bdc1e8a85bd259d82dac0d3a6ea26 Mon Sep 17 00:00:00 2001 From: Wim Pauwels Date: Fri, 19 May 2023 00:50:20 +0200 Subject: [PATCH] Added multiplexing method for P4Outdoor80x40 display --- lib/multiplex-mappers.cc | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/lib/multiplex-mappers.cc b/lib/multiplex-mappers.cc index 31b266d5d..0340a50a5 100644 --- a/lib/multiplex-mappers.cc +++ b/lib/multiplex-mappers.cc @@ -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 @@ -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()); return result; }