7“ HMI ESP32 Widgets shiver on the screen
Need some help with:
7“ HMI ESP32-S3 AI-Powered IPS Touch Screen Widgets shiver on the screen
Diplay ; https://www.elecrow.com/crowpanel-advance-7-0-hmi-esp32-ai-display-800x480-artificial-intelligent-ips-touch-screen-support-meshtastic-and-arduino-lvgl-micropython.html
Platformio.ini
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:esp32-s3-devkitc-1]
platform = espressif32
board = esp32-s3-devkitc-1
framework = arduino
board_build.arduino.partitions = default_8MB.csv
board_build.arduino.memory_type = qio_opi
build_flags =
-DBOARD_HAS_PSRAM
-mfix-esp32-psram-cache-issue
-DCONFIG_SPIRAM_SUPPORT=1
-DCONFIG_SPIRAM_TYPE=1
-DPSRAM_SIZE=2
-DPSRAM_CLK=120000000
board_upload.flash_size = 8MB
lib_deps =
lvgl/lvgl@8.3.11
lovyan03/LovyanGFX@^1.2.7
adafruit/Adafruit SSD1306@^2.5.15
tamctec/TAMC_GT911@^1.0.2
beegee-tokyo/RAK14014-FT6336U@^1.0.0
monitor_speed = 115200
main.cpp
include "pins_config.h"
include "LovyanGFX_Driver.h"
include <Arduino.h>
include <lvgl.h>
include <Wire.h>
include <SPI.h>
include <stdbool.h>
include <Adafruit_SSD1306.h>
include <Adafruit_GFX.h>
include "ui.h"
LGFX gfx;
/* Change to your screen resolution */
static lv_disp_draw_buf_t draw_buf;
static lv_color_t *buf;
static lv_color_t *buf1;
uint16_t touch_x, touch_y;
// Display refresh
void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p) {
if (gfx.getStartCount() > 0) {
gfx.endWrite();
}
gfx.pushImageDMA(area->x1, area->y1, area->x2 - area->x1 + 1, area->y2 - area->y1 + 1, (lgfx::rgb565_t *)&color_p->full);
lv_disp_flush_ready(disp); // Tell lvgl that the refresh is complete
}
// Read touch
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
data->state = LV_INDEV_STATE_REL;// The state of data existence when releasing the finger
bool touched = gfx.getTouch( &touch_x, &touch_y );
if (touched)
{
data->state = LV_INDEV_STATE_PR;
// Set coordinates
data->point.x = touch_x;
data->point.y = touch_y;
}
}
bool i2cScanForAddress(uint8_t address) {
Wire.beginTransmission(address);
return (Wire.endTransmission() == 0);
}
// Wrapper function for sending I2C commands
void sendI2CCommand(uint8_t command) {
uint8_t error;
// Start sending commands to the specified address
Wire.beginTransmission(0x30);
// Send command
Wire.write(command);
// End transmission and return status
error = Wire.endTransmission();
if (error == 0) {
Serial.print("command 0x");
Serial.print(command, HEX);
Serial.println(" Sent successfully");
} else {
Serial.print("Command sent error, error code:");
Serial.println(error);
}
}
void setup()
{
Serial.begin(115200);
pinMode(19, OUTPUT);
Wire.begin(15, 16);
delay(50);
while (1) {
if (i2cScanForAddress(0x30) && i2cScanForAddress(0x5D)) {
Serial.print("The microcontroller is detected: address 0x");
Serial.println(0x30, HEX);
Serial.print("The microcontroller is detected: address 0x");
Serial.println(0x5D, HEX);
break;
} else {
Serial.print("No microcontroller was detected: address 0x");
Serial.println(0x30, HEX);
Serial.print("No microcontroller was detected: address 0x");
Serial.println(0x5D, HEX);
//Prevent the microcontroller did not start to adjust the bright screen
sendI2CCommand(0x19);
pinMode(1, OUTPUT);
digitalWrite(1, LOW);
//ioex.output(2, TCA9534::Level::L);
//ioex.output(2, TCA9534::Level::H);
delay(120);
pinMode(1, INPUT);
delay(100);
}
}
// Init Display
gfx.init();
gfx.initDMA();
gfx.startWrite();
gfx.fillScreen(TFT_BLACK);
lv_init();
size_t buffer_size = sizeof(lv_color_t) * LCD_H_RES * LCD_V_RES;
buf = (lv_color_t *)heap_caps_malloc(buffer_size, MALLOC_CAP_SPIRAM);
buf1 = (lv_color_t *)heap_caps_malloc(buffer_size, MALLOC_CAP_SPIRAM);
lv_disp_draw_buf_init(&draw_buf, buf, buf1, LCD_H_RES * LCD_V_RES);
// Initialize display
static lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv);
// Change the following lines to your display resolution
disp_drv.hor_res = LCD_H_RES;
disp_drv.ver_res = LCD_V_RES;
disp_drv.flush_cb = my_disp_flush;
disp_drv.draw_buf = &draw_buf;
lv_disp_drv_register(&disp_drv);
// Initialize input device driver program
static lv_indev_drv_t indev_drv;
lv_indev_drv_init(&indev_drv);
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register(&indev_drv);
delay(100);
// 开始向地址 0x30 发送命令 0x10
sendI2CCommand(0x10);
gfx.fillScreen(TFT_BLACK);
// lv_demo_widgets();// Main UI interface
ui_init();
Serial.println( "Setup done" );
}
void loop()
{
lv_timer_handler(); /* let the GUI do its work */
delay(1);
}
Comments
Update.
This is my latest ini-file. Now I am in the same situation as the post about flickering:
[env:esp32-s3-devkitc-1]
platform = https://github.com/pioarduino/platform-espressif32/releases/download/2024.07.00/platform-espressif32.zip
board = esp32-s3-devkitc-1
framework = arduino
lib_deps =
lvgl/lvgl@8.3.11
tamctec/TAMC_GT911@^1.0.2
beegee-tokyo/RAK14014-FT6336U@^1.0.1
adafruit/Adafruit SSD1306@2.5.13
lovyan03/LovyanGFX@1.1.16
monitor_speed = 115200
board_build.arduino.partitions = huge_app.csv
board_build.arduino.memory_type = qio_opi
build_flags =
-DBOARD_HAS_PSRAM
-mfix-esp32-psram-cache-issue
-DCONFIG_SPIRAM_SUPPORT=1
-DCONFIG_SPIRAM_TYPE=1
-DPSRAM_SIZE=2
-DPSRAM_CLK=120000000
board_upload.flash_size = 16MB
Dear Polleke,
Have you tested the examples/courses/demo programs we provided? Can they run properly?
Best regards,
Thy running properly in arduino ide but not in platformio
Dear Polleke,
Do you mean that when using the platformIO examples/courses/demo programs we provide, the problem of "Widgets shiver on the screen" will occur?
Yes indeed
Is it not possible to obtain a working platformio program in and zip file( 7 Inch hmi DIS02170A). Then you will have both the program and the correct libraries.
Thanks in advance.
Dear Polleke,

May I ask what the hardware version of your device is? You can find it on the back of the product.
Dear Polleke,
We also need to provide the program based on the hardware version of your device. Could you please provide it first?
Dear Polleke,
Please use this program in the link below to try again. we have just updated it.
https://drive.google.com/drive/folders/1cRjIrZdt5gDf386JZQ_24ThL9H0XJjU-
Thanks!
Best regards,
Fantastic, this works. Thanks to everyone who contributed.
Paul