You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I managed to get the display and touch working with LVGL 8.3.11, but the problem is that the screen area glitches when text changes, animations occur, etc. How can I solve this?
#include<lvgl.h>#include<Arduino_GFX_Library.h>#include"Arduino_DriveBus_Library.h"#include"pin_config.h"#include<ui.h>// Initialize the data bus for the displayArduino_DataBus*bus=newArduino_ESP32QSPI(
LCD_CS/* CS */, LCD_SCLK/* SCK */, LCD_SDIO0/* SDIO0 */, LCD_SDIO1/* SDIO1 */,
LCD_SDIO2/* SDIO2 */, LCD_SDIO3/* SDIO3 */);
// Initialize the display with no rotation and no IPS modeArduino_GFX*gfx=newArduino_CO5300(bus, LCD_RST/* RST */,
0/* rotation */, false /* IPS */, LCD_WIDTH, LCD_HEIGHT,
20/* col offset 1 */, 0/* row offset 1 */, 0/* col_offset2 */, 0/* row_offset2 */);
// Initialize the I2C bus for touch
std::shared_ptr<Arduino_IIC_DriveBus>IIC_Bus=std::make_shared<Arduino_HWIIC>(IIC_SDA, IIC_SCL, &Wire);
voidArduino_IIC_Touch_Interrupt(void);
// Initialize touch controller
std::unique_ptr<Arduino_IIC>FT3168(newArduino_CST816x(IIC_Bus, FT3168_DEVICE_ADDRESS,
DRIVEBUS_DEFAULT_VALUE, TP_INT, Arduino_IIC_Touch_Interrupt));
// Interrupt handling for touchvoidArduino_IIC_Touch_Interrupt(void)
{
FT3168->IIC_Interrupt_Flag= true;
}
// LVGL buffer and driver setupstaticlv_disp_draw_buf_tdraw_buf;
staticlv_color_tbuf[LCD_WIDTH*LCD_HEIGHT / 2]; // Larger buffer for better performance// Display flush function for LVGLvoidmy_disp_flush(lv_disp_drv_t*disp, constlv_area_t*area, lv_color_t*color_p)
{
int32_tw= (area->x2-area->x1+1);
int32_th= (area->y2-area->y1+1);
// Use draw16bitRGBBitmap() to draw the pixel datagfx->startWrite();
gfx->draw16bitRGBBitmap(area->x1, area->y1, (uint16_t*)color_p, w, h);
gfx->endWrite();
lv_disp_flush_ready(disp); // Indicate that flushing is done
}
// Touchpad read function for LVGLvoidtouchpad_read(lv_indev_drv_t*indev_driver, lv_indev_data_t*data)
{
if (FT3168->IIC_Interrupt_Flag== true)
{
FT3168->IIC_Interrupt_Flag= false;
inttouch_x=FT3168->IIC_Read_Device_Value(FT3168->Arduino_IIC_Touch::Value_Information::TOUCH_COORDINATE_X);
inttouch_y=FT3168->IIC_Read_Device_Value(FT3168->Arduino_IIC_Touch::Value_Information::TOUCH_COORDINATE_Y);
data->state=LV_INDEV_STATE_PR;
data->point.x=touch_x;
data->point.y=touch_y;
}
else
{
data->state=LV_INDEV_STATE_REL;
}
}
voidsetup()
{
Serial.begin(115200);
Serial.println("Starting Setup...");
// Ensure the display is enabledpinMode(LCD_EN, OUTPUT);
digitalWrite(LCD_EN, HIGH);
// Initialize the displaySerial.println("Initializing Display...");
gfx->begin();
gfx->fillScreen(BLACK);
gfx->Display_Brightness(255);
// Initialize LVGLSerial.println("Initializing LVGL...");
lv_init();
// Initialize display bufferlv_disp_draw_buf_init(&draw_buf, buf, NULL, LCD_WIDTH*LCD_HEIGHT / 2);
// Initialize display driverstaticlv_disp_drv_tdisp_drv;
lv_disp_drv_init(&disp_drv);
disp_drv.hor_res=LCD_WIDTH;
disp_drv.ver_res=LCD_HEIGHT;
disp_drv.flush_cb=my_disp_flush;
disp_drv.draw_buf=&draw_buf;
lv_disp_drv_register(&disp_drv);
Serial.println("Display driver registered.");
// Initialize touch input driverFT3168->begin();
Serial.println("Touch Input Initialized");
staticlv_indev_drv_tindev_drv;
lv_indev_drv_init(&indev_drv);
indev_drv.type=LV_INDEV_TYPE_POINTER;
indev_drv.read_cb=touchpad_read;
lv_indev_drv_register(&indev_drv);
Serial.println("Touch input driver registered.");
// Initialize the user interfaceui_init();
}
voidloop()
{
lv_task_handler(); // Efficiently handle LVGL tasksdelay(5); // Experiment with minimal delay for smoother UI updates
}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi, I managed to get the display and touch working with LVGL 8.3.11, but the problem is that the screen area glitches when text changes, animations occur, etc. How can I solve this?
CPU usage and FPS count is glitching. UI is simple LVGL color wheel and slider. See this
https://github.com/user-attachments/assets/d213e5a6-7717-4582-8955-5f17e5941fda
Beta Was this translation helpful? Give feedback.
All reactions