Screen keeps auto-scrolling

Description

I am running simple code Using LVGL which is a counter. My screen freezes and doesnt change the numbers so i tried removing the lv_timer_handler() from the loop function. now the screen autoscrolls but the counter is seen to be updating as the screen scroll.

What MCU/Processor/Board and compiler are you using?

I am using Waveshare 4.3 esp32s3 with ST7262 graphics driver with touch driver GT911

What do you want to achieve?

I want the screen to update normally and work so that i can display changing variables on it

Code to reproduce

#include <Arduino.h>
#include <ESP_Panel_Library.h>
#include <lvgl.h>
#include "lvgl_port_v8.h"

#define LVGL_PORT_DISP_BUFFER_NUM 2
#define LVGL_PORT_RGB_BOUNCE_BUFFER_SIZE (800 * 10) // Buffer size for 10 rows

lv_obj_t *label;
int counter = 1; // Start from 1

// Function to update the counter
void update_counter(lv_timer_t * timer)
{
    // Update the counter and label text
    char buf[8];
    snprintf(buf, sizeof(buf), "%d", counter);
    lv_label_set_text(label, buf);
    
    // Increment the counter and reset if needed
    counter++;
    if (counter > 100) {
        counter = 1; // Reset counter to 1
    }
}

void setup()
{
    Serial.begin(115200);
    Serial.println("Starting setup...");

    ESP_Panel *panel = new ESP_Panel();
    Serial.println("Initializing panel...");
    panel->init();

#if LVGL_PORT_AVOID_TEAR
    // Ensure RGB bus configurations are correctly set
    ESP_PanelBus_RGB *rgb_bus = static_cast<ESP_PanelBus_RGB *>(panel->getLcd()->getBus());
    if (rgb_bus) {
        rgb_bus->configRgbFrameBufferNumber(LVGL_PORT_DISP_BUFFER_NUM);
        rgb_bus->configRgbBounceBufferSize(LVGL_PORT_RGB_BOUNCE_BUFFER_SIZE);
        Serial.println("Configured RGB bus.");
    } else {
        Serial.println("Failed to get RGB bus.");
    }
#endif

    panel->begin();
    Serial.println("Initializing LVGL port...");
    lvgl_port_init(panel->getLcd(), NULL); // No touch

    lvgl_port_lock(-1);

    // Create a label to display the counter
    label = lv_label_create(lv_scr_act());
    lv_obj_align(label, LV_ALIGN_CENTER, 0, 0);
    lv_label_set_text(label, "1"); // Set initial text

    // Create a timer to update the counter every 100ms
    lv_timer_create(update_counter, 100, NULL);

    lvgl_port_unlock();

    Serial.println("Setup complete.");
}

void loop()
{
    lv_timer_handler(); // Let the GUI do its work
    delay(5);
}

I can also share my set-up files if necessary.

I am also facing similar problems.

I have set lv config to custom timer and increase memory and buffer sizes.

If I call lv timer handler from within my main loop the screen freezes and becomes non functional.

If I call it once then everything works as normal but after 5 mins the display starts to scroll down the screen and bleed from top. but all my labels still update, and although my button are no longer in the correct position, they still register touch from there original position.

To me this seems to be a screen refresh / redraw problem that does not start at 0,0 like it should

I’m experiencing this (or a similar) drifting problem with waveshare 5" touchscreen display. It uses the same GT911 driver and ST7262 lcd.

The issue is that when I touch buttons, the screen scrolls vertically downwards at random and wraps around on itself. It seems to happen slightly less when there are fewer/smaller objects on the screen.

When I disable LVGL_PORT_AVOID_TEAR interestingly it scrolls in the horizontal direction instead. I agree it seems like an issue with the RGB driver, probably something related to buffer size considering that’s the only thing that avoid_tear defintion is calling.

edit: I partially fixed the issue by changing the bounce buffer size. Instead of display width * 10, i changed it to display width *12 like below

#define LVGL_PORT_RGB_BOUNCE_BUFFER_SIZE (LVGL_PORT_DISP_WIDTH * 12)

this can seemingly handle a few buttons, but the issue comes back when I run the keypad example which has 12 buttons

hi all,

I have exactly same problem with my Waveshare 4.3 esp32s3. Du you have some hint or resolution for this?

Even change of multiplier from 10 to 12 does not change behavior.

Thanks.

here i found fresh solution, works for me LVGL roller scrolls the whole screen vertically during scroll · Issue #7156 · lvgl/lvgl · GitHub