display_gif_embedded: port to LVGL 9.6.0 (20.6 -> 23.4 fps)
- lvgl/lvgl@9.6.0 via lib_deps, lv_conf.h from the 9.6 template - scr_st77916.h: lv_display/lv_indev API, RGB565 byte swap in flush, lv_tick_set_cb - FPS counter via display refresh events - loligod.c: lv_image_dsc_t descriptor GIF now plays at its own frame rate; decode time halved by LVGL 9.6's AnimatedGIF decoder. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
70114f73aa
commit
9684ab39f2
7 files changed
+170574
-168624
No files matched your search
@@ -12,14 +12,31 @@ const char* password = "123456789";
|
||||
|
||||
String httpGETRequest(const char* serverName);
|
||||
|
||||
// FPS measurement: LVGL calls this after every screen refresh (= one GIF frame here)
|
||||
// FPS measurement: counts screen refreshes that actually rendered something (= one GIF frame here)
|
||||
static volatile uint32_t refr_count = 0;
|
||||
static volatile uint32_t refr_time_ms = 0;
|
||||
static uint32_t busy_us = 0; // time spent inside lv_timer_handler()
|
||||
|
||||
static void refr_monitor_cb(lv_disp_drv_t* drv, uint32_t time, uint32_t px) {
|
||||
refr_count++;
|
||||
refr_time_ms += time;
|
||||
static void refr_event_cb(lv_event_t* e) {
|
||||
static uint32_t refr_start_ms = 0;
|
||||
static bool rendered = false;
|
||||
switch (lv_event_get_code(e)) {
|
||||
case LV_EVENT_REFR_START:
|
||||
refr_start_ms = millis();
|
||||
rendered = false;
|
||||
break;
|
||||
case LV_EVENT_RENDER_START:
|
||||
rendered = true;
|
||||
break;
|
||||
case LV_EVENT_REFR_READY:
|
||||
if (rendered) {
|
||||
refr_count++;
|
||||
refr_time_ms += millis() - refr_start_ms;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void print_fps() {
|
||||
@@ -44,9 +61,9 @@ void my_print(const char* buf) {
|
||||
void display_animation() {
|
||||
lv_obj_t* img;
|
||||
|
||||
LV_IMG_DECLARE(loligod);
|
||||
LV_IMAGE_DECLARE(loligod);
|
||||
|
||||
img = lv_gif_create(lv_scr_act());
|
||||
img = lv_gif_create(lv_screen_active());
|
||||
|
||||
Serial.print("Available Heap before: ");
|
||||
Serial.println(esp_get_free_heap_size());
|
||||
@@ -94,7 +111,7 @@ void display_text() {
|
||||
// lv_style_set_shadow_ofs_x(&style_text, 0);
|
||||
// lv_style_set_shadow_ofs_y(&style_text, 0);
|
||||
|
||||
label1 = lv_label_create(lv_scr_act());
|
||||
label1 = lv_label_create(lv_screen_active());
|
||||
|
||||
// Apply the style to the label
|
||||
lv_obj_add_style(label1, &style_text, LV_PART_MAIN);
|
||||
@@ -130,14 +147,12 @@ void setup() {
|
||||
delay(200);
|
||||
Serial.begin(115200);
|
||||
scr_lvgl_init();
|
||||
lv_disp_get_default()->driver->monitor_cb = refr_monitor_cb;
|
||||
|
||||
lv_init();
|
||||
lv_display_add_event_cb(lv_display_get_default(), refr_event_cb, LV_EVENT_ALL, NULL);
|
||||
|
||||
//lv_log_register_print_cb(my_print); // Register print function for LVGL logs
|
||||
|
||||
// Get the active screen (root object for the display)
|
||||
lv_obj_t* screen = lv_scr_act();
|
||||
lv_obj_t* screen = lv_screen_active();
|
||||
|
||||
// Set the background color of the entire screen to black
|
||||
lv_obj_set_style_bg_color(screen, lv_color_black(), 0); // 0 is the part ID for the main part
|
||||
|
||||
Reference in new issue
Block a user