Description
I have recently purchased a ESP32-2424S012 (ESP32-C3 Entwicklungsboard 1,28 Zoll rundes LCD-Display mit Touchscreen und WLAN-Bluetooth-Modul - AliExpress 44). No documentation nor reference were provided with the hardware
I made a nice UI on SquareLine studio to be run on my ESP32-C3. I have used the âcreate project templateâ option, then âexport UI filesâ.
I have received indeed the project with apparently everything i need. Then, i opened Arduino IDE with the main âui.inoâ file. I set on the IDE the right Sketchbook location. I managed to compile and upload with no error on my device.
The thing is⌠when i received the ESP32-C3, it had its own demo software and it was running fine. Since i uploaded my project, nothing is displayed anymore.
I also updated the User_Setup_Select.h file on libraries/TFT_eSPI
to enable #include <User_Setups/Setup46_GC9A01_ESP32.h>. on User_Setup.h, i enabled #define GC9A01_DRIVER.
I am out of ideas about how to solve this issue.
Thanks for your support!
What MCU/Processor/Board and compiler are you using?
ESP32-2424S012
What do you want to achieve?
Show my UI on screen
What have you tried so far?
I tried different configuration found on topic in this forum, no progress so far
Code to reproduce
ui.ino
//Arduino-TFT_eSPI board-template main routine. There's a TFT_eSPI create+flush driver already in LVGL-9.1 but we create our own here for more control (like e.g. 16-bit color swap).
#include <lvgl.h>
#include <TFT_eSPI.h>
#include <ui.h>
/*Don't forget to set Sketchbook location in File/Preferences to the path of your UI project (the parent foder of this INO file)*/
/*Change to your screen resolution*/
static const uint16_t screenWidth = 240;
static const uint16_t screenHeight = 240;
enum { SCREENBUFFER_SIZE_PIXELS = screenWidth * screenHeight / 10 };
static lv_color_t buf [SCREENBUFFER_SIZE_PIXELS];
TFT_eSPI tft = TFT_eSPI( screenWidth, screenHeight ); /* TFT instance */
#if LV_USE_LOG != 0
/* Serial debugging */
void my_print(const char * buf)
{
Serial.printf(buf);
Serial.flush();
}
#endif
/* Display flushing */
void my_disp_flush (lv_display_t *disp, const lv_area_t *area, uint8_t *pixelmap)
{
uint32_t w = ( area->x2 - area->x1 + 1 );
uint32_t h = ( area->y2 - area->y1 + 1 );
if (LV_COLOR_16_SWAP) {
size_t len = lv_area_get_size( area );
lv_draw_sw_rgb565_swap( pixelmap, len );
}
tft.startWrite();
tft.setAddrWindow( area->x1, area->y1, w, h );
tft.pushColors( (uint16_t*) pixelmap, w * h, true );
tft.endWrite();
lv_disp_flush_ready( disp );
}
/*Read the touchpad*/
void my_touchpad_read (lv_indev_t * indev_driver, lv_indev_data_t * data)
{
uint16_t touchX = 0, touchY = 0;
bool touched = false;//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 " );
Serial.println( touchX );
Serial.print( "Data y " );
Serial.println( touchY );
}
}
/*Set tick routine needed for LVGL internal timings*/
static uint32_t my_tick_get_cb (void) { return millis(); }
void setup ()
{
Serial.begin( 115200 ); /* prepare for possible serial debug */
String LVGL_Arduino = "Hello Arduino! ";
LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();
Serial.println( LVGL_Arduino );
Serial.println( "I am LVGL_Arduino" );
lv_init();
#if LV_USE_LOG != 0
lv_log_register_print_cb( my_print ); /* register print function for debugging */
#endif
tft.begin(); /* TFT init */
tft.setRotation( 3 ); /* Landscape orientation, flipped */
static lv_disp_t* disp;
disp = lv_display_create( screenWidth, screenHeight );
lv_display_set_buffers( disp, buf, NULL, SCREENBUFFER_SIZE_PIXELS * sizeof(lv_color_t), LV_DISPLAY_RENDER_MODE_PARTIAL );
lv_display_set_flush_cb( disp, my_disp_flush );
static lv_indev_t* indev;
indev = lv_indev_create();
lv_indev_set_type( indev, LV_INDEV_TYPE_POINTER );
lv_indev_set_read_cb( indev, my_touchpad_read );
lv_tick_set_cb( my_tick_get_cb );
ui_init();
Serial.println( "Setup done" );
}
void loop ()
{
lv_timer_handler(); /* let the GUI do its work */
delay(5);
}
User_Setup.h
//#define ILI9341_DRIVER // Generic driver for common displays
#define GC9A01_DRIVER
#define TFT_WIDTH 240 // ST7789 240 x 240 and 240 x 320
#define TFT_HEIGHT 240 // GC9A01 240 x 240
#define TFT_MOSI 7 // In some display driver board, it might be written as âSDAâ and so on.
#define TFT_SCLK 6
#define TFT_CS 10 // Chip select control pin
#define TFT_DC 2 // Data Command control pin
#define TFT_RST -1 // Reset pin (could connect to Arduino RESET pin)
#define TFT_BL 3 // LED back-light
#define TFT_MISO -1
User_Setup_Select.h
//#include <User_Setup.h> // Default setup is root library folder
#include <User_Setups/Setup46_GC9A01_ESP32.h> // Setup file for ESP32 and GC9A01 SPI bus TFT 240x240