hzeller / rpi-rgb-led-matrix

Controlling up to three chains of 64x64, 32x32, 16x32 or similar RGB LED displays using Raspberry Pi GPIO
GNU General Public License v2.0
3.64k stars 1.16k forks source link

led matrix 30x30, scan mode 1/3 #869

Open andrei0807 opened 5 years ago

andrei0807 commented 5 years ago

I have led matrix of 30x30, scan mode 1/3. I am going to control this on Pi using this library. But it was not work correctly. How to set params for this led matrix. Please help me. Thanks.

hzeller commented 5 years ago

that is an unusual scan mode that I have not come across before; probably needs slight adjustments in the code. Can you take a picture of the connector on the matrix PCB including the labeling ? Do you have a datasheet ?

1/3 implies that we have essentially have in each half display 3 stripes of 5 led rows if it otherwise behaves as usual panels. Probably sufficient to just write another multiplex mapper.

andrei0807 commented 5 years ago

Thanks for your response, I will send you datasheet now

andrei0807 commented 5 years ago

image Does it make sense? Is this enough? Can I use this library for this LED matrix?

hzeller commented 5 years ago

Yeah, this looks doable if it otherwise works with the library. If you connect it to the library, do you get any output (albeit garbled) when you run the demo ?

You essentially need to add a new multiplex mapper in lib/multiplex-mappers.cc. I am currently travelling (eventually hitting Chaos Communication Camp), so can't really help much right now.

andrei0807 commented 5 years ago

Thanks for your response and sorry to disturb your rest. image Should I add class like this?

andrei0807 commented 5 years ago

@hzeller Can you explain about parameter's mean and function's login?

hzeller commented 5 years ago

See the header files for the corresponding class you implement. A Mjultiplex mapper is based on a PixelMapper who's parameters etc are described in the corresponding header in detal https://github.com/hzeller/rpi-rgb-led-matrix/blob/master/include/pixel-mapper.h

The Multiplex mapper is derived from that, and only adds one more method the EditColsRows() https://github.com/hzeller/rpi-rgb-led-matrix/blob/master/lib/multiplex-mappers-internal.h

.. there is already an implementation in MultiplexMapperBase, that implements that so you could instantiate that with 3 as parameter; Then the only function you need to implement is MapSinglePanel(), which takes the original x/y [0..29, 0..29] range and maps it to the new [0..149, 0..9] range. Something like this would be probably a good starting point:

class ThirdMultiplexMapper : public MultiplexMapperBase {
public:
  ThirdMultiplexMapper() : MultiplexMapperBase("Third", 3) {}

  void MapSinglePanel(...) const {
    // ... implementation according to your data-sheet
 }
};

Then register it in CreateMultiplexMapperList() and it should be available via the command-line flags.

angelogoncalve commented 5 years ago

https://github.com/hzeller/rpi-rgb-led-matrix/blob/master/lib/multiplex-mappers.cc

/*

static MuxMapperList *CreateMultiplexMapperList() {

MuxMapperList *result = new MuxMapperList();

// Here, register all multiplex mappers from above.

result->push_back(new StripeMultiplexMapper());

result->push_back(new CheckeredMultiplexMapper());

result->push_back(new SpiralMultiplexMapper());

result->push_back(new ZStripeMultiplexMapper("ZStripe", 0, 8));

result->push_back(new ZStripeMultiplexMapper("ZnMirrorZStripe", 4, 4));

result->push_back(new CoremanMapper());

result->push_back(new Kaler2ScanMapper());

result->push_back(new ZStripeMultiplexMapper("ZStripeUneven", 8, 0));

result->push_back(new P10MapperZ());

result->push_back(new ThirdMultiplexMapper("Third", 3));

return result;

}

const MuxMapperList &GetRegisteredMultiplexMappers() {

static const MuxMapperList *all_mappers = CreateMultiplexMapperList();

return *all_mappers;

}

andrei0807 commented 5 years ago

@angelogoncalve Thanks for your response. Can you write MapSinglePanel function for my led matrix?

andrei0807 commented 5 years ago

result->push_back(new ThirdMultiplexMapper("Third", 3)); Value 3 is correct? I think it's 5

andrei0807 commented 5 years ago

@hzeller How are you? I added new MultiplexMapperBase class but my LED doesn't work now. Do I only have to add a new MultiplexMapperBase class? Don't I need any more settings?

hzeller commented 5 years ago

How is your implementation @andrei0807 ?

andrei0807 commented 5 years ago

image $ sudo ./demo D 1 --led-gpio-mapping adafruit-hat --led-multiplexing 10 --led-rows 30 --led-cols 30 I changed code and used like command line.

andrei0807 commented 5 years ago

@hzeller Do you have time for me?

hzeller commented 5 years ago

Did you get it to work ? If so, send a pull request, so that others can make use of it as well.