7" ESP32 display issue PlatformIO

Hey guys!

I need your help. I have been trying to solve that puzzle since yesterday morning, but still have some issues.

Few days ago I've got https://www.elecrow.com/esp32-display-7-inch-hmi-display-rgb-tft-lcd-touch-screen-support-lvgl.html?ann 7 inch ESP32 display. I had been using that manual: https://www.elecrow.com/wiki/index.php?title=ESP32_Display_7.0%27%27_Intelligent_Touch_Screen_Wi-Fi%26BLE_800*480_HMI_Display#Play_with_PlatformIO At the bottom of the page is "PlatformIO_7inch.zip". I downloaded it, then step by step as in instruction set up the whole project, but at the end I've got that issue:


Compiling .pio\build\esp32-s3-devkitc-1-myboard\lib377\lvgl\draw\sdl\lv_draw_sdl_bg.c.o

src/main.cpp:39:1: error: 'Arduino_ESP32RGBPanel' does not name a type; did you mean 'Arduino_ESP32SPI'?

 Arduino_ESP32RGBPanel *bus = new Arduino_ESP32RGBPanel(

 ^~~~~~~~~~~~~~~~~~~~~

 Arduino_ESP32SPI

Compiling .pio\build\esp32-s3-devkitc-1-myboard\lib377\lvgl\draw\sdl\lv_draw_sdl_composite.c.o

Compiling .pio\build\esp32-s3-devkitc-1-myboard\lib377\lvgl\draw\sdl\lv_draw_sdl_img.c.o

src/main.cpp:49:1: error: 'Arduino_RPi_DPI_RGBPanel' does not name a type

 Arduino_RPi_DPI_RGBPanel *lcd = new Arduino_RPi_DPI_RGBPanel(

 ^~~~~~~~~~~~~~~~~~~~~~~~

In file included from src/main.cpp:66:

include/touch.h: In function 'bool touch_touched()':

include/touch.h:166:71: error: 'lcd' was not declared in this scope

    touch_last_x = map(ts.points[0].x, TOUCH_MAP_X1, TOUCH_MAP_X2, 0, lcd->width() - 1);

                                                                      ^~~

src/main.cpp: In function 'void my_disp_flush(lv_disp_drv_t*, const lv_area_t*, lv_color_t*)':

src/main.cpp:76:3: error: 'lcd' was not declared in this scope

  lcd->draw16bitRGBBitmap(area->x1, area->y1, (uint16_t *)&color_p->full, w, h);

  ^~~

src/main.cpp: In function 'void calibrateTouch(uint16_t*, uint32_t, uint32_t, uint8_t)':

src/main.cpp:297:5: error: 'lcd' was not declared in this scope

    lcd->fillRect(0, 0, size + 1, size + 1, color_bg);

    ^~~

src/main.cpp: In function 'void setup()':

src/main.cpp:413:3: error: 'lcd' was not declared in this scope

  lcd->begin();

  ^~~

Compiling .pio\build\esp32-s3-devkitc-1-myboard\lib377\lvgl\draw\sdl\lv_draw_sdl_label.c.o

src/main.cpp:518:3: error: 'lv_demo_widgets' was not declared in this scope

  lv_demo_widgets();//主UI界面

  ^~~~~~~~~~~~~~~

src/main.cpp:518:3: note: suggested alternative: 'lv_clamp_width'

  lv_demo_widgets();//主UI界面

  ^~~~~~~~~~~~~~~

  lv_clamp_width

Compiling .pio\build\esp32-s3-devkitc-1-myboard\lib377\lvgl\draw\sdl\lv_draw_sdl_layer.c.o

Compiling .pio\build\esp32-s3-devkitc-1-myboard\lib377\lvgl\draw\sdl\lv_draw_sdl_line.c.o

Compiling .pio\build\esp32-s3-devkitc-1-myboard\lib377\lvgl\draw\sdl\lv_draw_sdl_mask.c.o

Compiling .pio\build\esp32-s3-devkitc-1-myboard\lib377\lvgl\draw\sdl\lv_draw_sdl_polygon.c.o

Compiling .pio\build\esp32-s3-devkitc-1-myboard\lib377\lvgl\draw\sdl\lv_draw_sdl_rect.c.o

*** [.pio\build\esp32-s3-devkitc-1-myboard\src\main.cpp.o] Error 1

Here bellow is the part of the code of main.cpp (Arduino_ESP32RGBPanel and lcd are underlined in red)

#include <lvgl.h>
#include <demos/lv_demos.h>
static uint32_t screenWidth;
static uint32_t screenHeight;
static lv_disp_draw_buf_t draw_buf;
static lv_color_t disp_draw_buf[800 * 480 / 10];
static lv_disp_drv_t disp_drv;
//UI
#include <ui.h>
static int first_flag = 0;
extern int zero_clean;
extern int goto_widget_flag;
extern int bar_flag;
extern lv_obj_t * ui_MENU;
extern lv_obj_t * ui_TOUCH;
extern lv_obj_t * ui_JIAOZHUN;
extern lv_obj_t * ui_Label2;
static lv_obj_t * ui_Label;//TOUCH界面label
static lv_obj_t * ui_Label3;//TOUCH界面label3
static lv_obj_t * ui_Labe2;//Menu界面进度条label
static lv_obj_t * bar;//Menu界面进度条


#include <SPI.h>
SPIClass& spi = SPI;
uint16_t touchCalibration_x0 = 300, touchCalibration_x1 = 3600, touchCalibration_y0 = 300, touchCalibration_y1 = 3600;
uint8_t  touchCalibration_rotate = 1, touchCalibration_invert_x = 2, touchCalibration_invert_y = 0;
static int val = 100;
#include <Ticker.h>          //Call the ticker. H Library
Ticker ticker1;


int i = 0;
#include <Arduino_GFX_Library.h>
#define TFT_BL 2


#if defined(DISPLAY_DEV_KIT)
Arduino_GFX *lcd = create_default_Arduino_GFX();
#else /* !defined(DISPLAY_DEV_KIT) */


Arduino_ESP32RGBPanel *bus = new Arduino_ESP32RGBPanel(
  GFX_NOT_DEFINED /* CS */, GFX_NOT_DEFINED /* SCK */, GFX_NOT_DEFINED /* SDA */,
  41 /* DE */, 40 /* VSYNC */, 39 /* HSYNC */, 0 /* PCLK */,
  14 /* R0 */, 21 /* R1 */, 47 /* R2 */, 48 /* R3 */, 45 /* R4 */,
  9 /* G0 */, 46 /* G1 */, 3 /* G2 */, 8 /* G3 */, 16 /* G4 */, 1 /* G5 */,
  15 /* B0 */, 7 /* B1 */, 6 /* B2 */, 5 /* B3 */, 4 /* B4 */
);


// option 1:
// 7寸 50PIN 800*480
Arduino_RPi_DPI_RGBPanel *lcd = new Arduino_RPi_DPI_RGBPanel(
  bus,
  //  800 /* width */, 0 /* hsync_polarity */, 8/* hsync_front_porch */, 2 /* hsync_pulse_width */, 43/* hsync_back_porch */,
  //  480 /* height */, 0 /* vsync_polarity */, 8 /* vsync_front_porch */, 2/* vsync_pulse_width */, 12 /* vsync_back_porch */,
  //  1 /* pclk_active_neg */, 16000000 /* prefer_speed */, true /* auto_flush */);


  //  800 /* width */, 0 /* hsync_polarity */, 210 /* hsync_front_porch */, 30 /* hsync_pulse_width */, 16 /* hsync_back_porch */,
  //  480 /* height */, 0 /* vsync_polarity */, 22 /* vsync_front_porch */, 13 /* vsync_pulse_width */, 10 /* vsync_back_porch */,
  //  1 /* pclk_active_neg */, 16000000 /* prefer_speed */, true /* auto_flush */);
  //  800 /* width */, 1 /* hsync_polarity */, 80 /* hsync_front_porch */, 48 /* hsync_pulse_width */,  40/* hsync_back_porch */,
  //  480 /* height */, 1 /* vsync_polarity */, 50 /* vsync_front_porch */, 1 /* vsync_pulse_width */, 31 /* vsync_back_porch */,
  //  0 /* pclk_active_neg */, 30000000 /* prefer_speed */, true /* auto_flush */);
  800 /* width */, 1 /* hsync_polarity */, 40 /* hsync_front_porch */, 48 /* hsync_pulse_width */, 40 /* hsync_back_porch */,
  480 /* height */, 1 /* vsync_polarity */, 13 /* vsync_front_porch */, 1 /* vsync_pulse_width */, 31 /* vsync_back_porch */,
  1 /* pclk_active_neg */, 16000000 /* prefer_speed */, true /* auto_flush */);


#endif /* !defined(DISPLAY_DEV_KIT) */
#include "touch.h"
/* 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);


#if (LV_COLOR_16_SWAP != 0)
  lcd->draw16bitBeRGBBitmap(area->x1, area->y1, (uint16_t *)&color_p->full, w, h);
#else
  lcd->draw16bitRGBBitmap(area->x1, area->y1, (uint16_t *)&color_p->full, w, h);
#endif

And as I can see there are some issues in main.cpp (I hadn't changed anything. And I've got whole code from the Elecrow demo). If you know how to solve it. I will appreciate you :)


Thank you in advance

«1

Comments

  • Hello @Denys ,

    The compilation error message indicates that there is a problem in compiling the Arduino_GFX library. You can check what version your GFX library is. If it is version 1.3.0 or above, you need to modify the screen configuration.

    Arduino_ESP32RGBPanel *rgbpanel = new Arduino_ESP32RGBPanel(
       40 /* DE */, 41 /* VSYNC */, 39 /* HSYNC */, 42 /* PCLK */,
       45 /* R0 */, 48 /* R1 */, 47 /* R2 */, 21 /* R3 */, 14 /* R4 */,
       5 /* G0 */, 6 /* G1 */, 7 /* G2 */, 15 /* G3 */, 16 /* G4 */, 4 /* G5 */,
       8 /* B0 */, 3 /* B1 */, 46 /* B2 */, 9 /* B3 */, 1 /* B4 */,
       0 /* hsync_polarity */, 8 /* hsync_front_porch */, 4 /* hsync_pulse_width */, 43 /* hsync_back_porch */,
       0 /* vsync_polarity */, 8 /* vsync_front_porch */, 4 /* vsync_pulse_width */, 12 /* vsync_back_porch */,
       1 /* pclk_active_neg */, 9000000 /* prefer_speed */,
       1 /* de_idle_high */, 1 /* pclk_idle_high */);
    Arduino_RGB_Display *gfx = new Arduino_RGB_Display(
       480 /* width */, 272 /* height */, rgbpanel, 0 /* rotation */, true /* auto_flush */);
    

    If it is not for the above reasons, you can refer to this post:


  • Hello, thank you for offering your advice!

    I just checked my version and it was the same as needed. I've read the post you sent me, but I'm using PlatformIO with VSCode but not Arduino IDE.

    Here below is my platform.ini

    [platformio]
    src_dir = src
    boards_dir = .
    [env:esp32-s3-devkitc-1-myboard]
    platform = espressif32
    board = esp32-s3-devkitc-1-myboard
    framework = arduino
    platform_packages = framework-arduinoespressif32 @
    https://github.com/espressif/arduino-esp32#2.0.3
    ; platform_packages = platformio/framework-arduinoespressif32@3.20003.220626
    build_flags =
    ; -D USEPLATFORMIO
        -D LV_LVGL_H_INCLUDE_SIMPLE
        -I./include
        -IC:/Users/denis/OneDrive/Documents/PlatformIO/Projects/ESP_TAB/build/config
    lib_deps =
        lvgl/lvgl@8.3.6
        moononournation/GFX Library for Arduino@1.2.8
        tamctec/TAMC_GT911@^1.0.2
    ; build_src_filter = ${env.build_src_filter}
    ; +<../.pio/libdeps/esp32-s3-devkitc-1-myboard/lvgl/demos/widgets>
    board_build.partitions = huge_app.csv
    

    I've made some mods such as:

    I've added this

    -IC:/Users/denis/OneDrive/Documents/PlatformIO/Projects/ESP_TAB/build/config
    

    because my IDE was unable to find sdkconfig.h


    Except that I've tried different versions of "GFX lib for Arduino" 1.2.8/1.3.5/1.4.0 even with code you sent me above, but the result is still the same:


    src/main.cpp:39:1: error: 'Arduino_ESP32RGBPanel' does not name a type; did you mean 'Arduino_ESP32SPI'?

     Arduino_ESP32RGBPanel *bus = new Arduino_ESP32RGBPanel(

     ^~~~~~~~~~~~~~~~~~~~~

     Arduino_ESP32SPI

    Compiling .pio\build\esp32-s3-devkitc-1-myboard\lib377\lvgl\draw\sdl\lv_draw_sdl_layer.c.o

    Compiling .pio\build\esp32-s3-devkitc-1-myboard\lib377\lvgl\draw\sdl\lv_draw_sdl_line.c.o

    src/main.cpp:49:1: error: 'Arduino_RPi_DPI_RGBPanel' does not name a type

     Arduino_RPi_DPI_RGBPanel *lcd = new Arduino_RPi_DPI_RGBPanel(

     ^~~~~~~~~~~~~~~~~~~~~~~~

    In file included from src/main.cpp:66:

    src/touch.h: In function 'bool touch_touched()':

    src/touch.h:163:71: error: 'lcd' was not declared in this scope

        touch_last_x = map(ts.points[0].x, TOUCH_MAP_X1, TOUCH_MAP_X2, 0, lcd->width() - 1);

                                                                          ^~~

    src/main.cpp: In function 'void my_disp_flush(lv_disp_drv_t*, const lv_area_t*, lv_color_t*)':

    src/main.cpp:76:3: error: 'lcd' was not declared in this scope

      lcd->draw16bitRGBBitmap(area->x1, area->y1, (uint16_t *)&color_p->full, w, h);

      ^~~

    src/main.cpp: In function 'void calibrateTouch(uint16_t*, uint32_t, uint32_t, uint8_t)':

    src/main.cpp:297:5: error: 'lcd' was not declared in this scope

    Compiling .pio\build\esp32-s3-devkitc-1-myboard\lib377\lvgl\draw\sdl\lv_draw_sdl_mask.c.o

        lcd->fillRect(0, 0, size + 1, size + 1, color_bg);

        ^~~

    src/main.cpp: In function 'void setup()':

    src/main.cpp:413:3: error: 'lcd' was not declared in this scope

      lcd->begin();

      ^~~

  • Hey, may be you have some github "project done" repo for PlatformIO? It would be nice:)

  • Hello Denys, do you put UI files into libraries? Or did you put the wrong UI file?

  • Hello, yeah I did. As in .pdf instruction :)

  • I've added UI files as it was in .pdf instruction, but still have the same issue.

  • Hello dear Elecrow support team, I'm still waiting for your support. Today I've done everything as in instruction, but I've got the same result. Could you please send me any already done repository with some simple demo project?

    Thank you in advance!

  • Hi Denys, our tech team is already working on the problem. I'll get back to you as soon as I have the results. I will ask the R&D staff if there is a simple demo. Thank you for your patience.

  • Hello Denys, this may take some time. Because the engineers are working on other projects. They spend their free time studying your problems. Thank you for your understanding.

  • Hello

    Okay, thank your for respond. I'll be waiting

Sign In or Register to comment.