-
Notifications
You must be signed in to change notification settings - Fork 262
Scrolling Text and Fixed Text using double buffer #791
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
Comments
You could first scroll moving text, and then renew a fixed text. |
Hi @board707 , Thanks for the response. ` /**
#define VDISP_NUM_ROWS 2 // Number of rows of individual LED panels #define PANEL_CHAIN_LEN (VDISP_NUM_ROWS * VDISP_NUM_COLS) // Don't change /**
/**
**/ /**
// ------------------------------------------------------------------------------------------------------------ // --- Example 1: STANDARD 1/2 Scan --- // Declare a pointer to the specific instantiation: int16_t xOne, yOne; int16_t fxOne, fyOne; unsigned long isAnimationDue; // int textXPosition = PANEL_RES_X * PANEL_CHAIN_LEN; // Will start off screen // int textYPosition = PANEL_RES_Y / 2 - 8; // center of screen - 8 (half of the text height) uint16_t myBLACK = dma_display->color565(0, 0, 0); String scrollText = "Scroll Text"; void setup() { HUB75_I2S_CFG mxconfig( mxconfig.double_buff = true; dma_display = new MatrixPanel_I2S_DMA(mxconfig); virtualDisp = new VirtualMatrixPanel_T<PANEL_CHAIN_TYPE>(VDISP_NUM_ROWS, VDISP_NUM_COLS, PANEL_RES_X, PANEL_RES_Y); virtualDisp->setDisplay(*dma_display); virtualDisp->fillScreen(myBLACK); virtualDisp->setTextSize(1); // size 2 == 16 pixels high String scrollText1 = "ABC"; // scrollText1 = scrollText1.substring(0, scrollText1.length() - 1); void loop() { dma_display->flipDMABuffer(); unsigned long now = millis();
} virtualDisp->setCursor(0, textYPosition); // Serial.println("textXPosition + w"); // Serial.println("textXPosition"); |
Hi @mrcodetastic ,
I have the problem for Scrolling and Fixed Text using double buffer.
I don't want scroll text to overwrite fixed text when scroll text overlap with fixedtext.
any suggestion?
Thanks
`
#include <Arduino.h>
#include <ESP32-HUB75-VirtualMatrixPanel_T.hpp>
#include <Fonts/FreeSerifBold9pt7b.h>
/**
**/
#define PANEL_RES_X 64 // Number of pixels wide of each INDIVIDUAL panel module.
#define PANEL_RES_Y 32 // Number of pixels tall of each INDIVIDUAL panel module.
#define VDISP_NUM_ROWS 2 // Number of rows of individual LED panels
#define VDISP_NUM_COLS 2 // Number of individual LED panels per row
#define PANEL_CHAIN_LEN (VDISP_NUM_ROWS * VDISP_NUM_COLS) // Don't change
/**
**/
#define PANEL_CHAIN_TYPE CHAIN_TOP_RIGHT_DOWN
/**
**/
#define PANEL_SCAN_TYPE FOUR_SCAN_32PX_HIGH
/**
*/
MatrixPanel_I2S_DMA dma_display = nullptr;
// ------------------------------------------------------------------------------------------------------------
// --- Example 1: STANDARD 1/2 Scan ---
// Declare a pointer to the specific instantiation:
VirtualMatrixPanel_T<PANEL_CHAIN_TYPE>* virtualDisp = nullptr;
int16_t xOne, yOne;
uint16_t w, h;
int16_t fxOne, fyOne;
uint16_t fw, fh;
unsigned long isAnimationDue;
int delayBetweeenAnimations = 25; // Smaller == faster
// int textXPosition = PANEL_RES_X * PANEL_CHAIN_LEN; // Will start off screen
int textXPosition = 64 * 2; // Will start off screen
// int textYPosition = PANEL_RES_Y / 2 - 8; // center of screen - 8 (half of the text height)
int textYPosition = 8;
uint16_t myBLACK = dma_display->color565(0, 0, 0);
uint16_t myWHITE = dma_display->color565(255, 255, 255);
uint16_t myRED = dma_display->color565(255, 0, 0);
uint16_t myGREEN = dma_display->color565(0, 255, 0);
uint16_t myBLUE = dma_display->color565(0, 0, 255);
String scrollText = "Scroll Text";
String fixedText = "Fix";
void setup() {
Serial.begin(115200);
delay(2000);
HUB75_I2S_CFG mxconfig(
PANEL_RES_X,
PANEL_RES_Y,
PANEL_CHAIN_LEN
//, _pins
);
mxconfig.double_buff = true;
mxconfig.i2sspeed = HUB75_I2S_CFG::HZ_10M;
mxconfig.clkphase = false;
//mxconfig.driver = HUB75_I2S_CFG::FM6126A;
dma_display = new MatrixPanel_I2S_DMA(mxconfig);
dma_display->begin();
dma_display->setBrightness8(128); //0-255
dma_display->clearScreen();
virtualDisp = new VirtualMatrixPanel_T<PANEL_CHAIN_TYPE>(VDISP_NUM_ROWS, VDISP_NUM_COLS, PANEL_RES_X, PANEL_RES_Y);
virtualDisp->setDisplay(*dma_display);
virtualDisp->clearScreen();
virtualDisp->fillScreen(myBLACK);
virtualDisp->setTextSize(1); // size 2 == 16 pixels high
virtualDisp->setTextWrap(false); // N.B!! Don't wrap at end of line
virtualDisp->setTextColor(myRED);
String scrollText1 = "ABC";
Serial.println(scrollText1);
// virtualDisp->setFont(&FreeSerifBold9pt7b);
// scrollText1 = scrollText1.substring(0, scrollText1.length() - 1);
// Serial.println(scrollText1);
// scrollText1 = scrollText1.substring(0, scrollText1.length() - 1);
// Serial.println(scrollText1);
}
void loop() {
dma_display->flipDMABuffer();
delay(1000 / dma_display->calculated_refresh_rate);
dma_display->clearScreen();
delay(25);
virtualDisp->setCursor(0, textYPosition);
virtualDisp->print(fixedText);
unsigned long now = millis();
if (now > isAnimationDue) {
isAnimationDue = now + delayBetweeenAnimations;
textXPosition -= 1;
}
// Serial.println("textXPosition + w");
// Serial.println(textXPosition + w);
// Serial.println("textXPosition");
// Serial.println(textXPosition);
// Serial.println("textYPosition");
// Serial.println(textYPosition);
}`
WhatsApp.Video.2025-05-07.at.14.27.07.mp4
The text was updated successfully, but these errors were encountered: