@@ -528,6 +528,7 @@ VirtualMatrixPanel* BusHub75Matrix::activeFourScanPanel = nullptr;
528528HUB75_I2S_CFG BusHub75Matrix::activeMXconfig = HUB75_I2S_CFG();
529529uint8_t BusHub75Matrix::activeType = 0 ;
530530uint8_t BusHub75Matrix::instanceCount = 0 ;
531+ uint8_t BusHub75Matrix::last_bri = 0 ;
531532
532533
533534// --------------------------
@@ -899,7 +900,7 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh
899900 USER_PRINTLN (" MatrixPanel_I2S_DMA created" );
900901 // let's adjust default brightness
901902 // display->setBrightness8(25); // range is 0-255, 0 - 0%, 255 - 100% // [setBrightness()] Tried to set output brightness before begin()
902- _bri = 25 ;
903+ _bri = (last_bri > 0 ) ? last_bri : 25 ; // try to restore persistent brightness value
903904
904905 delay (24 ); // experimental
905906 DEBUG_PRINT (F (" heap usage: " )); DEBUG_PRINTLN (int (lastHeap - ESP.getFreeHeap ()));
@@ -917,6 +918,7 @@ BusHub75Matrix::BusHub75Matrix(BusConfig &bc) : Bus(bc.type, bc.start, bc.autoWh
917918 USER_PRINT (F (" heap usage: " )); USER_PRINTLN (int (lastHeap - ESP.getFreeHeap ()));
918919 delay (18 ); // experiment - give the driver a moment (~ one full frame @ 60hz) to settle
919920 _valid = true ;
921+ display->setBrightness8 (_bri); // range is 0-255, 0 - 0%, 255 - 100% // [setBrightness()] Tried to set output brightness before begin()
920922 display->clearScreen (); // initially clear the screen buffer
921923 USER_PRINTLN (" MatrixPanel_I2S_DMA clear ok" );
922924
@@ -1057,6 +1059,7 @@ void BusHub75Matrix::setBrightness(uint8_t b, bool immediate) {
10571059 MatrixPanel_I2S_DMA* display = BusHub75Matrix::activeDisplay;
10581060 // if (_bri > 238) _bri=238; // not strictly needed. Enable this line if you see glitches at highest brightness.
10591061 if ((_bri > 253 ) && (activeMXconfig.latch_blanking < 2 )) _bri=253 ; // prevent glitches at highest brightness.
1062+ last_bri = _bri;
10601063 if (display) display->setBrightness (_bri);
10611064}
10621065
0 commit comments