Getting LVGL V9.2.0 working with TFT_eSPI and ILI9488 screen ESP32 Elecrow HMI TFT screen

Description - loads of compile errors, been on this 2 weeks.

What MCU/Processor/Board and compiler are you using? ESP32 Arduino IDE 2.3.2

LVGL v9

To show a simple UI on the Elecrow HMI esp32 touch screen

Used the Arduino example code

Code to reproduce

#include <lvgl.h>
#include <TFT_eSPI.h>
// //********************************************************************************************
// // add these includes and any others .h files that have been generated fms
// #include “actions.h”
// #include “eez-flow.h”
// #include “fonts.h”
// #include “images.h”
// #include “screens.h”
// #include “structs.h”
// #include “styles.h”
// #include “ui.h”
// #include “vars.h”
// //********************************************************************************************

/Set to your screen resolution/
#define TFT_HOR_RES 480
#define TFT_VER_RES 320

/LVGL draw into this buffer, 1/10 screen size usually works well. The size is in bytes/
#define DRAW_BUF_SIZE (TFT_HOR_RES * TFT_VER_RES / 10 * (LV_COLOR_DEPTH / 8))

TFT_eSPI tft = TFT_eSPI(TFT_HOR_RES, TFT_VER_RES); /* TFT instance */

/Set the touchscreen calibration data,
the actual data for your display can be acquired using
the Generic → Touch_calibrate example from the TFT_eSPI library
/
uint16_t calData[5] = { 311, 3570, 279, 3466, 7 }; // use the touch calibrate in tft_espi examples //fms

#if LV_USE_LOG != 0
void my_print(lv_log_level_t level, const char *buf) {
LV_UNUSED(level);
Serial.println(buf);
Serial.flush();
}
#endif

/* LVGL calls it when a rendered image needs to copied to the display*/
/* Display flushing /
void my_disp_flush(lv_display_t
display, const lv_area_t* area, unsigned char* data) {

uint32_t w = lv_area_get_width(area);
uint32_t h = lv_area_get_height(area);
lv_draw_sw_rgb565_swap(data, w*h);

    if (tft.getStartCount() == 0)
    {   // Processing if not yet started
         tft.startWrite();
    }
    tft.pushImageDMA( area->x1
            , area->y1
            , area->x2 - area->x1 + 1
            , area->y2 - area->y1 + 1
            ,(uint16_t*) data); 

    lv_display_flush_ready(display);
}

/Read the touchpad/
void my_touchpad_read(lv_indev_drv_t *indev_drv, lv_indev_data_t *data) {
static uint16_t touchX, touchY;

bool touched = tft.getTouch(&touchX, &touchY, 600);

if (!touched) {
data->state = LV_INDEV_STATE_REL;
} else {
data->state = LV_INDEV_STATE_PR;

/*Set the coordinates*/
data->point.x = touchX;
data->point.y = touchY;

//     Serial.print( "Data x " );  //fms
//     Serial.println( touchX );

//     Serial.print( "Data y " );
//     Serial.println( touchY );

}
}

//lv_indev_t *indev; //Touchscreen input device
uint8_t *draw_buf; //draw_buf is allocated on heap otherwise the static area is too big on ESP32 at compile
uint32_t lastTick = 0; //Used to track the tick timer

void setup() {

//Some basic info on the Serial console
String LVGL_Arduino = "LVGL demo ";
LVGL_Arduino += String(‘V’) + lv_version_major() + “.” + lv_version_minor() + “.” + lv_version_patch();

Serial.begin(115200);
Serial.println(LVGL_Arduino);

//Initialise the touchscreen
tft.begin(); /* TFT init */
tft.fillScreen(TFT_BLACK);
delay(300);
tft.setTouch(calData);
//Backlight Pins
pinMode(27, OUTPUT);
digitalWrite(27, HIGH); // make sure tft is backlit

tft.setRotation(1); /* Landscape orientation, flipped fms was 3*/

//Initialise LVGL GUI
lv_init();

draw_buf = new uint8_t[DRAW_BUF_SIZE];
lv_display_t *disp;
disp = lv_tft_espi_create(TFT_HOR_RES, TFT_VER_RES, draw_buf, DRAW_BUF_SIZE);

//Initialize the XPT2046 input device driver
indev = lv_indev_create();
lv_indev_set_type(indev, LV_INDEV_TYPE_POINTER);
lv_indev_set_read_cb(indev, my_disp_flush);

//Done
Serial.println(“LVGL Setup done”);

//Integrate EEZ Studio GUI
ui_init();

}

void loop() {
lv_tick_inc(millis() - lastTick); //Update the tick timer. Tick is new for LVGL 9
lastTick = millis();
lv_timer_handler(); //Update the UI
ui_tick();
//delay(5);
}

The code block(s) should be formatted like:

/*You code here*/

Screenshot and/or video

If possible, add screenshots and/or videos about the current state.

@andy0909
I am also facing the same issue with the LVGL9.X series. LVGL 9.X series has major changes from the LVGL8.3 series. Due to this I’m not able to proceed further. So I have used the 8.3 version and resolved the conflicts and working fine. Are you intend to use the LVGL9.X series? if not you can go with the 8.3 series. I too try to resolve that errors If I cracked it, I’ll share it here.

If you try and face any issue in the 8.3 series share the details here I can try to share my thoughts.
Thank you

Hi,
My project works in elecrow 3.2 TFT without problems.

If you need something , let me know

Hi are you able to post your code. I been trying to use LVGL 9 for 3 weeks now. I have two pages and when they change the screen refreshes in sections

Hi i did get an version of LVGL 8.x working but i am stuck with 9. I have two pages and two buttons that change the screen. But when the screen change it refreshes in sections

Hi , you can find here

Thank you. that code is way above my head. I have this tft

do you think you code will run on it. I dont really need to use the GPS and all that just would like to see what on the screen. then look through your code in detail to see how you structure the code. My arduino basic codes i am used to only having one large file

before you posted this i now do have my tft working with LVGL 9. Its been a big uphill struggle but i am there. I am just making a basic UI with buttons using EEZ Studio. I hope to have my TFT talk to another ESP32 via ESP NOW. the second ESP will then drive 3 stepper motor on a camera slider. Well thats my long term goal