This commit is contained in:
mrfaptastic 2023-03-21 23:05:14 +00:00
parent 1ac5a2209e
commit 93b36adf72
2 changed files with 22 additions and 31 deletions

View file

@ -429,13 +429,13 @@ void MatrixPanel_I2S_DMA::updateMatrixDMABuffer(uint8_t red, uint8_t green, uint
/* https://ledshield.wordpress.com/2012/11/13/led-brightness-to-your-eye-gamma-correction-no/ */ /* https://ledshield.wordpress.com/2012/11/13/led-brightness-to-your-eye-gamma-correction-no/ */
uint16_t red16, green16, blue16; uint16_t red16, green16, blue16;
#ifndef NO_CIE1931 #ifndef NO_CIE1931
red16 = lumConvTab[red]; red16 = lumConvTab[red];
green16 = lumConvTab[green]; green16 = lumConvTab[green];
blue16 = lumConvTab[blue]; blue16 = lumConvTab[blue];
#else #else
red16 = red << 8; red16 = red << 8;
green16 = green << 8; green16 = green << 8;
blue16 = blue << 8; blue16 = blue << 8;
#endif #endif
for (uint8_t colour_depth_idx = 0; colour_depth_idx < m_cfg.getPixelColorDepthBits(); colour_depth_idx++) // colour depth - 8 iterations for (uint8_t colour_depth_idx = 0; colour_depth_idx < m_cfg.getPixelColorDepthBits(); colour_depth_idx++) // colour depth - 8 iterations
@ -493,11 +493,13 @@ void MatrixPanel_I2S_DMA::updateMatrixDMABuffer(uint8_t red, uint8_t green, uint
* This effectively clears buffers to blank BLACK and makes it ready to display output. * This effectively clears buffers to blank BLACK and makes it ready to display output.
* (Brightness control via OE bit manipulation is another case) - this must be done as well seperately! * (Brightness control via OE bit manipulation is another case) - this must be done as well seperately!
*/ */
void MatrixPanel_I2S_DMA::clearFrameBuffer() void MatrixPanel_I2S_DMA::clearFrameBuffer(bool _buff_id)
{ {
if (!initialized) if (!initialized)
return; return;
frameStruct *fb = &frame_buffer[_buff_id];
// we start with iterating all rows in dma_buff structure // we start with iterating all rows in dma_buff structure
int row_idx = fb->rowBits.size(); int row_idx = fb->rowBits.size();
do do
@ -615,6 +617,8 @@ void MatrixPanel_I2S_DMA::brtCtrlOEv2(uint8_t brt, const int _buff_id)
if (!initialized) if (!initialized)
return; return;
frameStruct *fb = &frame_buffer[_buff_id];
uint8_t _blank = m_cfg.latch_blanking; // don't want to inadvertantly blast over this uint8_t _blank = m_cfg.latch_blanking; // don't want to inadvertantly blast over this
uint8_t _depth = fb->rowBits[0]->colour_depth; uint8_t _depth = fb->rowBits[0]->colour_depth;
uint16_t _width = fb->rowBits[0]->width; uint16_t _width = fb->rowBits[0]->width;

View file

@ -29,9 +29,6 @@
// #define NO_CIE1931 // #define NO_CIE1931
// Turn on rows being displayed out of order in a mixed manner.
//#define ROW_SCAN_SHUFFLE
/* Physical / Chained HUB75(s) RGB pixel WIDTH and HEIGHT. /* Physical / Chained HUB75(s) RGB pixel WIDTH and HEIGHT.
* *
* This library has been tested with a 64x32 and 64x64 RGB panels. * This library has been tested with a 64x32 and 64x64 RGB panels.
@ -598,20 +595,14 @@ public:
{ {
return; return;
} }
if (back_buffer_id == 0) // back buffer is 0 (dmadesc_a)
{
fb = &frame_buffer[1];
}
else
{
fb = &frame_buffer[0];
}
dma_bus.flip_dma_output_buffer(back_buffer_id); dma_bus.flip_dma_output_buffer(back_buffer_id);
back_buffer_id ^= 1;
fb = &frame_buffer[back_buffer_id];
back_buffer_id ^= 1;
} }
/** /**
@ -625,13 +616,11 @@ public:
return; return;
} }
fb = &frame_buffer[0];
brightness = b; brightness = b;
brtCtrlOEv2(b, 0); brtCtrlOEv2(b, 0);
if (m_cfg.double_buff) if (m_cfg.double_buff)
{ {
fb = &frame_buffer[1];
brtCtrlOEv2(b, 1); brtCtrlOEv2(b, 1);
} }
} }
@ -705,7 +694,7 @@ protected:
* This effectively clears buffers to blank BLACK and makes it ready to display output. * This effectively clears buffers to blank BLACK and makes it ready to display output.
* (Brightness control via OE bit manipulation is another case) * (Brightness control via OE bit manipulation is another case)
*/ */
void clearFrameBuffer(); void clearFrameBuffer(bool _buff_id);
/* Update a specific pixel in the DMA buffer to a colour */ /* Update a specific pixel in the DMA buffer to a colour */
void updateMatrixDMABuffer(uint16_t x, uint16_t y, uint8_t red, uint8_t green, uint8_t blue); void updateMatrixDMABuffer(uint16_t x, uint16_t y, uint8_t red, uint8_t green, uint8_t blue);
@ -718,14 +707,12 @@ protected:
*/ */
inline void resetbuffers() inline void resetbuffers()
{ {
fb = &frame_buffer[0]; clearFrameBuffer(0);
clearFrameBuffer();
brtCtrlOEv2(brightness, 0); brtCtrlOEv2(brightness, 0);
if (m_cfg.double_buff) { if (m_cfg.double_buff) {
fb = &frame_buffer[1]; clearFrameBuffer(1);
clearFrameBuffer();
brtCtrlOEv2(brightness, 1); brtCtrlOEv2(brightness, 1);
} }
@ -855,7 +842,7 @@ private:
* Refer to rowBitStruct to get the idea of it's internal structure * Refer to rowBitStruct to get the idea of it's internal structure
*/ */
frameStruct frame_buffer[2]; frameStruct frame_buffer[2];
frameStruct *fb; // What framebuffer we are writing pixel changes to? (pointer to either frame_buffer[0] or frame_buffer[1] basically ) frameStruct *fb; // What framebuffer we are writing pixel changes to? (pointer to either frame_buffer[0] or frame_buffer[1] basically ) used within updateMatrixDMABuffer(...)
int back_buffer_id = 0; // If using double buffer, which one is NOT active (ie. being displayed) to write too? int back_buffer_id = 0; // If using double buffer, which one is NOT active (ie. being displayed) to write too?
int brightness = 128; // If you get ghosting... reduce brightness level. ((60/64)*255) seems to be the limit before ghosting on a 64 pixel wide physical panel for some panels. int brightness = 128; // If you get ghosting... reduce brightness level. ((60/64)*255) seems to be the limit before ghosting on a 64 pixel wide physical panel for some panels.