I am puzzeled with the output of my code
It should cover the whole screen but I get this white are on the top
LVGL 8.3.8 on ESP32 dev kit
include <lvgl.h>
#include <TFT_eSPI.h>
#include “touch.h”
static const uint16_t screenWidth = 480;
static const uint16_t screenHeight = 320;
static lv_disp_draw_buf_t disp_buf;
static lv_color_t buf[screenWidth*20];
TFT_eSPI tft = TFT_eSPI();
/* 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((uint16_t *)&color_p->full, w*h, true);
/*Change the active screen's background color*/
lv_obj_set_style_bg_color(lv_scr_act(), lv_color_hex(0x1f272a), LV_PART_MAIN);
lv_disp_flush_ready(disp);
}
void setup()
{
Serial.begin(115200); /* prepare for possible serial debug */
tft.init();
tft.setRotation(1);
touch_init(tft.width(), tft.height(),tft.getRotation());
lv_init();
delay(10);
lv_disp_draw_buf_init(&disp_buf, buf, NULL, screenWidth*20);
/*Initialize the display*/
static lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv);
disp_drv.hor_res = tft.width();
disp_drv.ver_res = tft.height();
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &disp_buf;
lv_disp_drv_register(&disp_drv);
}
void loop()
{
lv_task_handler(); /* let the GUI do its work */
delay(5);
}