aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormrfaptastic <12006953+mrfaptastic@users.noreply.github.com>2023-03-21 23:05:14 +0000
committermrfaptastic <12006953+mrfaptastic@users.noreply.github.com>2023-03-21 23:05:14 +0000
commit93b36adf7219cb19b216863895d95a06b680708f (patch)
tree513dfc41a78f09be56f9caa08fed922edd334a5e /src
parent1ac5a2209ed545f8dc3f3b1c885ac202ca7dbe4b (diff)
Fix #426
Diffstat (limited to 'src')
-rw-r--r--src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp18
-rw-r--r--src/ESP32-HUB75-MatrixPanel-I2S-DMA.h35
2 files changed, 22 insertions, 31 deletions
diff --git a/src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp b/src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp
index 9539a92..937a20d 100644
--- a/src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp
+++ b/src/ESP32-HUB75-MatrixPanel-I2S-DMA.cpp
@@ -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/ */
uint16_t red16, green16, blue16;
#ifndef NO_CIE1931
- red16 = lumConvTab[red];
- green16 = lumConvTab[green];
- blue16 = lumConvTab[blue];
+ red16 = lumConvTab[red];
+ green16 = lumConvTab[green];
+ blue16 = lumConvTab[blue];
#else
- red16 = red << 8;
- green16 = green << 8;
- blue16 = blue << 8;
+ red16 = red << 8;
+ green16 = green << 8;
+ blue16 = blue << 8;
#endif
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.
* (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)
return;
+ frameStruct *fb = &frame_buffer[_buff_id];
+
// we start with iterating all rows in dma_buff structure
int row_idx = fb->rowBits.size();
do
@@ -615,6 +617,8 @@ void MatrixPanel_I2S_DMA::brtCtrlOEv2(uint8_t brt, const int _buff_id)
if (!initialized)
return;
+ frameStruct *fb = &frame_buffer[_buff_id];
+
uint8_t _blank = m_cfg.latch_blanking; // don't want to inadvertantly blast over this
uint8_t _depth = fb->rowBits[0]->colour_depth;
uint16_t _width = fb->rowBits[0]->width;
diff --git a/src/ESP32-HUB75-MatrixPanel-I2S-DMA.h b/src/ESP32-HUB75-MatrixPanel-I2S-DMA.h
index 2e2c3a9..e132b53 100644
--- a/src/ESP32-HUB75-MatrixPanel-I2S-DMA.h
+++ b/src/ESP32-HUB75-MatrixPanel-I2S-DMA.h
@@ -29,9 +29,6 @@
// #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.
*
* This library has been tested with a 64x32 and 64x64 RGB panels.
@@ -598,20 +595,14 @@ public:
{
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);
+
+ back_buffer_id ^= 1;
+ fb = &frame_buffer[back_buffer_id];
+
- back_buffer_id ^= 1;
-
+
}
/**
@@ -625,13 +616,11 @@ public:
return;
}
- fb = &frame_buffer[0];
brightness = b;
brtCtrlOEv2(b, 0);
if (m_cfg.double_buff)
{
- fb = &frame_buffer[1];
brtCtrlOEv2(b, 1);
}
}
@@ -705,7 +694,7 @@ protected:
* This effectively clears buffers to blank BLACK and makes it ready to display output.
* (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 */
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()
{
- fb = &frame_buffer[0];
- clearFrameBuffer();
+ clearFrameBuffer(0);
brtCtrlOEv2(brightness, 0);
if (m_cfg.double_buff) {
-
- fb = &frame_buffer[1];
- clearFrameBuffer();
+
+ clearFrameBuffer(1);
brtCtrlOEv2(brightness, 1);
}
@@ -855,7 +842,7 @@ private:
* Refer to rowBitStruct to get the idea of it's internal structure
*/
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 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.