Smartmatrix mapping

How to create PanelMappingEntry array according to any module (hub75) module with different mode scan.
i need to know how to create this array. can you explain…


There’s instructions here:

1 Like

Following is my practice for reference.

Firstly, to setup rpi-rgb-led-matrix library based on Raspberry PI.
Use demo in examples-api-use, by setting correct multiplexing to get correct display. Remember it’s number. Then hack ApplyPixelMapper() of in directory lib, to print x, y

bool RGBMatrix::Impl::ApplyPixelMapper(const PixelMapper *mapper) {
  if (mapper == NULL) return true;
  using internal::PixelDesignatorMap;
  const int old_width = shared_pixel_mapper_->width();
  const int old_height = shared_pixel_mapper_->height();
  int new_width, new_height;
  if (!mapper->GetSizeMapping(old_width, old_height, &new_width, &new_height)) {
    return false;

  printf("ApplyPixelMapper - old_w = %d, old_h = %d, new_w = %d, new_h = %d\n", old_width, old_height, new_width, new_height);

  PixelDesignatorMap *new_mapper = new PixelDesignatorMap(
    new_width, new_height, shared_pixel_mapper_->GetFillColorBits());
  for (int y = 0; y < new_height; ++y) {
    for (int x = 0; x < new_width; ++x) {
      int orig_x = -1, orig_y = -1;
      mapper->MapVisibleToMatrix(old_width, old_height,
                                 x, y, &orig_x, &orig_y);
      if (orig_x < 0 || orig_y < 0 ||
          orig_x >= old_width || orig_y >= old_height) {
        fprintf(stderr, "Error in PixelMapper: (%d, %d) -> (%d, %d) [range: "
                "%dx%d]\n", x, y, orig_x, orig_y, old_width, old_height);

      printf("ApplyPixelMapper -> x = %d, y = %d, orig_x = %d, orig_y=%d\n", x, y, *orig_x, *orig_y);

      const internal::PixelDesignator *orig_designator;
      orig_designator = shared_pixel_mapper_->get(orig_x, orig_y);
      *new_mapper->get(x, y) = *orig_designator;
  delete shared_pixel_mapper_;
  shared_pixel_mapper_ = new_mapper;
  return true;

Then compile library and run demo again, here set --led-row/–led-col value to only one panel with one chain/parallel. Now you could see two pairs x/y. then according to your scan mode, row/col to setup your PanelMap.