fix(demo): fix showing the average FPS

This commit is contained in:
Gabor Kiss-Vamosi
2023-11-06 14:25:25 +01:00
parent e3380a8fe8
commit 96ce505651
3 changed files with 25 additions and 7 deletions

View File

@@ -12,6 +12,7 @@
#include "lv_demo_music_main.h"
#include "lv_demo_music_list.h"
#include "../../src/core/lv_global.h"
/*********************
* DEFINES
@@ -103,6 +104,10 @@ static const uint32_t time_list[] = {
2 * 60 + 19,
};
#if LV_USE_PERF_MONITOR || LV_DEMO_MUSIC_AUTO_PLAY
#define sysmon_perf LV_GLOBAL_DEFAULT()->sysmon_perf
#endif
/**********************
* MACROS
**********************/
@@ -225,7 +230,8 @@ static void auto_step_cb(lv_timer_t * t)
lv_obj_t * num = lv_label_create(bg);
lv_obj_set_style_text_font(num, font_large, 0);
#if LV_USE_PERF_MONITOR
lv_label_set_text_fmt(num, "%" LV_PRIu32, lv_refr_get_fps_avg());
const lv_sysmon_perf_info_t * info = lv_subject_get_pointer(&sysmon_perf.subject);
lv_label_set_text_fmt(num, "%" LV_PRIu32, info->calculated.cpu_avg_total);
#endif
lv_obj_align(num, LV_ALIGN_TOP_MID, 0, 120);