FPS counter do not show


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

I´m using ESP32 with Arduino IDE, lvgl library v7.8, lvgl examples v7.8

What do you experience?

I´m using 7" screen (SSD1963) which does work. I can so far compile just widget demo, but that it is OK for now.

I want to know how many FPS ESP32 can do with this screen, but FPS does not show up at the bottom. I changed lv_conf.h to #define LV_USE_PERF_MONITOR 1 but that does not help.

Is there anything else which I should enable to make this work?

Code to reproduce

#include <lvgl.h>
#include <lv_examples.h>
#include <TFT_eSPI.h>
#include <XPT2046_Touchscreen.h> // ThingPulse library from Library Manager
#include <SPI.h>

TFT_eSPI tft = TFT_eSPI(); /* TFT instance */
#define CS_PIN  21
XPT2046_Touchscreen ts(CS_PIN);  // Param 2 - NULL - No interrupts
//Define Touch-Parameters

#define TS_MINX 240
#define TS_MINY 315
#define TS_MAXX 4095
#define TS_MAXY 4095

#define XPT2046_HOR_RES 800
#define XPT2046_VER_RES 480

static lv_disp_buf_t disp_buf;
static lv_color_t buf[LV_HOR_RES_MAX * 10];

#if USE_LV_LOG != 0
/* Serial debugging */
void my_print(lv_log_level_t level, const char * file, uint32_t line, const char * dsc)

  Serial.printf("%s@%d->%s\r\n", file, line, dsc);

/* Display flushing */
void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p)
  uint32_t w = (area->x2 - area->x1 + 1);
  uint32_t h = (area->y2 - area->y1 + 1);

  tft.setAddrWindow(area->x1, area->y1, w, h);
  tft.pushColors(&color_p->full, w * h, true);


bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data)
  int16_t touchX, touchY;
  bool touched = false;
  //bool touched = touch.getXY(touchX, touchY);  //  bool TFT_eTouch<T>::getXY(int16_t& x, int16_t& y)

  TS_Point p = ts.getPoint();

  touchX = map(p.x, TS_MINX, TS_MAXX, 0, XPT2046_HOR_RES);
  touchY = map(p.y, TS_MINY, TS_MAXY, 0, XPT2046_VER_RES);

  //touchX = p.x;
  //touchY = p.y;

  //  if ((touchX > 0) || (touchY > 0)) {
  if (p.z > 1800) {
    touched = true;

  if (!touched)
    data->state = LV_INDEV_STATE_REL;
    return false;
    data->state = LV_INDEV_STATE_PR;

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

    Serial.print("Data X: ");

    Serial.print(", data Y: ");

  return false; /*Return `false` because we are not buffering and no more data to read*/

void setup()
  Serial.begin(115200); /* prepare for possible serial debug */
  Serial.println("Start of the setup..");

#if USE_LV_LOG != 0
  lv_log_register_print_cb(my_print); /* register print function for debugging */
  Serial.println("Touch started..");
  tft.begin(); /* TFT init */
  tft.setRotation(1); /* Landscape orientation */
  Serial.println("LCD started..");

  //uint16_t calData[5] = { 275, 3620, 264, 3532, 1 };

  lv_disp_buf_init(&disp_buf, buf, NULL, LV_HOR_RES_MAX * 10);

  /*Initialize the display*/
  lv_disp_drv_t disp_drv;
  disp_drv.hor_res = XPT2046_HOR_RES;
  disp_drv.ver_res = XPT2046_VER_RES;
  disp_drv.flush_cb = my_disp_flush;
  disp_drv.buffer = &disp_buf;

  /*Initialize the (dummy) input device driver*/

  lv_indev_drv_t indev_drv;
  indev_drv.type = LV_INDEV_TYPE_POINTER;
  indev_drv.read_cb = my_touchpad_read;

  /* Try an example from the lv_examples repository
     https://github.com/lvgl/lv_examples */
  Serial.println("End of the setup..");

void loop()
  lv_tick_inc(10); // I had to add this to make my touchpad work
  lv_task_handler(); /* let the GUI do its work */

Many thanks for answer :slightly_smiling_face: .

That’s all you should need to enable; I would check that you are editing the right lv_conf.h file and that your build system picks up on header changes. Perhaps try cleaning and rebuilding the project.

Thanks, you were right :man_facepalming:, I was using wrong lv_conf.h file.

FPS counter is already at bottom corner. :slightly_smiling_face:.

I have still one small problem.

I have screen with paralllel connection so I have to use external library for touchscreen. If I load example from touch library, I get XY cord from whole screen, but if I load my sketch with LVGL, I can read just about 3/4 of the screen. I looked through forum and found this topic where is link to the lv_drv_conf.h where is default value for touchscreen 480x320px (here) and my question is if I can change this resolution within some config in Arduino or if I have to incorporate lv_drivers repo to my library files so I can include this config to my sketch? If so, how can I do that? Just download repo, unzip it and paste to the library folder?

Many thanks for your help.

It depends on what driver you are using for touch; you would have to look inside your project and see if there is any XPT2046 configuration file.

I´m using XPT2046_Touchscreen library and I already looked, but there is no size definition. As I mentioned already, I can read touch everywhere with example from touch library so I do not think there is problem with touch library.