display_gif_embedded: 15.4 -> 20.6 fps
- FPS/refresh/decode counter via LVGL monitor_cb (printed once per second) - LVGL logging off, per-loop memory prints removed, loop delay 5 -> 1 ms - double draw buffer (render while previous chunk is flushed) - compile with -O2 instead of -Os Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4e63fb65c6
commit
70114f73aa
5 files changed
+70
-39
No files matched your search
@@ -12,6 +12,30 @@ const char* password = "123456789";
|
||||
|
||||
String httpGETRequest(const char* serverName);
|
||||
|
||||
// FPS measurement: LVGL calls this after every screen refresh (= 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;
|
||||
}
|
||||
|
||||
void print_fps() {
|
||||
static uint32_t last_ms = 0;
|
||||
uint32_t now = millis();
|
||||
if (now - last_ms < 1000) return;
|
||||
// decode = busy time not spent refreshing the screen (mostly GIF decoding)
|
||||
Serial.printf("FPS: %.1f avg refresh: %lu ms avg decode: %lu ms\n", refr_count * 1000.0f / (now - last_ms),
|
||||
refr_count ? refr_time_ms / refr_count : 0,
|
||||
refr_count ? (busy_us / 1000 - refr_time_ms) / refr_count : 0);
|
||||
refr_count = 0;
|
||||
refr_time_ms = 0;
|
||||
busy_us = 0;
|
||||
last_ms = now;
|
||||
}
|
||||
|
||||
|
||||
void my_print(const char* buf) {
|
||||
Serial.println(buf); // Print logs to the serial monitor
|
||||
@@ -106,6 +130,7 @@ void setup() {
|
||||
delay(200);
|
||||
Serial.begin(115200);
|
||||
scr_lvgl_init();
|
||||
lv_disp_get_default()->driver->monitor_cb = refr_monitor_cb;
|
||||
|
||||
lv_init();
|
||||
|
||||
@@ -143,15 +168,11 @@ void setup() {
|
||||
}
|
||||
|
||||
void loop() {
|
||||
uint32_t t0 = micros();
|
||||
lv_timer_handler();
|
||||
vTaskDelay(5);
|
||||
|
||||
lv_mem_monitor_t mem_mon;
|
||||
lv_mem_monitor(&mem_mon);
|
||||
printf("Free memory: %d bytes\n", mem_mon.free_size);
|
||||
|
||||
Serial.print("Available Heap: ");
|
||||
Serial.println(esp_get_free_heap_size());
|
||||
busy_us += micros() - t0;
|
||||
vTaskDelay(1);
|
||||
print_fps();
|
||||
|
||||
|
||||
// if (WiFi.status() == WL_CONNECTED) {
|
||||
|
||||
Reference in new issue
Block a user