This commit is contained in:
不吃油炸鸡
2025-09-22 21:45:02 +08:00
parent fe73739d65
commit d7e8d4e0b6
8 changed files with 1831 additions and 13 deletions

View File

@@ -1,4 +1,4 @@
#include "PageManager.h" #include "./PageManager.h"
#include <string.h> #include <string.h>
// 定义全局实例 // 定义全局实例
@@ -11,6 +11,18 @@ void PageManager_init(void) {
memset(&PageManager, 0, sizeof(PageManager)); memset(&PageManager, 0, sizeof(PageManager));
} }
/**
* load init screen
*/
void PageManager_load_init_screen(void) {
if (PageManager.count == 0) return;
Page_t* initial_page = PageManager.pages[0];
if (initial_page->init) initial_page->init();
lv_scr_load(*initial_page->page_obj);
PageManager.current_index = 0;
}
/** /**
* 注册一个新页面 * 注册一个新页面
* @param page 页面结构体指针 * @param page 页面结构体指针

View File

@@ -31,5 +31,6 @@ void PageManager_next(void);
void PageManager_prev(void); void PageManager_prev(void);
void PageManager_goto(uint8_t index); void PageManager_goto(uint8_t index);
Page_t* PageManager_get_current_page(void); Page_t* PageManager_get_current_page(void);
void PageManager_load_init_screen(void);
#endif // PAGE_MANAGER_H #endif // PAGE_MANAGER_H

View File

@@ -0,0 +1,546 @@
/*******************************************************************************
* Size: 32 px
* Bpp: 4
* Opts: --bpp 4 --size 32 --font E:/projects/SquareLine_Projects/PowerPico/assets/FangZhengHeiTi-GBK-1.ttf -o E:/projects/SquareLine_Projects/PowerPico/assets\ui_font_HeiTi32.c --format lvgl --symbols 1234567890.muAVW:- --no-compress --no-prefilter
******************************************************************************/
#include "../ui.h"
#ifndef UI_FONT_HEITI32
#define UI_FONT_HEITI32 1
#endif
#if UI_FONT_HEITI32
/*-----------------
* BITMAPS
*----------------*/
/*Store the image of the glyphs*/
static LV_ATTRIBUTE_LARGE_CONST const uint8_t glyph_bitmap[] = {
/* U+002D "-" */
0x35, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55, 0x55,
0x1c, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xf6, 0xcf, 0xff, 0xff, 0xff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,
0xfa, 0xef, 0xf0, 0x0, 0x0, 0x0, 0x2f, 0xfa,
0xef, 0xf0, 0x0, 0x0, 0x0, 0x2f, 0xfa, 0xef,
0xf0, 0x0, 0x0, 0x0, 0x2f, 0xfa, 0xef, 0xf0,
0x0, 0x0, 0x0, 0x4f, 0xfa, 0xef, 0xf0, 0x0,
0x0, 0x0, 0x7f, 0xfa, 0xdf, 0xf2, 0x0, 0x0,
0x0, 0xdf, 0xfa, 0xbf, 0xf9, 0x0, 0x0, 0x8,
0xff, 0xfa, 0x6f, 0xff, 0x93, 0x14, 0xaf, 0xbf,
0xfa, 0xb, 0xff, 0xff, 0xff, 0xfb, 0xf, 0xfa,
0x0, 0x6c, 0xff, 0xeb, 0x50, 0xf, 0xfa
};
/*---------------------
* GLYPH DESCRIPTION
*--------------------*/
static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = {
{.bitmap_index = 0, .adv_w = 0, .box_w = 0, .box_h = 0, .ofs_x = 0, .ofs_y = 0} /* id = 0 reserved */,
{.bitmap_index = 0, .adv_w = 298, .box_w = 17, .box_h = 3, .ofs_x = 1, .ofs_y = 7},
{.bitmap_index = 26, .adv_w = 142, .box_w = 5, .box_h = 4, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 36, .adv_w = 284, .box_w = 16, .box_h = 23, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 220, .adv_w = 284, .box_w = 9, .box_h = 23, .ofs_x = 3, .ofs_y = 0},
{.bitmap_index = 324, .adv_w = 284, .box_w = 17, .box_h = 22, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 511, .adv_w = 284, .box_w = 16, .box_h = 23, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 695, .adv_w = 284, .box_w = 17, .box_h = 23, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 891, .adv_w = 284, .box_w = 16, .box_h = 22, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 1067, .adv_w = 284, .box_w = 16, .box_h = 23, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 1251, .adv_w = 284, .box_w = 16, .box_h = 22, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 1427, .adv_w = 284, .box_w = 16, .box_h = 23, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 1611, .adv_w = 284, .box_w = 16, .box_h = 22, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 1787, .adv_w = 142, .box_w = 5, .box_h = 17, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 1830, .adv_w = 340, .box_w = 21, .box_h = 23, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 2072, .adv_w = 340, .box_w = 21, .box_h = 23, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 2314, .adv_w = 482, .box_w = 30, .box_h = 23, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 2659, .adv_w = 424, .box_w = 23, .box_h = 18, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 2866, .adv_w = 284, .box_w = 14, .box_h = 17, .ofs_x = 2, .ofs_y = 0}
};
/*---------------------
* CHARACTER MAPPING
*--------------------*/
static const uint16_t unicode_list_0[] = {
0x0, 0x1, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8,
0x9, 0xa, 0xb, 0xc, 0xd, 0x14, 0x29, 0x2a,
0x40, 0x48
};
/*Collect the unicode lists and glyph_id offsets*/
static const lv_font_fmt_txt_cmap_t cmaps[] =
{
{
.range_start = 45, .range_length = 73, .glyph_id_start = 1,
.unicode_list = unicode_list_0, .glyph_id_ofs_list = NULL, .list_length = 18, .type = LV_FONT_FMT_TXT_CMAP_SPARSE_TINY
}
};
/*--------------------
* ALL CUSTOM DATA
*--------------------*/
#if LVGL_VERSION_MAJOR == 8
/*Store all the custom data of the font*/
static lv_font_fmt_txt_glyph_cache_t cache;
#endif
#if LVGL_VERSION_MAJOR >= 8
static const lv_font_fmt_txt_dsc_t font_dsc = {
#else
static lv_font_fmt_txt_dsc_t font_dsc = {
#endif
.glyph_bitmap = glyph_bitmap,
.glyph_dsc = glyph_dsc,
.cmaps = cmaps,
.kern_dsc = NULL,
.kern_scale = 0,
.cmap_num = 1,
.bpp = 4,
.kern_classes = 0,
.bitmap_format = 0,
#if LVGL_VERSION_MAJOR == 8
.cache = &cache
#endif
};
/*-----------------
* PUBLIC FONT
*----------------*/
/*Initialize a public general font descriptor*/
#if LVGL_VERSION_MAJOR >= 8
const lv_font_t ui_font_HeiTi32 = {
#else
lv_font_t ui_font_HeiTi32 = {
#endif
.get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt, /*Function pointer to get glyph's data*/
.get_glyph_bitmap = lv_font_get_bitmap_fmt_txt, /*Function pointer to get glyph's bitmap*/
.line_height = 23, /*The maximum line height required by the font*/
.base_line = 0, /*Baseline measured from the bottom of the line*/
#if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0)
.subpx = LV_FONT_SUBPX_NONE,
#endif
#if LV_VERSION_CHECK(7, 4, 0) || LVGL_VERSION_MAJOR >= 8
.underline_position = -6,
.underline_thickness = 2,
#endif
.dsc = &font_dsc, /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */
#if LV_VERSION_CHECK(8, 2, 0) || LVGL_VERSION_MAJOR >= 9
.fallback = NULL,
#endif
.user_data = NULL,
};
#endif /*#if UI_FONT_HEITI32*/

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,225 @@
// This file was generated by SquareLine Studio
// SquareLine Studio version: SquareLine Studio 1.5.3
// LVGL version: 9.2.2
// Project name: PowerPico
#include "../ui.h"
#include "ui_mainPage.h"
#include "data_queue.h"
lv_obj_t * ui_HomeScreen = NULL;
lv_obj_t * ui_ButVal = NULL;
lv_obj_t * ui_LabelUnitVal = NULL;
lv_obj_t * ui_LabelValt = NULL;
lv_obj_t * ui_ButCur = NULL;
lv_obj_t * ui_LabelUnitCur = NULL;
lv_obj_t * ui_LabelCur = NULL;
lv_obj_t * ui_ButEnerge = NULL;
lv_obj_t * ui_LabelUnitEnerge = NULL;
lv_obj_t * ui_LabelEnerge = NULL;
lv_obj_t * ui_ButTime = NULL;
lv_obj_t * ui_LabelTime = NULL;
static lv_timer_t * _flush_timer = NULL;
// other funtions
static void full_screen_refresh(void) {
// 标记整个屏幕为脏区域
lv_obj_invalidate(ui_HomeScreen);
// 或者立即刷新整个屏幕
lv_refr_now(NULL);
}
static void set_val_cur_label(float voltage, float current)
{
char buf[10];
sprintf(buf, "%.2f", voltage);
lv_label_set_text(ui_LabelValt, buf);
if(current >= 1000000.0) {
current = current / 1000000.0;
sprintf(buf, "%.2f", current);
lv_label_set_text(ui_LabelCur, buf);
lv_label_set_text(ui_LabelUnitCur, "A");
}
else if(current >= 1000.0) {
current = current / 1000.0;
if(current >= 100.0) {
sprintf(buf, "%.1f", current);
}
else {
sprintf(buf, "%.2f", current);
}
lv_label_set_text(ui_LabelCur, buf);
lv_label_set_text(ui_LabelUnitCur, "mA");
}
else {
if(current >= 100.0) {
sprintf(buf, "%.1f", current);
}
else {
sprintf(buf, "%.2f", current);
}
lv_label_set_text(ui_LabelCur, buf);
lv_label_set_text(ui_LabelUnitCur, "uA");
}
}
// event funtions
static void _flush_timer_cb()
{
static uint8_t timecount = 0;
timecount++;
if(timecount >= 10) { // 5s
timecount = 0;
full_screen_refresh();
}
float voltage = 0.0;
float current = 0.0;
current = queue_average(global_current_queue);
voltage = queue_average(global_voltage_queue);
set_val_cur_label(voltage, current);
}
// build funtions
void ui_main_screen_init(void)
{
ui_HomeScreen = lv_obj_create(NULL);
lv_obj_remove_flag(ui_HomeScreen, LV_OBJ_FLAG_SCROLLABLE); /// Flags
ui_ButVal = lv_button_create(ui_HomeScreen);
lv_obj_set_width(ui_ButVal, 234);
lv_obj_set_height(ui_ButVal, 55);
lv_obj_set_x(ui_ButVal, 0);
lv_obj_set_y(ui_ButVal, 4);
lv_obj_set_align(ui_ButVal, LV_ALIGN_TOP_MID);
lv_obj_add_flag(ui_ButVal, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
lv_obj_remove_flag(ui_ButVal, LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_SCROLLABLE); /// Flags
lv_obj_set_style_bg_color(ui_ButVal, lv_color_hex(0xE36666), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(ui_ButVal, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
ui_ButCur = lv_button_create(ui_HomeScreen);
lv_obj_set_width(ui_ButCur, 234);
lv_obj_set_height(ui_ButCur, 55);
lv_obj_set_x(ui_ButCur, 0);
lv_obj_set_y(ui_ButCur, 63);
lv_obj_set_align(ui_ButCur, LV_ALIGN_TOP_MID);
lv_obj_add_flag(ui_ButCur, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
lv_obj_remove_flag(ui_ButCur, LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_SCROLLABLE); /// Flags
lv_obj_set_style_bg_color(ui_ButCur, lv_color_hex(0x42AA49), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(ui_ButCur, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
ui_ButEnerge = lv_button_create(ui_HomeScreen);
lv_obj_set_width(ui_ButEnerge, 234);
lv_obj_set_height(ui_ButEnerge, 55);
lv_obj_set_x(ui_ButEnerge, 0);
lv_obj_set_y(ui_ButEnerge, 122);
lv_obj_set_align(ui_ButEnerge, LV_ALIGN_TOP_MID);
lv_obj_add_flag(ui_ButEnerge, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
lv_obj_remove_flag(ui_ButEnerge, LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_SCROLLABLE); /// Flags
lv_obj_set_style_bg_color(ui_ButEnerge, lv_color_hex(0x4569C9), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(ui_ButEnerge, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
ui_ButTime = lv_button_create(ui_HomeScreen);
lv_obj_set_width(ui_ButTime, 234);
lv_obj_set_height(ui_ButTime, 55);
lv_obj_set_x(ui_ButTime, 0);
lv_obj_set_y(ui_ButTime, 181);
lv_obj_set_align(ui_ButTime, LV_ALIGN_TOP_MID);
lv_obj_add_flag(ui_ButTime, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
lv_obj_remove_flag(ui_ButTime, LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_SCROLLABLE); /// Flags
lv_obj_set_style_bg_color(ui_ButTime, lv_color_hex(0x9F9960), LV_PART_MAIN | LV_STATE_DEFAULT);
lv_obj_set_style_bg_opa(ui_ButTime, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
ui_LabelUnitVal = lv_label_create(ui_HomeScreen);
lv_obj_set_width(ui_LabelUnitVal, LV_SIZE_CONTENT); /// 1
lv_obj_set_height(ui_LabelUnitVal, LV_SIZE_CONTENT); /// 1
lv_obj_set_x(ui_LabelUnitVal, 70);
lv_obj_set_y(ui_LabelUnitVal, 20);
lv_obj_set_align(ui_LabelUnitVal, LV_ALIGN_TOP_MID);
lv_label_set_text(ui_LabelUnitVal, "V");
lv_obj_set_style_text_font(ui_LabelUnitVal, &ui_font_HeiTi32, LV_PART_MAIN | LV_STATE_DEFAULT);
ui_LabelValt = lv_label_create(ui_HomeScreen);
lv_obj_set_width(ui_LabelValt, LV_SIZE_CONTENT); /// 1
lv_obj_set_height(ui_LabelValt, LV_SIZE_CONTENT); /// 1
lv_obj_set_x(ui_LabelValt, -30);
lv_obj_set_y(ui_LabelValt, 14);
lv_obj_set_align(ui_LabelValt, LV_ALIGN_TOP_MID);
lv_label_set_text(ui_LabelValt, "17.23");
lv_obj_set_style_text_font(ui_LabelValt, &ui_font_HeiTi48, LV_PART_MAIN | LV_STATE_DEFAULT);
ui_LabelUnitCur = lv_label_create(ui_HomeScreen);
lv_obj_set_width(ui_LabelUnitCur, LV_SIZE_CONTENT); /// 1
lv_obj_set_height(ui_LabelUnitCur, LV_SIZE_CONTENT); /// 1
lv_obj_set_x(ui_LabelUnitCur, 70);
lv_obj_set_y(ui_LabelUnitCur, 80);
lv_obj_set_align(ui_LabelUnitCur, LV_ALIGN_TOP_MID);
lv_label_set_text(ui_LabelUnitCur, "mA");
lv_obj_set_style_text_font(ui_LabelUnitCur, &ui_font_HeiTi32, LV_PART_MAIN | LV_STATE_DEFAULT);
ui_LabelCur = lv_label_create(ui_HomeScreen);
lv_obj_set_width(ui_LabelCur, LV_SIZE_CONTENT); /// 1
lv_obj_set_height(ui_LabelCur, LV_SIZE_CONTENT); /// 1
lv_obj_set_x(ui_LabelCur, -30);
lv_obj_set_y(ui_LabelCur, 74);
lv_obj_set_align(ui_LabelCur, LV_ALIGN_TOP_MID);
lv_label_set_text(ui_LabelCur, "283.2");
lv_obj_set_style_text_font(ui_LabelCur, &ui_font_HeiTi48, LV_PART_MAIN | LV_STATE_DEFAULT);
ui_LabelUnitEnerge = lv_label_create(ui_HomeScreen);
lv_obj_set_width(ui_LabelUnitEnerge, LV_SIZE_CONTENT); /// 1
lv_obj_set_height(ui_LabelUnitEnerge, LV_SIZE_CONTENT); /// 1
lv_obj_set_x(ui_LabelUnitEnerge, 70);
lv_obj_set_y(ui_LabelUnitEnerge, 140);
lv_obj_set_align(ui_LabelUnitEnerge, LV_ALIGN_TOP_MID);
lv_label_set_text(ui_LabelUnitEnerge, "mW");
lv_obj_set_style_text_font(ui_LabelUnitEnerge, &ui_font_HeiTi32, LV_PART_MAIN | LV_STATE_DEFAULT);
ui_LabelEnerge = lv_label_create(ui_HomeScreen);
lv_obj_set_width(ui_LabelEnerge, LV_SIZE_CONTENT); /// 1
lv_obj_set_height(ui_LabelEnerge, LV_SIZE_CONTENT); /// 1
lv_obj_set_x(ui_LabelEnerge, -30);
lv_obj_set_y(ui_LabelEnerge, 133);
lv_obj_set_align(ui_LabelEnerge, LV_ALIGN_TOP_MID);
lv_label_set_text(ui_LabelEnerge, "543.2");
lv_obj_set_style_text_font(ui_LabelEnerge, &ui_font_HeiTi48, LV_PART_MAIN | LV_STATE_DEFAULT);
ui_LabelTime = lv_label_create(ui_HomeScreen);
lv_obj_set_width(ui_LabelTime, LV_SIZE_CONTENT); /// 1
lv_obj_set_height(ui_LabelTime, LV_SIZE_CONTENT); /// 1
lv_obj_set_x(ui_LabelTime, 0);
lv_obj_set_y(ui_LabelTime, 190);
lv_obj_set_align(ui_LabelTime, LV_ALIGN_TOP_MID);
lv_label_set_text(ui_LabelTime, "00:00:00");
lv_obj_set_style_text_font(ui_LabelTime, &ui_font_HeiTi48, LV_PART_MAIN | LV_STATE_DEFAULT);
_flush_timer_cb(NULL);
// flush timer
_flush_timer = lv_timer_create(_flush_timer_cb, 500, NULL);
}
void ui_main_screen_destroy(void)
{
if(ui_HomeScreen) lv_obj_del(ui_HomeScreen);
// NULL screen variables
ui_HomeScreen = NULL;
ui_ButVal = NULL;
ui_LabelUnitVal = NULL;
ui_LabelValt = NULL;
ui_ButCur = NULL;
ui_LabelUnitCur = NULL;
ui_LabelCur = NULL;
ui_ButEnerge = NULL;
ui_LabelUnitEnerge = NULL;
ui_LabelEnerge = NULL;
ui_ButTime = NULL;
ui_LabelTime = NULL;
lv_timer_del(_flush_timer);
_flush_timer = NULL;
}

View File

@@ -0,0 +1,19 @@
#ifndef UI_MAINPAGE_H
#define UI_MAINPAGE_H
#ifdef __cplusplus
extern "C" {
#endif
// SCREEN: ui_Screen1
void ui_main_screen_init(void);
void ui_main_screen_destroy(void);
extern lv_obj_t * ui_HomeScreen;
#ifdef __cplusplus
} /*extern "C"*/
#endif
#endif

View File

@@ -1,12 +1,21 @@
// LVGL version: 9.2 // LVGL version: 9.2
// Project name: PowerPico // Project name: PowerPico
#include "ui.h" #include "./ui.h"
#include "./screens/ui_mainPage.h"
///////////////////// VARIABLES //////////////////// ///////////////////// VARIABLES ////////////////////
// pages // pages
Page_t pages[] = {
{
.init = ui_main_screen_init,
.deinit = ui_main_screen_destroy,
.page_obj = &ui_HomeScreen,
.name = "Main Page"
},
// 可以在这里添加更多页面
};
///////////////////// TEST LVGL SETTINGS //////////////////// ///////////////////// TEST LVGL SETTINGS ////////////////////
#if LV_COLOR_DEPTH != 16 #if LV_COLOR_DEPTH != 16
@@ -19,8 +28,7 @@
*/ */
static void main_timer(lv_timer_t * timer) static void main_timer(lv_timer_t * timer)
{ {
// printf("timer\r\n"); // LV_LOG_WARN("Main timer");
} }
/////////////////////// ui_initialize ////////////////////// /////////////////////// ui_initialize //////////////////////
@@ -31,13 +39,10 @@ void ui_init(void)
true, LV_FONT_DEFAULT); true, LV_FONT_DEFAULT);
lv_disp_set_theme(dispp, theme); lv_disp_set_theme(dispp, theme);
PageManager_init(); PageManager_init();
for(uint8_t i = 0; i < sizeof(pages)/sizeof(pages[0]); i++) {
// PageManager_register(&xxxpage); PageManager_register(&pages[i]);
// test }
lv_obj_t * test_page = lv_obj_create(NULL); PageManager_load_init_screen();
lv_obj_t * btn1 = lv_button_create(test_page);
lv_obj_align(btn1, LV_ALIGN_CENTER, 0, 0);
lv_disp_load_scr(test_page);
//timer //timer
lv_timer_t * ui_MainTimer = lv_timer_create(main_timer, 1000, NULL); lv_timer_t * ui_MainTimer = lv_timer_create(main_timer, 1000, NULL);

View File

@@ -1,4 +1,4 @@
// LVGL VERSION: 8.2.0 // LVGL VERSION: 9.2
#ifndef _UI_H #ifndef _UI_H
@@ -16,6 +16,10 @@ extern "C" {
void ui_init(void); void ui_init(void);
// FONTS
LV_FONT_DECLARE(ui_font_HeiTi32);
LV_FONT_DECLARE(ui_font_HeiTi48);
#ifdef __cplusplus #ifdef __cplusplus
} /*extern "C"*/ } /*extern "C"*/
#endif #endif