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
970 stars 211 forks source link

setPanelBrightness() corrupts top line when using colour depth of less than 4 bits #524

Closed mickjc750 closed 11 months ago

mickjc750 commented 11 months ago

Hi,

I recently started experimenting with this library to see if it would suit my application. I started with your demo test sketch, and configured it for 4 panels of 64x32. At this point I only have 1 of the 4 panels connected, so can only see x of 192-255.

I don't need much colour depth, so I configured it for only 2 bits using setPixelColorDepthBits(2), then started experimenting with how intensity is handled, by displaying a gradient and dimming the display with setPanelBrightness().

The lowest visible intensity with 2bit depth is corrupted in the top row if I use either 2 or 3 bits of colour depth (see picture). 2023-11-26 12 17 03

I produced the attached image by putting the following into loop() on your test sketch (and speeding up the cycles to 200mS).

static uint8_t b = 255; Serial.printf("panel brightness: %u\n", b); x = 192; while(x != 256) { c = (x-192)*4; matrix->drawFastVLine(x,0,25, c, c, c); x++; }; matrix->setPanelBrightness(b); b--;

It's not a show stopper for me, as there is enough ram with this configuration to run 4 bits of colour depth, but It's a shame to waste the ram if the colour depth isn't needed.

mickjc750 commented 11 months ago

mxconfig.clkphase = false; fixed it... (sorry).

Thanks for a great library, looks like it will do everything I need :-)