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
961 stars 213 forks source link

Cannot set panel brightness using the NO_GFX option. #366

Closed BoltSwith closed 1 year ago

BoltSwith commented 1 year ago

Hi,

Great Library here and many thanks for sharing.

Using a 128x64 panel with the ICN2037BP driver chip, I was able to successfully compile the project and try some of the examples supplied with the library (fillscreens, bouncing_squares, pattern_plasma, Simple_Test_Shapes). All examples worked fine, however, attempting to set panel brightness using both "setBrightness8();" and "setPanelBrightness()" with Adafruit_GFX_Library and NO_GFX option seem not to have any effect on actually panel brightness (brightness remains the same at both 1 and 255 values).

Trying the patten_Plasma example using the FastLED and GFX_Root Libs, I was able to adjust panel brightness conveniently.

Does the "setBrightness" functions of this library depend on other APIs - Adafruit_GFX_Library, FastLED or Neomatrix - to adjust actual panel brightness? I would prefer to use the NO_GFX option and implement my own graphics/text drawing functions and the native methods - setBrightness(), drawPixel(), clearScreen(), fillScreen() - provided by this library. Thanks.

mrcodetastic commented 1 year ago

Hi @BoltSwith

That's really bizarre.... the setPanelBrightness and setBrightness8 are defined within the main header file and should be available regardless of the compile option, and have no dependency on any GFX library.

Not sure why it doesn't work with Adafruit_GFX_Library alone. I was testing dimming earlier today for a similar issue that was raised, but used Pattern Plasma as my test sketch, and it worked which you corroborate.... but sounds like it doesn't when FastLED isn't available.

Can you stick a couple of Serial.println's into the brightnesss functions and confirm they're being called properly etc? No idea what would cause this issue.

mrcodetastic commented 1 year ago

Try the latest git version of the library and see what happens. setBrightness and setPanelBrightness and setBrightness8 all take a value between 0 and 255 now.

Try safe values like 16, 32, 128 etc.

BoltSwith commented 1 year ago

Hurray.....!!!!

Trying the latest git version as you advised, I was able to seamlessly set the brightness of the panel using the "setBrightness()" method. Values tested include 10, 100, 150 and 200. This test was done using the NO_GFX option.

Many thanks for the swift response.

Brightness Samples

BoltSwith commented 1 year ago

I think an update to this instruction on setting Brightness might be in order. For persons who may not be aware of this change.

Panel Brightness Instruction/Guide