mrcodetastic / ESP32-HUB75-MatrixPanel-DMA

An Adafruit GFX Compatible Library for the ESP32, ESP32-S2, ESP32-S3 to drive HUB75 LED matrix panels using DMA for high refresh rates. Supports panel chaining.
MIT License
950 stars 211 forks source link

Make ESP32 pinout compatible between your lib and SmartMatrix? #4

Closed marcmerlin closed 5 years ago

marcmerlin commented 5 years ago

Howdy again, I tried your library to see if it would look better on video than SmartMatrix which is ok with the naked eye, but looks very flickery on video, see https://community.pixelmatix.com/t/working-around-sync-offsets-and-flicker-when-filming-taking-pictures/346 https://www.youtube.com/watch?v=1f2aDTCmLcE

Louis recommended that I try your lib, which I got working in 32x64 (not 64x64 yet). One issue though is the two libs use different pinout. See https://github.com/pixelmatix/SmartMatrix/blob/teensylc/src/MatrixHardware_ESP32_V0.h#L64 Would you be willing to change your pinout to be compatible with it so that people can switch between both libs without rewiring?

ESP32-RGB64x32MatrixPanel-I2S-DMA.h:

define R1_PIN 2

define G1_PIN 15

define B1_PIN 4

define R2_PIN 16

define G2_PIN 27

define B2_PIN 17

define A_PIN 5

define B_PIN 18

define C_PIN 19

define D_PIN 21

define E_PIN 12

define LAT_PIN 26

define OE_PIN 25

define CLK_PIN 22

Thank you and Merry Xmas, Marc

marcmerlin commented 5 years ago

BTW, I'm not sure if you used my ESP32 SPIFFS AnimatedGifs port, looks like you did your own SPIFFS port. That said, I added a few updates with gamma correction and file browsing if you'd like: https://github.com/marcmerlin/AnimatedGIFs

mrcodetastic commented 5 years ago

Hi Marc, I'll look to enhance it so the pin-out can be defined on loading of the library. The pin is currently as it is such that hooking up the LOLIN D32 to one of these HUB75 panels is a lot more straight-forward, in that the pins on one side of the HUB75 connector connect to pins on one side of the LOLIN D32 (top to bottom) etc.

As for the AnimatedGif port - I based this off the example code in the original SmartMatrix library. I'll look at your enhancements and potentially just port your example instead. Good work.

marcmerlin commented 5 years ago

Ah yes, the stupid pinout of ESP32 chips that is different on every other chip, what a mess :( I get what you're saying on having pins that happen to be contiguous on one side of the chip, that's convenient. Do I however understand that you're not using a level shifter (74HC245 or equivalent)? If so, nice to know it works without one. If you haven't seen it, I can recommend this shield: https://www.evilgeniuslabs.org/hexadecimal-nodemcu-32s-wi-fi-and-ble-led-controller

For AnimatedGifs, you can look at http://marc.merlins.org/perso/arduino/post_2018-07-13_AnimatedGIFs-for-SmartMatrix-or-NeoMatrix-_Neopixel-WS2812B_-from-SDcard-or-SPIFFS_-on-Teensy-3_x_-ESP8266_-or-ESP32.html for a quick demo, but mostly it adds the file browser (next/previous), jump to gif #x, and gamma correction.

See https://github.com/marcmerlin/AnimatedGIFs/blob/master/AnimatedGIFs.ino#L313

Feel free to close this issue, I totally understand that making 13 or so pins arguments of the lib, is kind of a pain. It's not so bad to change them in the .h file. Cheers.

mrcodetastic commented 5 years ago

I've made an update so you can set the pin mapping as part of the .begin() function. So in my sketch I can have:

// Change these to whatever suits
#define R1_PIN  25
#define G1_PIN  26
#define B1_PIN  27
#define R2_PIN  14
#define G2_PIN  12
#define B2_PIN  13

#define A_PIN   23
#define B_PIN   22 
#define C_PIN   5
#define D_PIN   17
#define E_PIN   -1

#define LAT_PIN 4
#define OE_PIN  15

#define CLK_PIN 16

display.begin(R1_PIN, G1_PIN, B1_PIN, R2_PIN, G2_PIN, B2_PIN, A_PIN, B_PIN, C_PIN, D_PIN, E_PIN, LAT_PIN, OE_PIN, CLK_PIN );  // setup the LED matrix

Cheers

marcmerlin commented 5 years ago

Cool, thank you. I'm still stuck on https://github.com/mrfaptastic/ESP32-RGB64x32MatrixPanel-I2S-DMA/issues/3 which sadly is a dealbreaker for me, but on the plus side, it gave me the opportunity to add a GFX + FastLED layer to SmartMatrix which supports up to 128x128. It doesn't do DMA though, but it supports 24bit color instead of 12bit color. https://github.com/marcmerlin/SmartMatrix_GFX and demo code https://github.com/marcmerlin/FastLED_NeoMatrix_SmartMatrix_LEDMatrix_GFX_Demos I'll send you another PR with details. Cheers

marcmerlin commented 5 years ago

This issue is resolved, so I'll close it. Thanks.