lvgl: LVGL V8 slow - seems to have a Tick bug.
Perform all steps below and tick them with [x]
- [ X ] Check the related part of the Documentation
- [ X ] Update lvgl to the latest version
- Reproduce the issue in a Simulator
Describe the bug
LVGL Runs very slow. At one point, my clicking actions were delayed by almost a full minute! I have the click tied to a Serial.print so I clicked 3 times and waited, after about 1 minute the 3 clicks came in. Most of the time it is only a little bit slow with a slight delay. This works 100% perfectly on LVGL V7, been running very advanced graphics for over a year on this hardware.
To Reproduce
IMPORTANT. To reproduce this you need a display. I’m using this library with DMA: https://github.com/david-res/ILI948x_t4_mm
This is not a bug regarding that library. It works fine on LVGL V7.
#include <Arduino.h>
#include "ILI948x_t4_mm.h"
ILI948x_t4_mm lcd = ILI948x_t4_mm(17, 16, 5); //(dc, cs, rst)
static void lv_tick_handler(void)
{
lv_tick_inc(LVGL_TICK_PERIOD);
}
FASTRUN void my_flush_cb(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p)
{
/*The most simple case (but also the slowest) to put all pixels to the screen one-by-one
*`put_px` is just an example, it needs to implemented by you.*/
lcd.pushPixels16bitDMA((uint16_t*)(color_p),area->x1, area->y1, area->x2, area->y2);
/* IMPORTANT!!!
* Inform the graphics library that you are ready with the flushing*/
//lv_disp_flush_ready(disp_drv);
}
FASTRUN void flushCB()
{
lv_disp_flush_ready(&disp_drv);
}
FASTRUN bool touch_glass_input(lv_indev_drv_t * drv, lv_indev_data_t*data) {
int XL = 0;
int XH = 0;
int YL = 0;
int YH = 0;
int tStatus = 0;
XH = readTouchReg(TOUCH_REG_XH);
XL = readTouchReg(TOUCH_REG_XL);
YH = readTouchReg(TOUCH_REG_YH);
YL = readTouchReg(TOUCH_REG_YL);
// TOUCH INPUT, MAPPED FOR LANDSCAPE
int x = ((XH & 0x0F) << 8) | XL;
int y = ((YH & 0x0F) << 8) | YL;
data->point.x = map(y, 0, 480, 480, 0);
data->point.y = x;
tStatus = XH>>6;
if (tStatus == 1) {
data->state = LV_INDEV_STATE_REL;
} else {
data->state = LV_INDEV_STATE_PR;
}
//data->state = LV_INDEV_STATE_PR; // or LV_INDEV_STATE_REL;
return false; /*No buffering now so no more data read*/
}
void setup() {
Serial.begin(115200);
//FreqMeasure.begin();
Serial.print(CrashReport);
pinMode(12, OUTPUT);
pinMode(14, OUTPUT);
digitalWrite(12, HIGH);
digitalWrite(14, HIGH);
init_touch();
lcd.begin(20);
lcd.setRotation(3);
lcd.onCompleteCB(&flushCB);
lcd.setFrameRate(68);
lv_init();
lv_disp_draw_buf_init(&disp_buf, buf_1, NULL, screenWidth * screenHeight /4);
// INIT THE DISPLAY DRIVERS
lv_disp_drv_init(&disp_drv); /*Basic initialization*/
disp_drv.draw_buf = &disp_buf; /*Set an initialized buffer*/
disp_drv.flush_cb = my_flush_cb; /*Set a flush callback to draw to the display*/
disp_drv.hor_res = screenWidth; /*Set the horizontal resolution in pixels*/
disp_drv.ver_res = screenHeight; /*Set the vertical resolution in pixels*/
lv_disp_t * disp;
disp = lv_disp_drv_register(&disp_drv); /*Register the driver and save the created display objects*/
// REGISTER THE TOUCH INPUT DRIVER
static lv_indev_drv_t indev_drv;
lv_indev_drv_init(&indev_drv); /*Basic initialization*/
indev_drv.type = LV_INDEV_TYPE_POINTER; /*See below.*/
indev_drv.read_cb = touch_glass_input; /*See below.*/
/*Register the driver in LVGL and save the created input device object*/
lv_indev_t * my_indev = lv_indev_drv_register(&indev_drv);
// MAIN SCREEN
gaugeScreen = lv_obj_create(lv_scr_act());
// SETTINGS ICON
// SETTINGS ICON BOTTOM LEFT
settingsBtnCont = lv_btn_create(gaugeScreen);
//lv_obj_remove_style_all(settingsBtnCont);
lv_obj_add_event_cb(settingsBtnCont, event_handler, LV_EVENT_ALL, NULL);
lv_obj_set_size(settingsBtnCont, 80, 80);
lv_obj_align(settingsBtnCont, LV_ALIGN_BOTTOM_LEFT, 50, -50);
// SETTINGS SYMBOL VARIABLE
//settingsBtn = lv_label_create(settingsBtnCont);
//lv_label_set_text_static(settingsBtn, LV_SYMBOL_SETTINGS);
loadStyles();
}
const int loopDelay1 = 1; // Make a request every 500ms
unsigned long timeNow1 = 0;
void loop() {
if (millis() > timeNow1 + loopDelay1) {
lv_tick_handler();
lv_timer_handler();
timeNow1 = millis();
}
}
Expected behavior
Real time, butter smooth. Screen is running DMA on a Teensy Micromod at 600mhz. We get above 70fps. Works perfectly in LVGL V7.
Screenshots or video
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 19 (9 by maintainers)
Are there any warnings?
What if you replace
LV_LOG_USER
withprintf
?I can confirm this happens to me with the same hardware/code setup