Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update 3.0.7 broke double buffer again #426

Closed
primus192 opened this issue Mar 21, 2023 · 5 comments
Closed

Update 3.0.7 broke double buffer again #426

primus192 opened this issue Mar 21, 2023 · 5 comments

Comments

@primus192
Copy link

Using double buffer on 3.0.7 update occurs with turning off the screen every second time i call it. It works perfectly on 3.0.6

@mrcodetastic
Copy link
Owner

Got a simple test sketch to demo?

@primus192
Copy link
Author

On 3.0.6 it is smooth without flicker. On 3.0.7 this is flashy and screen wipes.

#include <Arduino.h>
#define R1_PIN 0 //25
#define G1_PIN 18 //33
#define B1_PIN 2
#define R2_PIN 14
#define G2_PIN 12
#define B2_PIN 13
#define A_PIN 23
#define B_PIN 19
#define C_PIN 5
#define D_PIN 17
#define E_PIN 32
#define LAT_PIN 4
#define OE_PIN 15
#define CLK_PIN 16
#define BUTTON 39
/*--------------------- MATRIX LILBRARY CONFIG -------------------------*/
#define SERPENT true
#define TOPDOWN false
#define NUM_ROWS 2
#define NUM_COLS 3
#define PANEL_RES_X 64     // Number of pixels wide of each INDIVIDUAL panel module. 
#define PANEL_RES_Y 64     // Number of pixels tall of each INDIVIDUAL panel module.
#define PANEL_CHAIN NUM_ROWS*NUM_COLS      // Total number of panels chained one to another
//#define VIRTUAL_MATRIX_CHAIN_TYPE CHAIN_TOP_RIGHT_DOWN
#define VIRTUAL_MATRIX_CHAIN_TYPE CHAIN_TOP_LEFT_DOWN
  /* Configure the serpetine chaining approach. Options are:
        CHAIN_TOP_LEFT_DOWN
        CHAIN_TOP_RIGHT_DOWN
        CHAIN_BOTTOM_LEFT_UP
        CHAIN_BOTTOM_RIGHT_UP
*/

#include <ESP32-VirtualMatrixPanel-I2S-DMA.h>
void redrawMatrix(bool pattern);
MatrixPanel_I2S_DMA* dma_display = nullptr;
VirtualMatrixPanel* virtualDisp = nullptr;

void setup() {
        HUB75_I2S_CFG::i2s_pins _pins = { R1_PIN, G1_PIN, B1_PIN, R2_PIN, G2_PIN, B2_PIN, A_PIN, B_PIN, C_PIN, D_PIN, E_PIN, LAT_PIN, OE_PIN, CLK_PIN };
        HUB75_I2S_CFG mxconfig(
            PANEL_RES_X,   // width
            PANEL_RES_Y,   // height
            PANEL_CHAIN,   // chain length
            _pins,   // pin mapping
            HUB75_I2S_CFG::FM6124      // driver chip
        );
        mxconfig.i2sspeed = mxconfig.HZ_20M;
        mxconfig.min_refresh_rate = 10;
        mxconfig.double_buff = true;
        mxconfig.setPixelColorDepthBits(3);
        dma_display = new MatrixPanel_I2S_DMA(mxconfig);
        dma_display->begin();
        virtualDisp = new VirtualMatrixPanel((*dma_display), NUM_ROWS, NUM_COLS, PANEL_RES_X, PANEL_RES_Y, VIRTUAL_MATRIX_CHAIN_TYPE);
        redrawMatrix(true);
}

void redrawMatrix(bool pattern) {
    dma_display->setBrightness8(255);
    virtualDisp->clearScreen();
    virtualDisp->setCursor(0,0);
    if(pattern) {
        virtualDisp->print("first buffer");
    } else {
        virtualDisp->print("second buffer");
    }
    delay(100);
    virtualDisp->flipDMABuffer();
}

void loop() {
    redrawMatrix(true);
    delay(1000);
    redrawMatrix(false);
    delay(1000);
}

@mrcodetastic
Copy link
Owner

Thanks for the test script. Super useful to find a stupid regression.

Let me know if this is ok. Will push a new version and not touch this library anymore for a while.

@primus192
Copy link
Author

All gucci

@EclipseBoom
Copy link

This works. Thanks.

Now I just need to figure out why my sketch doesn't act like that...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants