mirror of
https://github.com/No-Chicken/Power-Pico.git
synced 2026-04-03 13:02:36 +08:00
打包keil_MDK的工程
This commit is contained in:
@@ -1,353 +0,0 @@
|
||||
// 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"
|
||||
|
||||
lv_obj_t * ui_ChartPage = NULL;
|
||||
static lv_obj_t * ui_ContainChart = NULL;
|
||||
static lv_obj_t * row_line1 = NULL;
|
||||
static lv_obj_t * row_line2 = NULL;
|
||||
static lv_obj_t * row_line3 = NULL;
|
||||
static lv_obj_t * row_line4 = NULL;
|
||||
static lv_obj_t * col_line1 = NULL;
|
||||
static lv_obj_t * col_line2 = NULL;
|
||||
static lv_obj_t * col_line3 = NULL;
|
||||
static lv_obj_t * col_line4 = NULL;
|
||||
static lv_obj_t * ui_AxisV5 = NULL;
|
||||
static lv_obj_t * ui_AxisV4 = NULL;
|
||||
static lv_obj_t * ui_AxisV3 = NULL;
|
||||
static lv_obj_t * ui_AxisV2 = NULL;
|
||||
static lv_obj_t * ui_AxisV1 = NULL;
|
||||
static lv_obj_t * ui_AxisV = NULL;
|
||||
static lv_obj_t * ui_AxisC = NULL;
|
||||
static lv_obj_t * ui_AxisC1 = NULL;
|
||||
static lv_obj_t * ui_AxisC2 = NULL;
|
||||
static lv_obj_t * ui_AxisC3 = NULL;
|
||||
static lv_obj_t * ui_AxisC4 = NULL;
|
||||
static lv_obj_t * ui_AxisC5 = NULL;
|
||||
static lv_obj_t * ui_PanelVol = NULL;
|
||||
static lv_obj_t * ui_LabelVol = NULL;
|
||||
static lv_obj_t * ui_LabelVolUnit = NULL;
|
||||
static lv_obj_t * ui_PanelCur = NULL;
|
||||
static lv_obj_t * ui_LabelCur1 = NULL;
|
||||
static lv_obj_t * ui_LabelCurUnit = NULL;
|
||||
static lv_obj_t * ui_ButState = NULL;
|
||||
static lv_obj_t * ui_LabelState = NULL;
|
||||
static lv_obj_t * ui_LineVol = NULL; // 电压波形
|
||||
static lv_obj_t * ui_LineCur = NULL; // 电流波形
|
||||
|
||||
static lv_timer_t * chart_update_timer = NULL; // 定时器
|
||||
static bool is_chart_running = true;
|
||||
|
||||
static lv_point_precise_t line_points[4][2] = {{{-170, 36}, {170, 36}}, {{-170, 72},{170, 72}}, {{-170,108},{170,108}}, {{-170, 144},{170, 144}}};
|
||||
static lv_point_precise_t col_points[4][2] = {{{34, -180}, {34, 180}}, {{68, -180},{68, 180}}, {{102, -180},{102, 180}}, {{136, -180},{136, 180}}};
|
||||
|
||||
#define POINTS_NUM 32
|
||||
// 模拟数据数组
|
||||
// 数据数组
|
||||
static lv_point_precise_t vol_points[POINTS_NUM]; // 电压波形点
|
||||
static lv_point_precise_t cur_points[POINTS_NUM]; // 电流波形点
|
||||
static uint8_t data_index = 0;
|
||||
|
||||
// event funtions
|
||||
|
||||
// 定时器回调函数:更新图表数据
|
||||
static void _chart_update_cb(lv_timer_t * timer) {
|
||||
|
||||
}
|
||||
|
||||
#include "key.h"
|
||||
void ui_chart_page_key_handler(void* key_event)
|
||||
{
|
||||
if ( ((key_event_t*)key_event)->id == KEY_ID_B && ((key_event_t*)key_event)->type == KEY_EVT_CLICK )
|
||||
{
|
||||
lv_lib_pm_next();
|
||||
}
|
||||
}
|
||||
|
||||
// build funtions
|
||||
|
||||
void ui_ChartPage_screen_init(void)
|
||||
{
|
||||
ui_ChartPage = lv_obj_create(NULL);
|
||||
lv_obj_remove_flag(ui_ChartPage, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
|
||||
ui_ContainChart = lv_obj_create(ui_ChartPage);
|
||||
lv_obj_remove_style_all(ui_ContainChart);
|
||||
lv_obj_set_width(ui_ContainChart, 170);
|
||||
lv_obj_set_height(ui_ContainChart, 180);
|
||||
lv_obj_set_x(ui_ContainChart, 0);
|
||||
lv_obj_set_y(ui_ContainChart, -15);
|
||||
lv_obj_set_align(ui_ContainChart, LV_ALIGN_CENTER);
|
||||
lv_obj_remove_flag(ui_ContainChart, LV_OBJ_FLAG_CLICKABLE | LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
lv_obj_set_style_bg_color(ui_ContainChart, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_opa(ui_ContainChart, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_color(ui_ContainChart, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_opa(ui_ContainChart, 64, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(ui_ContainChart, 2, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
row_line1 = lv_line_create(ui_ContainChart);
|
||||
lv_line_set_points(row_line1, line_points[0], 2);
|
||||
lv_obj_set_style_line_color(row_line1, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_line_width(row_line1, 1, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_line_opa(row_line1, 64, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_align(row_line1, LV_ALIGN_TOP_MID);
|
||||
|
||||
row_line2 = lv_line_create(ui_ContainChart);
|
||||
lv_line_set_points(row_line2, line_points[1], 2);
|
||||
lv_obj_set_style_line_color(row_line2, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_line_width(row_line2, 1, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_line_opa(row_line2, 64, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_align(row_line2, LV_ALIGN_TOP_MID);
|
||||
|
||||
row_line3 = lv_line_create(ui_ContainChart);
|
||||
lv_line_set_points(row_line3, line_points[2], 2);
|
||||
lv_obj_set_style_line_color(row_line3, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_line_width(row_line3, 1, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_line_opa(row_line3, 64, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_align(row_line3, LV_ALIGN_TOP_MID);
|
||||
|
||||
row_line4 = lv_line_create(ui_ContainChart);
|
||||
lv_line_set_points(row_line4, line_points[3], 2);
|
||||
lv_obj_set_style_line_color(row_line4, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_line_width(row_line4, 1, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_line_opa(row_line4, 64, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_align(row_line4, LV_ALIGN_TOP_MID);
|
||||
|
||||
col_line1 = lv_line_create(ui_ContainChart);
|
||||
lv_line_set_points(col_line1, col_points[0], 2);
|
||||
lv_obj_set_style_line_color(col_line1, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_line_width(col_line1, 1, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_line_opa(col_line1, 64, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_align(col_line1, LV_ALIGN_LEFT_MID);
|
||||
|
||||
col_line2 = lv_line_create(ui_ContainChart);
|
||||
lv_line_set_points(col_line2, col_points[1], 2);
|
||||
lv_obj_set_style_line_color(col_line2, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_line_width(col_line2, 1, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_line_opa(col_line2, 64, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_align(col_line2, LV_ALIGN_LEFT_MID);
|
||||
|
||||
col_line3 = lv_line_create(ui_ContainChart);
|
||||
lv_line_set_points(col_line3, col_points[2], 2);
|
||||
lv_obj_set_style_line_color(col_line3, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_line_width(col_line3, 1, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_line_opa(col_line3, 64, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_align(col_line3, LV_ALIGN_LEFT_MID);
|
||||
|
||||
col_line4 = lv_line_create(ui_ContainChart);
|
||||
lv_line_set_points(col_line4, col_points[3], 2);
|
||||
lv_obj_set_style_line_color(col_line4, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_line_width(col_line4, 1, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_line_opa(col_line4, 64, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_align(col_line4, LV_ALIGN_LEFT_MID);
|
||||
|
||||
ui_AxisV5 = lv_label_create(ui_ChartPage);
|
||||
lv_obj_set_width(ui_AxisV5, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_AxisV5, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_x(ui_AxisV5, 100);
|
||||
lv_obj_set_y(ui_AxisV5, -104);
|
||||
lv_obj_set_align(ui_AxisV5, LV_ALIGN_CENTER);
|
||||
lv_label_set_text(ui_AxisV5, "5.0");
|
||||
lv_obj_set_style_text_color(ui_AxisV5, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_opa(ui_AxisV5, 200, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_AxisV4 = lv_label_create(ui_ChartPage);
|
||||
lv_obj_set_width(ui_AxisV4, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_AxisV4, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_x(ui_AxisV4, 100);
|
||||
lv_obj_set_y(ui_AxisV4, -68);
|
||||
lv_obj_set_align(ui_AxisV4, LV_ALIGN_CENTER);
|
||||
lv_label_set_text(ui_AxisV4, "4.0");
|
||||
lv_obj_set_style_text_color(ui_AxisV4, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_opa(ui_AxisV4, 200, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_AxisV3 = lv_label_create(ui_ChartPage);
|
||||
lv_obj_set_width(ui_AxisV3, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_AxisV3, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_x(ui_AxisV3, 100);
|
||||
lv_obj_set_y(ui_AxisV3, -32);
|
||||
lv_obj_set_align(ui_AxisV3, LV_ALIGN_CENTER);
|
||||
lv_label_set_text(ui_AxisV3, "3.0");
|
||||
lv_obj_set_style_text_color(ui_AxisV3, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_opa(ui_AxisV3, 200, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_AxisV2 = lv_label_create(ui_ChartPage);
|
||||
lv_obj_set_width(ui_AxisV2, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_AxisV2, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_x(ui_AxisV2, 100);
|
||||
lv_obj_set_y(ui_AxisV2, 4);
|
||||
lv_obj_set_align(ui_AxisV2, LV_ALIGN_CENTER);
|
||||
lv_label_set_text(ui_AxisV2, "2.0");
|
||||
lv_obj_set_style_text_color(ui_AxisV2, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_opa(ui_AxisV2, 200, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_AxisV1 = lv_label_create(ui_ChartPage);
|
||||
lv_obj_set_width(ui_AxisV1, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_AxisV1, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_x(ui_AxisV1, 100);
|
||||
lv_obj_set_y(ui_AxisV1, 39);
|
||||
lv_obj_set_align(ui_AxisV1, LV_ALIGN_CENTER);
|
||||
lv_label_set_text(ui_AxisV1, "1.0");
|
||||
lv_obj_set_style_text_color(ui_AxisV1, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_opa(ui_AxisV1, 200, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_AxisV = lv_label_create(ui_ChartPage);
|
||||
lv_obj_set_width(ui_AxisV, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_AxisV, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_x(ui_AxisV, 100);
|
||||
lv_obj_set_y(ui_AxisV, 70);
|
||||
lv_obj_set_align(ui_AxisV, LV_ALIGN_CENTER);
|
||||
lv_label_set_text(ui_AxisV, "V");
|
||||
lv_obj_set_style_text_color(ui_AxisV, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_opa(ui_AxisV, 200, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_AxisC = lv_label_create(ui_ChartPage);
|
||||
lv_obj_set_width(ui_AxisC, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_AxisC, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_x(ui_AxisC, -100);
|
||||
lv_obj_set_y(ui_AxisC, 70);
|
||||
lv_obj_set_align(ui_AxisC, LV_ALIGN_CENTER);
|
||||
lv_label_set_text(ui_AxisC, "A");
|
||||
lv_obj_set_style_text_color(ui_AxisC, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_opa(ui_AxisC, 200, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_AxisC1 = lv_label_create(ui_ChartPage);
|
||||
lv_obj_set_width(ui_AxisC1, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_AxisC1, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_x(ui_AxisC1, -100);
|
||||
lv_obj_set_y(ui_AxisC1, 39);
|
||||
lv_obj_set_align(ui_AxisC1, LV_ALIGN_CENTER);
|
||||
lv_label_set_text(ui_AxisC1, "0.4");
|
||||
lv_obj_set_style_text_color(ui_AxisC1, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_opa(ui_AxisC1, 200, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_AxisC2 = lv_label_create(ui_ChartPage);
|
||||
lv_obj_set_width(ui_AxisC2, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_AxisC2, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_x(ui_AxisC2, -100);
|
||||
lv_obj_set_y(ui_AxisC2, 4);
|
||||
lv_obj_set_align(ui_AxisC2, LV_ALIGN_CENTER);
|
||||
lv_label_set_text(ui_AxisC2, "0.8");
|
||||
lv_obj_set_style_text_color(ui_AxisC2, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_opa(ui_AxisC2, 200, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_AxisC3 = lv_label_create(ui_ChartPage);
|
||||
lv_obj_set_width(ui_AxisC3, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_AxisC3, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_x(ui_AxisC3, -100);
|
||||
lv_obj_set_y(ui_AxisC3, -32);
|
||||
lv_obj_set_align(ui_AxisC3, LV_ALIGN_CENTER);
|
||||
lv_label_set_text(ui_AxisC3, "1.2");
|
||||
lv_obj_set_style_text_color(ui_AxisC3, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_opa(ui_AxisC3, 200, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_AxisC4 = lv_label_create(ui_ChartPage);
|
||||
lv_obj_set_width(ui_AxisC4, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_AxisC4, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_x(ui_AxisC4, -100);
|
||||
lv_obj_set_y(ui_AxisC4, -68);
|
||||
lv_obj_set_align(ui_AxisC4, LV_ALIGN_CENTER);
|
||||
lv_label_set_text(ui_AxisC4, "1.6");
|
||||
lv_obj_set_style_text_color(ui_AxisC4, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_opa(ui_AxisC4, 200, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_AxisC5 = lv_label_create(ui_ChartPage);
|
||||
lv_obj_set_width(ui_AxisC5, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_AxisC5, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_x(ui_AxisC5, -100);
|
||||
lv_obj_set_y(ui_AxisC5, -104);
|
||||
lv_obj_set_align(ui_AxisC5, LV_ALIGN_CENTER);
|
||||
lv_label_set_text(ui_AxisC5, "2.0");
|
||||
lv_obj_set_style_text_color(ui_AxisC5, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_opa(ui_AxisC5, 200, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_PanelVol = lv_obj_create(ui_ChartPage);
|
||||
lv_obj_set_width(ui_PanelVol, 80);
|
||||
lv_obj_set_height(ui_PanelVol, 35);
|
||||
lv_obj_set_x(ui_PanelVol, -30);
|
||||
lv_obj_set_y(ui_PanelVol, -5);
|
||||
lv_obj_set_align(ui_PanelVol, LV_ALIGN_BOTTOM_MID);
|
||||
lv_obj_remove_flag(ui_PanelVol, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
lv_obj_set_style_bg_color(ui_PanelVol, lv_color_hex(0xE36666), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_opa(ui_PanelVol, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_LabelVol = lv_label_create(ui_PanelVol);
|
||||
lv_obj_set_width(ui_LabelVol, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelVol, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_x(ui_LabelVol, -12);
|
||||
lv_obj_set_y(ui_LabelVol, 0);
|
||||
lv_obj_set_align(ui_LabelVol, LV_ALIGN_RIGHT_MID);
|
||||
lv_label_set_text(ui_LabelVol, "5.42");
|
||||
lv_obj_set_style_text_font(ui_LabelVol, &lv_font_montserrat_18, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_LabelVolUnit = lv_label_create(ui_PanelVol);
|
||||
lv_obj_set_width(ui_LabelVolUnit, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelVolUnit, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_x(ui_LabelVolUnit, 5);
|
||||
lv_obj_set_y(ui_LabelVolUnit, 0);
|
||||
lv_obj_set_align(ui_LabelVolUnit, LV_ALIGN_RIGHT_MID);
|
||||
lv_label_set_text(ui_LabelVolUnit, "V");
|
||||
lv_obj_set_style_text_font(ui_LabelVolUnit, &lv_font_montserrat_18, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_PanelCur = lv_obj_create(ui_ChartPage);
|
||||
lv_obj_set_width(ui_PanelCur, 100);
|
||||
lv_obj_set_height(ui_PanelCur, 35);
|
||||
lv_obj_set_x(ui_PanelCur, 60);
|
||||
lv_obj_set_y(ui_PanelCur, -5);
|
||||
lv_obj_set_align(ui_PanelCur, LV_ALIGN_BOTTOM_MID);
|
||||
lv_obj_remove_flag(ui_PanelCur, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
lv_obj_set_style_bg_color(ui_PanelCur, lv_color_hex(0x42AA49), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_opa(ui_PanelCur, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_LabelCur1 = lv_label_create(ui_PanelCur);
|
||||
lv_obj_set_width(ui_LabelCur1, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelCur1, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_x(ui_LabelCur1, -30);
|
||||
lv_obj_set_y(ui_LabelCur1, 0);
|
||||
lv_obj_set_align(ui_LabelCur1, LV_ALIGN_RIGHT_MID);
|
||||
lv_label_set_text(ui_LabelCur1, "15.23");
|
||||
lv_obj_set_style_text_font(ui_LabelCur1, &lv_font_montserrat_18, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_LabelCurUnit = lv_label_create(ui_PanelCur);
|
||||
lv_obj_set_width(ui_LabelCurUnit, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelCurUnit, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_x(ui_LabelCurUnit, 5);
|
||||
lv_obj_set_y(ui_LabelCurUnit, 0);
|
||||
lv_obj_set_align(ui_LabelCurUnit, LV_ALIGN_RIGHT_MID);
|
||||
lv_label_set_text(ui_LabelCurUnit, "mA");
|
||||
lv_obj_set_style_text_font(ui_LabelCurUnit, &lv_font_montserrat_18, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_ButState = lv_button_create(ui_ChartPage);
|
||||
lv_obj_set_width(ui_ButState, 35);
|
||||
lv_obj_set_height(ui_ButState, 32);
|
||||
lv_obj_set_x(ui_ButState, -90);
|
||||
lv_obj_set_y(ui_ButState, -7);
|
||||
lv_obj_set_align(ui_ButState, LV_ALIGN_BOTTOM_MID);
|
||||
lv_obj_add_flag(ui_ButState, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
|
||||
lv_obj_remove_flag(ui_ButState, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
lv_obj_set_style_bg_color(ui_ButState, lv_color_hex(0xF03737), LV_PART_MAIN | LV_STATE_CHECKED);
|
||||
lv_obj_set_style_bg_opa(ui_ButState, 255, LV_PART_MAIN | LV_STATE_CHECKED);
|
||||
|
||||
ui_LabelState = lv_label_create(ui_ButState);
|
||||
lv_obj_set_width(ui_LabelState, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelState, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_align(ui_LabelState, LV_ALIGN_CENTER);
|
||||
lv_label_set_text(ui_LabelState, LV_SYMBOL_PLAY);
|
||||
|
||||
// timer
|
||||
chart_update_timer = lv_timer_create(_chart_update_cb, 100, NULL); // 每100ms更新一次数据
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ui_ChartPage_screen_destroy(void)
|
||||
{
|
||||
if (chart_update_timer) {
|
||||
lv_timer_delete(chart_update_timer);
|
||||
chart_update_timer = NULL;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
// This file was generated by SquareLine Studio
|
||||
// SquareLine Studio version: SquareLine Studio 1.5.3
|
||||
// LVGL version: 9.2.2
|
||||
// Project name: PowerPico
|
||||
|
||||
#ifndef UI_CHARTPAGE_H
|
||||
#define UI_CHARTPAGE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// SCREEN: ui_ChartPage
|
||||
extern void ui_ChartPage_screen_init(void);
|
||||
extern void ui_ChartPage_screen_destroy(void);
|
||||
extern lv_obj_t * ui_ChartPage;
|
||||
void ui_chart_page_key_handler(void *key_event);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,637 +0,0 @@
|
||||
// This file was generated by SquareLine Studio
|
||||
// SquareLine Studio version: SquareLine Studio 1.5.4
|
||||
// LVGL version: 9.2.2
|
||||
// Project name: PowerPico
|
||||
|
||||
#include "../ui.h"
|
||||
|
||||
lv_obj_t * ui_PPSPage = NULL;
|
||||
static lv_obj_t * ui_PanelPPSVol = NULL;
|
||||
static lv_obj_t * ui_LabelPPSVol = NULL;
|
||||
static lv_obj_t * ui_LabelPPSVolUnit = NULL;
|
||||
static lv_obj_t * ui_PanelPPSCur = NULL;
|
||||
static lv_obj_t * ui_LabelPPSCur = NULL;
|
||||
static lv_obj_t * ui_LabelPPSCurUnit = NULL;
|
||||
static lv_obj_t * ui_Spinner1 = NULL;
|
||||
static lv_obj_t * ui_PanelPPS = NULL;
|
||||
static lv_obj_t * ui_BtnSet1 = NULL;
|
||||
static lv_obj_t * ui_LabelSet1 = NULL;
|
||||
static lv_obj_t * ui_BtnSet2 = NULL;
|
||||
static lv_obj_t * ui_LabelSet2 = NULL;
|
||||
static lv_obj_t * ui_BtnSet3 = NULL;
|
||||
static lv_obj_t * ui_LabelSet3 = NULL;
|
||||
static lv_obj_t * ui_BtnSet4 = NULL;
|
||||
static lv_obj_t * ui_LabelSet4 = NULL;
|
||||
static lv_obj_t * ui_BtnSet5 = NULL;
|
||||
static lv_obj_t * ui_LabelSet5 = NULL;
|
||||
static lv_obj_t * ui_BtnSet6 = NULL;
|
||||
static lv_obj_t * ui_LabelSet6 = NULL;
|
||||
static lv_obj_t * ui_BtnValSet = NULL;
|
||||
static lv_obj_t * ui_LabelValSet = NULL;
|
||||
static lv_obj_t * ui_BtnValDec = NULL;
|
||||
static lv_obj_t * ui_LabelValDec = NULL;
|
||||
static lv_obj_t * ui_BtnValInc = NULL;
|
||||
static lv_obj_t * ui_LabelValInc = NULL;
|
||||
static lv_obj_t * ui_BtnCurSet = NULL;
|
||||
static lv_obj_t * ui_LabelCurSet = NULL;
|
||||
static lv_obj_t * ui_BtnCurDec = NULL;
|
||||
static lv_obj_t * ui_LabelCurDec = NULL;
|
||||
static lv_obj_t * ui_BtnCurInc = NULL;
|
||||
static lv_obj_t * ui_LabelCurInc = NULL;
|
||||
static lv_obj_t * ui_BtnSwitch = NULL;
|
||||
static lv_obj_t * ui_LabelSwitch = NULL;
|
||||
static lv_obj_t * ui_BtnClose = NULL;
|
||||
static lv_obj_t * ui_LabelClose = NULL;
|
||||
|
||||
static lv_timer_t* ui_pps_timer = NULL;
|
||||
|
||||
// variables
|
||||
|
||||
static uint8_t pps_voltage_index = 0; // 6-settings: 0:5V, 1:9V, 2:12V, 3:15V, 4:18V, 5:20V
|
||||
static uint8_t pps_panel_index = 1; // 1 or 2
|
||||
static lv_obj_t * btns[14]; // 存储所有 btn 的指针
|
||||
static int current_btn_index = 0; // 当前选中的 btn 索引
|
||||
|
||||
static float cur_voltage = 5.0;
|
||||
static float cur_current = 1.0;
|
||||
|
||||
///////////////// timer functions ///////////////////
|
||||
|
||||
static void _flush_timer_cb(void) {
|
||||
// 刷新 PPS 电压电流显示
|
||||
char buf[5];
|
||||
float voltage = 0.0;
|
||||
float current = 0.0;
|
||||
ui_get_vol_cur(&voltage, ¤t);
|
||||
sprintf(buf, "%.2f", voltage);
|
||||
lv_label_set_text(ui_LabelPPSVol, buf);
|
||||
sprintf(buf, "%.2f", current/1000000.0); // 转换为 A
|
||||
lv_label_set_text(ui_LabelPPSCur, buf);
|
||||
}
|
||||
|
||||
///////////////// key function ///////////////////
|
||||
|
||||
static void _set_label_val_cur(void) {
|
||||
char buf[8];
|
||||
sprintf(buf, "%.2f V", cur_voltage);
|
||||
lv_label_set_text(ui_LabelValSet, buf);
|
||||
sprintf(buf, "%.2f A", cur_current);
|
||||
lv_label_set_text(ui_LabelCurSet, buf);
|
||||
}
|
||||
|
||||
static void _switch_pps_panel(void)
|
||||
{
|
||||
if(pps_panel_index == 1)
|
||||
{
|
||||
lv_lib_anim_user_animation(ui_PanelPPS, 0, 500, 120, -120, 0, 0, 0, 0, lv_anim_path_ease_in_out, lv_lib_anim_callback_set_x, NULL);
|
||||
pps_panel_index = 2;
|
||||
// 取消当前对象红色边框
|
||||
lv_obj_set_style_border_width(btns[current_btn_index], 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
current_btn_index = 8;
|
||||
// 设置当前对象红色边框
|
||||
lv_obj_set_style_border_width(btns[current_btn_index], 3, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_label_set_text(ui_LabelSwitch, _("press here to Fixed Set"));
|
||||
if(ui_get_language_select() == 0)
|
||||
lv_obj_set_style_text_font(ui_LabelSwitch, &lv_font_montserrat_18, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
else
|
||||
lv_obj_set_style_text_font(ui_LabelSwitch, &ui_font_zhongyuan20, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
_set_label_val_cur();
|
||||
}
|
||||
else
|
||||
{
|
||||
lv_lib_anim_user_animation(ui_PanelPPS, 0, 500, -120, 120, 0, 0, 0, 0, lv_anim_path_ease_in_out, lv_lib_anim_callback_set_x, NULL);
|
||||
pps_panel_index = 1;
|
||||
// 取消当前对象红色边框
|
||||
lv_obj_set_style_border_width(btns[current_btn_index], 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
current_btn_index = 0;
|
||||
// 设置当前对象红色边框
|
||||
lv_obj_set_style_border_width(btns[current_btn_index], 3, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_label_set_text(ui_LabelSwitch, _("press to Step Adjust"));
|
||||
if(ui_get_language_select() == 0)
|
||||
lv_obj_set_style_text_font(ui_LabelSwitch, &lv_font_montserrat_18, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
else
|
||||
lv_obj_set_style_text_font(ui_LabelSwitch, &ui_font_zhongyuan20, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
static void _switch_btn(bool inc)
|
||||
{
|
||||
// 取消当前对象红色边框
|
||||
lv_obj_set_style_border_width(btns[current_btn_index], 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
// 加减
|
||||
if(inc) {
|
||||
current_btn_index++;
|
||||
if (pps_panel_index == 1 && current_btn_index > 7) {
|
||||
current_btn_index = 0;
|
||||
}
|
||||
else if (pps_panel_index == 2 && current_btn_index > 13) {
|
||||
current_btn_index = 8;
|
||||
}
|
||||
} else {
|
||||
if (pps_panel_index == 1) {
|
||||
if (current_btn_index == 0) {
|
||||
current_btn_index = 7;
|
||||
} else {
|
||||
current_btn_index--;
|
||||
}
|
||||
}
|
||||
else if (pps_panel_index == 2) {
|
||||
if (current_btn_index == 8) {
|
||||
current_btn_index = 13;
|
||||
} else {
|
||||
current_btn_index--;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 设置当前对象红色边框
|
||||
lv_obj_set_style_border_width(btns[current_btn_index], 3, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
}
|
||||
|
||||
#include "key.h"
|
||||
void ui_pps_page_key_handler(void* key_event)
|
||||
{
|
||||
if(((key_event_t*)key_event)->id == KEY_ID_B && ((key_event_t*)key_event)->type == KEY_EVT_CLICK)
|
||||
{
|
||||
_switch_pps_panel();
|
||||
}
|
||||
else if(((key_event_t*)key_event)->id == KEY_ID_L || ((key_event_t*)key_event)->id == KEY_ID_R)
|
||||
{
|
||||
if (((key_event_t*)key_event)->id == KEY_ID_R) {
|
||||
_switch_btn(1);
|
||||
} else if (((key_event_t*)key_event)->id == KEY_ID_L) {
|
||||
_switch_btn(0);
|
||||
}
|
||||
}
|
||||
else if (((key_event_t*)key_event)->id == KEY_ID_Y)
|
||||
{
|
||||
switch (current_btn_index)
|
||||
{
|
||||
// 6和12 切换 pps panel
|
||||
case 6:
|
||||
_switch_pps_panel();
|
||||
break;
|
||||
case 12:
|
||||
_switch_pps_panel();
|
||||
break;
|
||||
// 7和13 关闭 PPS
|
||||
case 7:
|
||||
ui_send_pps_stop_msg();
|
||||
lv_lib_pm_goto("Set Page", NULL);
|
||||
break;
|
||||
case 13:
|
||||
ui_send_pps_stop_msg();
|
||||
lv_lib_pm_goto("Set Page", NULL);
|
||||
break;
|
||||
case 0:
|
||||
cur_voltage = 5.0;
|
||||
cur_current = 1.0;
|
||||
ui_send_pps_set_msg(cur_voltage, cur_current);
|
||||
break;
|
||||
case 1:
|
||||
cur_voltage = 9.0;
|
||||
cur_current = 1.0;
|
||||
ui_send_pps_set_msg(cur_voltage, cur_current);
|
||||
break;
|
||||
case 2:
|
||||
cur_voltage = 12.0;
|
||||
cur_current = 1.0;
|
||||
ui_send_pps_set_msg(cur_voltage, cur_current);
|
||||
break;
|
||||
case 3:
|
||||
cur_voltage = 15.0;
|
||||
cur_current = 1.0;
|
||||
ui_send_pps_set_msg(cur_voltage, cur_current);
|
||||
break;
|
||||
case 4:
|
||||
cur_voltage = 18.0;
|
||||
cur_current = 1.0;
|
||||
ui_send_pps_set_msg(cur_voltage, cur_current);
|
||||
break;
|
||||
case 5:
|
||||
cur_voltage = 20.0;
|
||||
cur_current = 1.0;
|
||||
ui_send_pps_set_msg(cur_voltage, cur_current);
|
||||
break;
|
||||
case 8:
|
||||
cur_voltage -= 0.1;
|
||||
if (cur_voltage < 5.0) cur_voltage = 5.0;
|
||||
ui_send_pps_set_msg(cur_voltage, cur_current);
|
||||
break;
|
||||
case 9:
|
||||
cur_voltage += 0.1;
|
||||
if (cur_voltage > 20.0) cur_voltage = 20.0;
|
||||
ui_send_pps_set_msg(cur_voltage, cur_current);
|
||||
break;
|
||||
case 10:
|
||||
cur_current -= 0.1;
|
||||
if (cur_current < 1.0) cur_current = 1.0;
|
||||
ui_send_pps_set_msg(cur_voltage, cur_current);
|
||||
break;
|
||||
case 11:
|
||||
cur_current += 0.1;
|
||||
if (cur_current > 3.0) cur_current = 3.0;
|
||||
ui_send_pps_set_msg(cur_voltage, cur_current);
|
||||
break;
|
||||
}
|
||||
_set_label_val_cur();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/////////////////////// para_initialize //////////////////////
|
||||
static void _para_init(void) {
|
||||
current_btn_index = 0;
|
||||
pps_voltage_index = 0;
|
||||
pps_panel_index = 1;
|
||||
cur_voltage = 5.0;
|
||||
cur_current = 1.0;
|
||||
}
|
||||
|
||||
/////////////////////// ui_initialize //////////////////////
|
||||
|
||||
void ui_PPSPage_screen_init(void)
|
||||
{
|
||||
ui_PPSPage = lv_obj_create(NULL);
|
||||
lv_obj_remove_flag(ui_PPSPage, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
|
||||
ui_PanelPPSVol = lv_obj_create(ui_PPSPage);
|
||||
lv_obj_set_width(ui_PanelPPSVol, 80);
|
||||
lv_obj_set_height(ui_PanelPPSVol, 35);
|
||||
lv_obj_set_x(ui_PanelPPSVol, -30);
|
||||
lv_obj_set_y(ui_PanelPPSVol, 10);
|
||||
lv_obj_set_align(ui_PanelPPSVol, LV_ALIGN_TOP_MID);
|
||||
lv_obj_remove_flag(ui_PanelPPSVol, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
lv_obj_set_style_bg_color(ui_PanelPPSVol, lv_color_hex(0xE36666), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_opa(ui_PanelPPSVol, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_LabelPPSVol = lv_label_create(ui_PanelPPSVol);
|
||||
lv_obj_set_width(ui_LabelPPSVol, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelPPSVol, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_x(ui_LabelPPSVol, -12);
|
||||
lv_obj_set_y(ui_LabelPPSVol, 0);
|
||||
lv_obj_set_align(ui_LabelPPSVol, LV_ALIGN_RIGHT_MID);
|
||||
lv_label_set_text(ui_LabelPPSVol, "5.42");
|
||||
lv_obj_set_style_text_font(ui_LabelPPSVol, &lv_font_montserrat_18, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_LabelPPSVolUnit = lv_label_create(ui_PanelPPSVol);
|
||||
lv_obj_set_width(ui_LabelPPSVolUnit, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelPPSVolUnit, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_x(ui_LabelPPSVolUnit, 5);
|
||||
lv_obj_set_y(ui_LabelPPSVolUnit, 0);
|
||||
lv_obj_set_align(ui_LabelPPSVolUnit, LV_ALIGN_RIGHT_MID);
|
||||
lv_label_set_text(ui_LabelPPSVolUnit, "V");
|
||||
lv_obj_set_style_text_font(ui_LabelPPSVolUnit, &lv_font_montserrat_18, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_PanelPPSCur = lv_obj_create(ui_PPSPage);
|
||||
lv_obj_set_width(ui_PanelPPSCur, 80);
|
||||
lv_obj_set_height(ui_PanelPPSCur, 35);
|
||||
lv_obj_set_x(ui_PanelPPSCur, 60);
|
||||
lv_obj_set_y(ui_PanelPPSCur, 10);
|
||||
lv_obj_set_align(ui_PanelPPSCur, LV_ALIGN_TOP_MID);
|
||||
lv_obj_remove_flag(ui_PanelPPSCur, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
lv_obj_set_style_bg_color(ui_PanelPPSCur, lv_color_hex(0x42AA49), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_opa(ui_PanelPPSCur, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_LabelPPSCur = lv_label_create(ui_PanelPPSCur);
|
||||
lv_obj_set_width(ui_LabelPPSCur, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelPPSCur, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_x(ui_LabelPPSCur, -12);
|
||||
lv_obj_set_y(ui_LabelPPSCur, 0);
|
||||
lv_obj_set_align(ui_LabelPPSCur, LV_ALIGN_RIGHT_MID);
|
||||
lv_label_set_text(ui_LabelPPSCur, "2.25");
|
||||
lv_obj_set_style_text_font(ui_LabelPPSCur, &lv_font_montserrat_18, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_LabelPPSCurUnit = lv_label_create(ui_PanelPPSCur);
|
||||
lv_obj_set_width(ui_LabelPPSCurUnit, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelPPSCurUnit, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_x(ui_LabelPPSCurUnit, 5);
|
||||
lv_obj_set_y(ui_LabelPPSCurUnit, 0);
|
||||
lv_obj_set_align(ui_LabelPPSCurUnit, LV_ALIGN_RIGHT_MID);
|
||||
lv_label_set_text(ui_LabelPPSCurUnit, "A");
|
||||
lv_obj_set_style_text_font(ui_LabelPPSCurUnit, &lv_font_montserrat_18, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_Spinner1 = lv_spinner_create(ui_PPSPage);
|
||||
//lv_spinner_set_anim_params(ui_Spinner1, 1000, 90);
|
||||
lv_obj_set_width(ui_Spinner1, 25);
|
||||
lv_obj_set_height(ui_Spinner1, 25);
|
||||
lv_obj_set_x(ui_Spinner1, -90);
|
||||
lv_obj_set_y(ui_Spinner1, 15);
|
||||
lv_obj_set_align(ui_Spinner1, LV_ALIGN_TOP_MID);
|
||||
lv_obj_remove_flag(ui_Spinner1, LV_OBJ_FLAG_CLICKABLE); /// Flags
|
||||
lv_obj_set_style_arc_width(ui_Spinner1, 5, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
lv_obj_set_style_arc_width(ui_Spinner1, 5, LV_PART_INDICATOR | LV_STATE_DEFAULT);
|
||||
|
||||
ui_PanelPPS = lv_obj_create(ui_PPSPage);
|
||||
lv_obj_set_width(ui_PanelPPS, 480);
|
||||
lv_obj_set_height(ui_PanelPPS, 110);
|
||||
lv_obj_set_x(ui_PanelPPS, 120);
|
||||
lv_obj_set_y(ui_PanelPPS, -10);
|
||||
lv_obj_set_align(ui_PanelPPS, LV_ALIGN_CENTER);
|
||||
lv_obj_remove_flag(ui_PanelPPS, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
lv_obj_set_style_bg_color(ui_PanelPPS, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_opa(ui_PanelPPS, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_color(ui_PanelPPS, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_opa(ui_PanelPPS, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_BtnSet1 = lv_button_create(ui_PanelPPS);
|
||||
lv_obj_set_width(ui_BtnSet1, 100);
|
||||
lv_obj_set_height(ui_BtnSet1, 30);
|
||||
lv_obj_set_x(ui_BtnSet1, -175);
|
||||
lv_obj_set_y(ui_BtnSet1, -35);
|
||||
lv_obj_set_align(ui_BtnSet1, LV_ALIGN_CENTER);
|
||||
lv_obj_add_flag(ui_BtnSet1, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
|
||||
lv_obj_remove_flag(ui_BtnSet1, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
lv_obj_set_style_border_color(ui_BtnSet1, lv_color_hex(0xF40F0F), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_opa(ui_BtnSet1, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(ui_BtnSet1, 3, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_LabelSet1 = lv_label_create(ui_BtnSet1);
|
||||
lv_obj_set_width(ui_LabelSet1, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelSet1, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_align(ui_LabelSet1, LV_ALIGN_CENTER);
|
||||
lv_label_set_text(ui_LabelSet1, "5V 1A");
|
||||
lv_obj_set_style_text_font(ui_LabelSet1, &lv_font_montserrat_18, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_BtnSet2 = lv_button_create(ui_PanelPPS);
|
||||
lv_obj_set_width(ui_BtnSet2, 100);
|
||||
lv_obj_set_height(ui_BtnSet2, 30);
|
||||
lv_obj_set_x(ui_BtnSet2, -65);
|
||||
lv_obj_set_y(ui_BtnSet2, -35);
|
||||
lv_obj_set_align(ui_BtnSet2, LV_ALIGN_CENTER);
|
||||
lv_obj_add_flag(ui_BtnSet2, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
|
||||
lv_obj_remove_flag(ui_BtnSet2, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
lv_obj_set_style_border_color(ui_BtnSet2, lv_color_hex(0xF40F0F), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_opa(ui_BtnSet2, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(ui_BtnSet2, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_LabelSet2 = lv_label_create(ui_BtnSet2);
|
||||
lv_obj_set_width(ui_LabelSet2, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelSet2, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_align(ui_LabelSet2, LV_ALIGN_CENTER);
|
||||
lv_label_set_text(ui_LabelSet2, "9V 1A");
|
||||
lv_obj_set_style_text_font(ui_LabelSet2, &lv_font_montserrat_18, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_BtnSet3 = lv_button_create(ui_PanelPPS);
|
||||
lv_obj_set_width(ui_BtnSet3, 100);
|
||||
lv_obj_set_height(ui_BtnSet3, 30);
|
||||
lv_obj_set_x(ui_BtnSet3, -175);
|
||||
lv_obj_set_y(ui_BtnSet3, 0);
|
||||
lv_obj_set_align(ui_BtnSet3, LV_ALIGN_CENTER);
|
||||
lv_obj_add_flag(ui_BtnSet3, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
|
||||
lv_obj_remove_flag(ui_BtnSet3, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
lv_obj_set_style_border_color(ui_BtnSet3, lv_color_hex(0xF40F0F), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_opa(ui_BtnSet3, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(ui_BtnSet3, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_LabelSet3 = lv_label_create(ui_BtnSet3);
|
||||
lv_obj_set_width(ui_LabelSet3, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelSet3, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_align(ui_LabelSet3, LV_ALIGN_CENTER);
|
||||
lv_label_set_text(ui_LabelSet3, "12V 1A");
|
||||
lv_obj_set_style_text_font(ui_LabelSet3, &lv_font_montserrat_18, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_BtnSet4 = lv_button_create(ui_PanelPPS);
|
||||
lv_obj_set_width(ui_BtnSet4, 100);
|
||||
lv_obj_set_height(ui_BtnSet4, 30);
|
||||
lv_obj_set_x(ui_BtnSet4, -65);
|
||||
lv_obj_set_y(ui_BtnSet4, 0);
|
||||
lv_obj_set_align(ui_BtnSet4, LV_ALIGN_CENTER);
|
||||
lv_obj_add_flag(ui_BtnSet4, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
|
||||
lv_obj_remove_flag(ui_BtnSet4, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
lv_obj_set_style_border_color(ui_BtnSet4, lv_color_hex(0xF40F0F), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_opa(ui_BtnSet4, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(ui_BtnSet4, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_LabelSet4 = lv_label_create(ui_BtnSet4);
|
||||
lv_obj_set_width(ui_LabelSet4, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelSet4, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_align(ui_LabelSet4, LV_ALIGN_CENTER);
|
||||
lv_label_set_text(ui_LabelSet4, "15V 1A");
|
||||
lv_obj_set_style_text_font(ui_LabelSet4, &lv_font_montserrat_18, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_BtnSet5 = lv_button_create(ui_PanelPPS);
|
||||
lv_obj_set_width(ui_BtnSet5, 100);
|
||||
lv_obj_set_height(ui_BtnSet5, 30);
|
||||
lv_obj_set_x(ui_BtnSet5, -175);
|
||||
lv_obj_set_y(ui_BtnSet5, 35);
|
||||
lv_obj_set_align(ui_BtnSet5, LV_ALIGN_CENTER);
|
||||
lv_obj_add_flag(ui_BtnSet5, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
|
||||
lv_obj_remove_flag(ui_BtnSet5, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
lv_obj_set_style_border_color(ui_BtnSet5, lv_color_hex(0xF40F0F), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_opa(ui_BtnSet5, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(ui_BtnSet5, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_LabelSet5 = lv_label_create(ui_BtnSet5);
|
||||
lv_obj_set_width(ui_LabelSet5, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelSet5, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_align(ui_LabelSet5, LV_ALIGN_CENTER);
|
||||
lv_label_set_text(ui_LabelSet5, "18V 1A");
|
||||
lv_obj_set_style_text_font(ui_LabelSet5, &lv_font_montserrat_18, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_BtnSet6 = lv_button_create(ui_PanelPPS);
|
||||
lv_obj_set_width(ui_BtnSet6, 100);
|
||||
lv_obj_set_height(ui_BtnSet6, 30);
|
||||
lv_obj_set_x(ui_BtnSet6, -65);
|
||||
lv_obj_set_y(ui_BtnSet6, 35);
|
||||
lv_obj_set_align(ui_BtnSet6, LV_ALIGN_CENTER);
|
||||
lv_obj_add_flag(ui_BtnSet6, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
|
||||
lv_obj_remove_flag(ui_BtnSet6, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
lv_obj_set_style_border_color(ui_BtnSet6, lv_color_hex(0xF40F0F), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_opa(ui_BtnSet6, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(ui_BtnSet6, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_LabelSet6 = lv_label_create(ui_BtnSet6);
|
||||
lv_obj_set_width(ui_LabelSet6, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelSet6, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_align(ui_LabelSet6, LV_ALIGN_CENTER);
|
||||
lv_label_set_text(ui_LabelSet6, "20V 1A");
|
||||
lv_obj_set_style_text_font(ui_LabelSet6, &lv_font_montserrat_18, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_BtnValSet = lv_button_create(ui_PanelPPS);
|
||||
lv_obj_set_width(ui_BtnValSet, 100);
|
||||
lv_obj_set_height(ui_BtnValSet, 40);
|
||||
lv_obj_set_x(ui_BtnValSet, 120);
|
||||
lv_obj_set_y(ui_BtnValSet, -25);
|
||||
lv_obj_set_align(ui_BtnValSet, LV_ALIGN_CENTER);
|
||||
lv_obj_add_flag(ui_BtnValSet, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
|
||||
lv_obj_remove_flag(ui_BtnValSet, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
|
||||
ui_LabelValSet = lv_label_create(ui_BtnValSet);
|
||||
lv_obj_set_width(ui_LabelValSet, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelValSet, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_align(ui_LabelValSet, LV_ALIGN_CENTER);
|
||||
lv_label_set_text(ui_LabelValSet, "5.00 V");
|
||||
lv_obj_set_style_text_font(ui_LabelValSet, &lv_font_montserrat_18, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_BtnValDec = lv_button_create(ui_PanelPPS);
|
||||
lv_obj_set_width(ui_BtnValDec, 30);
|
||||
lv_obj_set_height(ui_BtnValDec, 30);
|
||||
lv_obj_set_x(ui_BtnValDec, 45);
|
||||
lv_obj_set_y(ui_BtnValDec, -25);
|
||||
lv_obj_set_align(ui_BtnValDec, LV_ALIGN_CENTER);
|
||||
lv_obj_add_flag(ui_BtnValDec, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
|
||||
lv_obj_remove_flag(ui_BtnValDec, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
lv_obj_set_style_border_color(ui_BtnValDec, lv_color_hex(0xF40F0F), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_opa(ui_BtnValDec, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(ui_BtnValDec, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_LabelValDec = lv_label_create(ui_BtnValDec);
|
||||
lv_obj_set_width(ui_LabelValDec, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelValDec, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_x(ui_LabelValDec, 0);
|
||||
lv_obj_set_y(ui_LabelValDec, -7);
|
||||
lv_obj_set_align(ui_LabelValDec, LV_ALIGN_CENTER);
|
||||
lv_label_set_text(ui_LabelValDec, "_");
|
||||
lv_obj_set_style_text_font(ui_LabelValDec, &lv_font_montserrat_20, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_BtnValInc = lv_button_create(ui_PanelPPS);
|
||||
lv_obj_set_width(ui_BtnValInc, 30);
|
||||
lv_obj_set_height(ui_BtnValInc, 30);
|
||||
lv_obj_set_x(ui_BtnValInc, 195);
|
||||
lv_obj_set_y(ui_BtnValInc, -25);
|
||||
lv_obj_set_align(ui_BtnValInc, LV_ALIGN_CENTER);
|
||||
lv_obj_add_flag(ui_BtnValInc, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
|
||||
lv_obj_remove_flag(ui_BtnValInc, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
lv_obj_set_style_border_color(ui_BtnValInc, lv_color_hex(0xF40F0F), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_opa(ui_BtnValInc, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(ui_BtnValInc, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_LabelValInc = lv_label_create(ui_BtnValInc);
|
||||
lv_obj_set_width(ui_LabelValInc, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelValInc, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_align(ui_LabelValInc, LV_ALIGN_CENTER);
|
||||
lv_label_set_text(ui_LabelValInc, "+");
|
||||
lv_obj_set_style_text_font(ui_LabelValInc, &lv_font_montserrat_22, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_BtnCurSet = lv_button_create(ui_PanelPPS);
|
||||
lv_obj_set_width(ui_BtnCurSet, 100);
|
||||
lv_obj_set_height(ui_BtnCurSet, 40);
|
||||
lv_obj_set_x(ui_BtnCurSet, 120);
|
||||
lv_obj_set_y(ui_BtnCurSet, 25);
|
||||
lv_obj_set_align(ui_BtnCurSet, LV_ALIGN_CENTER);
|
||||
lv_obj_add_flag(ui_BtnCurSet, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
|
||||
lv_obj_remove_flag(ui_BtnCurSet, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
|
||||
ui_LabelCurSet = lv_label_create(ui_BtnCurSet);
|
||||
lv_obj_set_width(ui_LabelCurSet, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelCurSet, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_align(ui_LabelCurSet, LV_ALIGN_CENTER);
|
||||
lv_label_set_text(ui_LabelCurSet, "1.00 A");
|
||||
lv_obj_set_style_text_font(ui_LabelCurSet, &lv_font_montserrat_18, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_BtnCurDec = lv_button_create(ui_PanelPPS);
|
||||
lv_obj_set_width(ui_BtnCurDec, 30);
|
||||
lv_obj_set_height(ui_BtnCurDec, 30);
|
||||
lv_obj_set_x(ui_BtnCurDec, 45);
|
||||
lv_obj_set_y(ui_BtnCurDec, 25);
|
||||
lv_obj_set_align(ui_BtnCurDec, LV_ALIGN_CENTER);
|
||||
lv_obj_add_flag(ui_BtnCurDec, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
|
||||
lv_obj_remove_flag(ui_BtnCurDec, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
lv_obj_set_style_border_color(ui_BtnCurDec, lv_color_hex(0xF40F0F), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_opa(ui_BtnCurDec, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(ui_BtnCurDec, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_LabelCurDec = lv_label_create(ui_BtnCurDec);
|
||||
lv_obj_set_width(ui_LabelCurDec, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelCurDec, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_x(ui_LabelCurDec, 0);
|
||||
lv_obj_set_y(ui_LabelCurDec, -7);
|
||||
lv_obj_set_align(ui_LabelCurDec, LV_ALIGN_CENTER);
|
||||
lv_label_set_text(ui_LabelCurDec, "_");
|
||||
lv_obj_set_style_text_font(ui_LabelCurDec, &lv_font_montserrat_20, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_BtnCurInc = lv_button_create(ui_PanelPPS);
|
||||
lv_obj_set_width(ui_BtnCurInc, 30);
|
||||
lv_obj_set_height(ui_BtnCurInc, 30);
|
||||
lv_obj_set_x(ui_BtnCurInc, 195);
|
||||
lv_obj_set_y(ui_BtnCurInc, 25);
|
||||
lv_obj_set_align(ui_BtnCurInc, LV_ALIGN_CENTER);
|
||||
lv_obj_add_flag(ui_BtnCurInc, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
|
||||
lv_obj_remove_flag(ui_BtnCurInc, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
lv_obj_set_style_border_color(ui_BtnCurInc, lv_color_hex(0xF40F0F), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_opa(ui_BtnCurInc, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(ui_BtnCurInc, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_LabelCurInc = lv_label_create(ui_BtnCurInc);
|
||||
lv_obj_set_width(ui_LabelCurInc, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelCurInc, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_align(ui_LabelCurInc, LV_ALIGN_CENTER);
|
||||
lv_label_set_text(ui_LabelCurInc, "+");
|
||||
lv_obj_set_style_text_font(ui_LabelCurInc, &lv_font_montserrat_22, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_BtnSwitch = lv_button_create(ui_PPSPage);
|
||||
lv_obj_set_width(ui_BtnSwitch, 210);
|
||||
lv_obj_set_height(ui_BtnSwitch, 30);
|
||||
lv_obj_set_x(ui_BtnSwitch, 0);
|
||||
lv_obj_set_y(ui_BtnSwitch, 60);
|
||||
lv_obj_set_align(ui_BtnSwitch, LV_ALIGN_CENTER);
|
||||
lv_obj_add_flag(ui_BtnSwitch, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
|
||||
lv_obj_remove_flag(ui_BtnSwitch, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
lv_obj_set_style_bg_color(ui_BtnSwitch, lv_color_hex(0x725C08), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_opa(ui_BtnSwitch, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_color(ui_BtnSwitch, lv_color_hex(0xF40F0F), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_opa(ui_BtnSwitch, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(ui_BtnSwitch, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
|
||||
ui_LabelSwitch = lv_label_create(ui_BtnSwitch);
|
||||
lv_obj_set_width(ui_LabelSwitch, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelSwitch, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_align(ui_LabelSwitch, LV_ALIGN_CENTER);
|
||||
lv_label_set_text(ui_LabelSwitch, _("press to Step Adjust"));
|
||||
if(ui_get_language_select() == 0)
|
||||
lv_obj_set_style_text_font(ui_LabelSwitch, &lv_font_montserrat_18, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
else
|
||||
lv_obj_set_style_text_font(ui_LabelSwitch, &ui_font_zhongyuan20, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_BtnClose = lv_button_create(ui_PPSPage);
|
||||
lv_obj_set_width(ui_BtnClose, 210);
|
||||
lv_obj_set_height(ui_BtnClose, 30);
|
||||
lv_obj_set_x(ui_BtnClose, 0);
|
||||
lv_obj_set_y(ui_BtnClose, 95);
|
||||
lv_obj_set_align(ui_BtnClose, LV_ALIGN_CENTER);
|
||||
lv_obj_add_flag(ui_BtnClose, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
|
||||
lv_obj_remove_flag(ui_BtnClose, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
lv_obj_set_style_bg_color(ui_BtnClose, lv_color_hex(0x725C08), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_opa(ui_BtnClose, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_color(ui_BtnClose, lv_color_hex(0xF40F0F), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_opa(ui_BtnClose, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(ui_BtnClose, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_LabelClose = lv_label_create(ui_BtnClose);
|
||||
lv_obj_set_width(ui_LabelClose, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelClose, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_align(ui_LabelClose, LV_ALIGN_CENTER);
|
||||
lv_label_set_text(ui_LabelClose, _("press here to close PD"));
|
||||
if(ui_get_language_select() == 0)
|
||||
lv_obj_set_style_text_font(ui_LabelClose, &lv_font_montserrat_18, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
else
|
||||
lv_obj_set_style_text_font(ui_LabelClose, &ui_font_zhongyuan20, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_pps_timer = lv_timer_create(_flush_timer_cb, 500, NULL);
|
||||
|
||||
// store panels in array
|
||||
btns[0] = ui_BtnSet1;
|
||||
btns[1] = ui_BtnSet2;
|
||||
btns[2] = ui_BtnSet3;
|
||||
btns[3] = ui_BtnSet4;
|
||||
btns[4] = ui_BtnSet5;
|
||||
btns[5] = ui_BtnSet6;
|
||||
btns[6] = ui_BtnSwitch;
|
||||
btns[7] = ui_BtnClose;
|
||||
btns[8] = ui_BtnValDec;
|
||||
btns[9] = ui_BtnValInc;
|
||||
btns[10] = ui_BtnCurDec;
|
||||
btns[11] = ui_BtnCurInc;
|
||||
btns[12] = ui_BtnSwitch;
|
||||
btns[13] = ui_BtnClose;
|
||||
//
|
||||
_para_init();
|
||||
}
|
||||
|
||||
void ui_PPSPage_screen_destroy(void)
|
||||
{
|
||||
if(ui_pps_timer) lv_timer_delete(ui_pps_timer);
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
// This file was generated by SquareLine Studio
|
||||
// SquareLine Studio version: SquareLine Studio 1.5.4
|
||||
// LVGL version: 9.2.2
|
||||
// Project name: PowerPico
|
||||
|
||||
#ifndef UI_PPSPAGE_H
|
||||
#define UI_PPSPAGE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// SCREEN: ui_PPSPage
|
||||
void ui_PPSPage_screen_init(void);
|
||||
void ui_PPSPage_screen_destroy(void);
|
||||
extern lv_obj_t * ui_PPSPage;
|
||||
|
||||
void ui_pps_page_key_handler(void* key_event);
|
||||
|
||||
// CUSTOM VARIABLES
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,531 +0,0 @@
|
||||
// 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_PPSPage.h"
|
||||
|
||||
lv_obj_t * ui_SetPage = NULL;
|
||||
// backlight
|
||||
static lv_obj_t * ui_PanelBL = NULL;
|
||||
static lv_obj_t * ui_SliderBL = NULL;
|
||||
static lv_obj_t * ui_LabelBL = NULL;
|
||||
// key sound
|
||||
static lv_obj_t * ui_PanelKS = NULL;
|
||||
static lv_obj_t * ui_SwitchKS = NULL;
|
||||
static lv_obj_t * ui_LabelKS = NULL;
|
||||
// language
|
||||
static lv_obj_t * ui_PanelLang = NULL;
|
||||
static lv_obj_t * ui_SwitchLang = NULL;
|
||||
static lv_obj_t * ui_LabelLang = NULL;
|
||||
// chose rotation
|
||||
static lv_obj_t * ui_PanelRotate = NULL;
|
||||
static lv_obj_t * ui_LabelRotation = NULL;
|
||||
static lv_obj_t * ui_LabelRotNum = NULL;
|
||||
// enable PPS, goto PPS page
|
||||
static lv_obj_t * ui_PanelPPS = NULL;
|
||||
static lv_obj_t * ui_SwitchPPS = NULL;
|
||||
static lv_obj_t * ui_LabelPPS = NULL;
|
||||
// about
|
||||
static lv_obj_t * ui_PanelAbout = NULL;
|
||||
static lv_obj_t * ui_LabelAbout = NULL;
|
||||
|
||||
static lv_timer_t * _setting_timer = NULL;
|
||||
|
||||
static lv_obj_t * msgbox = NULL; // msgbox 对象
|
||||
static lv_obj_t * spinner = NULL; // spinner 对象
|
||||
static bool waiting_for_signal = false; // 标志位,表示是否在等待信号
|
||||
|
||||
static lv_obj_t * panels[6]; // 存储所有 panel 的指针
|
||||
static int current_panel_index = 0; // 当前选中的 panel 索引
|
||||
|
||||
static void show_wait_msgbox(void);
|
||||
static void hide_wait_msgbox(void);
|
||||
static void show_fail_msgbox(void);
|
||||
static void show_restart_msgbox(void);
|
||||
|
||||
// event funtions
|
||||
|
||||
/////////////////////// Timer //////////////////////
|
||||
static void _setting_timer_cb(lv_timer_t * timer) {
|
||||
int8_t Msg = 0;
|
||||
Msg = MsgQueueGet_PPS_ready();
|
||||
if(Msg == 1) {
|
||||
// 隐藏等待框
|
||||
hide_wait_msgbox();
|
||||
lv_lib_pm_goto("PPS Page", NULL);
|
||||
} else if(Msg == -1) {
|
||||
// 隐藏等待框
|
||||
hide_wait_msgbox();
|
||||
// 显示失败框
|
||||
show_fail_msgbox();
|
||||
ui_send_pps_stop_msg();
|
||||
}
|
||||
}
|
||||
|
||||
///////////////// key function ///////////////////
|
||||
|
||||
#include "key.h"
|
||||
void ui_set_page_key_handler(void *key_event)
|
||||
{
|
||||
if(waiting_for_signal) return;
|
||||
int panel_count = sizeof(panels) / sizeof(panels[0]);
|
||||
// key boot
|
||||
if (((key_event_t*)key_event)->id == KEY_ID_B && ((key_event_t*)key_event)->type == KEY_EVT_CLICK)
|
||||
{
|
||||
lv_lib_pm_goto_first();
|
||||
}
|
||||
// key left
|
||||
if (((key_event_t*)key_event)->id == KEY_ID_L && ((key_event_t*)key_event)->type == KEY_EVT_CLICK)
|
||||
{
|
||||
lv_obj_clear_state(panels[current_panel_index], LV_STATE_CHECKED);
|
||||
current_panel_index = (current_panel_index - 1 + panel_count) % panel_count;
|
||||
lv_obj_add_state(panels[current_panel_index], LV_STATE_CHECKED);
|
||||
lv_obj_scroll_to_view(panels[current_panel_index], LV_ANIM_ON);
|
||||
}
|
||||
// key right
|
||||
else if (((key_event_t*)key_event)->id == KEY_ID_R && ((key_event_t*)key_event)->type == KEY_EVT_CLICK)
|
||||
{
|
||||
lv_obj_clear_state(panels[current_panel_index], LV_STATE_CHECKED);
|
||||
current_panel_index = (current_panel_index + 1) % panel_count;
|
||||
lv_obj_add_state(panels[current_panel_index], LV_STATE_CHECKED);
|
||||
lv_obj_scroll_to_view(panels[current_panel_index], LV_ANIM_ON);
|
||||
}
|
||||
// key yes or key neg
|
||||
else if(((key_event_t*)key_event)->id == KEY_ID_Y || ((key_event_t*)key_event)->id == KEY_ID_N)
|
||||
{
|
||||
switch(current_panel_index)
|
||||
{
|
||||
// Screen Brightness
|
||||
case 0:
|
||||
if (((key_event_t*)key_event)->id == KEY_ID_Y &&
|
||||
(((key_event_t*)key_event)->type == KEY_EVT_CLICK || ((key_event_t*)key_event)->type == KEY_EVT_REPEAT)) { // key yes
|
||||
int16_t slider_value = lv_slider_get_value(ui_SliderBL);
|
||||
slider_value += 10;
|
||||
if(slider_value > 100) slider_value = 100;
|
||||
lv_slider_set_value(ui_SliderBL, slider_value, LV_ANIM_ON);
|
||||
ui_set_back_light_level(slider_value);
|
||||
} else if (((key_event_t*)key_event)->id == KEY_ID_N &&
|
||||
(((key_event_t*)key_event)->type == KEY_EVT_CLICK || ((key_event_t*)key_event)->type == KEY_EVT_REPEAT)) { // key neg
|
||||
int16_t slider_value = lv_slider_get_value(ui_SliderBL);
|
||||
slider_value -= 10;
|
||||
if(slider_value < 10) slider_value = 10;
|
||||
lv_slider_set_value(ui_SliderBL, slider_value, LV_ANIM_ON);
|
||||
ui_set_back_light_level(slider_value);
|
||||
}
|
||||
break;
|
||||
// key sound
|
||||
case 1:
|
||||
// key yes
|
||||
if (((key_event_t*)key_event)->id == KEY_ID_Y && ((key_event_t*)key_event)->type == KEY_EVT_CLICK)
|
||||
{
|
||||
lv_obj_add_state(ui_SwitchKS, LV_STATE_CHECKED);
|
||||
ui_set_key_sound_enable(1);
|
||||
}
|
||||
// key neg
|
||||
else if (((key_event_t*)key_event)->id == KEY_ID_N && ((key_event_t*)key_event)->type == KEY_EVT_CLICK)
|
||||
{
|
||||
lv_obj_clear_state(ui_SwitchKS, LV_STATE_CHECKED);
|
||||
ui_set_key_sound_enable(0);
|
||||
}
|
||||
break;
|
||||
|
||||
// language
|
||||
case 2:
|
||||
// key yes
|
||||
if (((key_event_t*)key_event)->id == KEY_ID_Y && ((key_event_t*)key_event)->type == KEY_EVT_CLICK)
|
||||
{
|
||||
show_restart_msgbox();
|
||||
lv_obj_add_state(ui_SwitchLang, LV_STATE_CHECKED);
|
||||
ui_set_language_select(1);
|
||||
lv_i18n_set_locale("zh-cn");
|
||||
}
|
||||
// key neg
|
||||
else if (((key_event_t*)key_event)->id == KEY_ID_N && ((key_event_t*)key_event)->type == KEY_EVT_CLICK)
|
||||
{
|
||||
show_restart_msgbox();
|
||||
lv_obj_clear_state(ui_SwitchLang, LV_STATE_CHECKED);
|
||||
ui_set_language_select(0);
|
||||
lv_i18n_set_locale("en");
|
||||
}
|
||||
break;
|
||||
|
||||
// chose rotation
|
||||
case 3:
|
||||
uint16_t rotation = ui_get_display_rotation();
|
||||
// key yes
|
||||
if (((key_event_t*)key_event)->id == KEY_ID_Y && ((key_event_t*)key_event)->type == KEY_EVT_CLICK)
|
||||
{
|
||||
rotation = (rotation + 360 + 90) % 360;
|
||||
}
|
||||
// key neg
|
||||
else if (((key_event_t*)key_event)->id == KEY_ID_N && ((key_event_t*)key_event)->type == KEY_EVT_CLICK)
|
||||
{
|
||||
rotation = (rotation + 360 - 90) % 360;
|
||||
}
|
||||
if (rotation == 0) {
|
||||
lv_label_set_text(ui_LabelRotNum, "< 0 >");
|
||||
} else if (rotation == 90) {
|
||||
lv_label_set_text(ui_LabelRotNum, "< 90 >");
|
||||
} else if (rotation == 180) {
|
||||
lv_label_set_text(ui_LabelRotNum, "< 180 >");
|
||||
} else if (rotation == 270) {
|
||||
lv_label_set_text(ui_LabelRotNum, "< 270 >");
|
||||
}
|
||||
ui_set_display_rotation(rotation);
|
||||
ui_full_screen_refresh(ui_SetPage);
|
||||
break;
|
||||
|
||||
// PPS page
|
||||
case 4:
|
||||
// 发送开启PD诱骗的信号
|
||||
if (((key_event_t*)key_event)->id == KEY_ID_Y && ((key_event_t*)key_event)->type == KEY_EVT_CLICK)
|
||||
{
|
||||
// 发送pps开始信号到PD UFP Task
|
||||
ui_send_pps_start_msg();
|
||||
// 弹出 msgbox 等待PD完成,并锁住按键操作
|
||||
show_wait_msgbox();
|
||||
// lv_lib_pm_goto("PPS Page", NULL);
|
||||
}
|
||||
break;
|
||||
// about
|
||||
case 5:
|
||||
// do nothing
|
||||
break;
|
||||
}
|
||||
// save settings to eeprom
|
||||
ui_system_settings_save();
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////// para_initialize //////////////////////
|
||||
|
||||
static void on_setpage_loaded(lv_event_t * e) {
|
||||
// 当 SetPage 页面加载完成后,滚动到当前选中的 panel
|
||||
lv_obj_scroll_to_view(panels[current_panel_index], LV_ANIM_ON);
|
||||
}
|
||||
|
||||
static void _setting_init(void) {
|
||||
|
||||
// backlight
|
||||
lv_slider_set_value(ui_SliderBL, ui_get_back_light_level(), LV_ANIM_OFF);
|
||||
|
||||
// key sound
|
||||
if(ui_get_key_sound_enable())
|
||||
lv_obj_add_state(ui_SwitchKS, LV_STATE_CHECKED);
|
||||
else
|
||||
lv_obj_clear_state(ui_SwitchKS, LV_STATE_CHECKED);
|
||||
|
||||
// language
|
||||
if(ui_get_language_select() == 1)
|
||||
lv_obj_add_state(ui_SwitchLang, LV_STATE_CHECKED);
|
||||
else
|
||||
lv_obj_clear_state(ui_SwitchLang, LV_STATE_CHECKED);
|
||||
|
||||
// lcd rotation
|
||||
uint16_t rotation = ui_get_display_rotation();
|
||||
if (rotation == 0) {
|
||||
lv_label_set_text(ui_LabelRotNum, "< 0 >");
|
||||
} else if (rotation == 90) {
|
||||
lv_label_set_text(ui_LabelRotNum, "< 90 >");
|
||||
} else if (rotation == 180) {
|
||||
lv_label_set_text(ui_LabelRotNum, "< 180 >");
|
||||
} else if (rotation == 270) {
|
||||
lv_label_set_text(ui_LabelRotNum, "< 270 >");
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////// ui_components //////////////////////
|
||||
|
||||
// 显示 PD msgbox
|
||||
static void show_wait_msgbox(void) {
|
||||
|
||||
// 获取当前视角y pos
|
||||
int32_t view_y = lv_obj_get_scroll_top(ui_SetPage);
|
||||
// 创建 msgbox
|
||||
msgbox = lv_obj_create(ui_SetPage);
|
||||
lv_obj_set_size(msgbox, 200, 160);
|
||||
lv_obj_center(msgbox);
|
||||
lv_obj_set_pos(msgbox, 0, view_y);
|
||||
lv_obj_set_style_bg_color(msgbox, lv_color_hex(0x606060), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_opa(msgbox, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
// 添加 spinner
|
||||
spinner = lv_spinner_create(msgbox);
|
||||
lv_obj_set_size(spinner, 60, 60);
|
||||
lv_obj_center(spinner);
|
||||
|
||||
// 添加文本
|
||||
lv_obj_t * label = lv_label_create(msgbox);
|
||||
lv_label_set_text(label, "Waiting for PD...");
|
||||
lv_obj_set_align(label, LV_ALIGN_BOTTOM_MID);
|
||||
lv_obj_set_style_text_font(label, &lv_font_montserrat_18, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
// 设置标志位
|
||||
waiting_for_signal = true;
|
||||
}
|
||||
|
||||
// 隐藏 PD msgbox
|
||||
static void hide_wait_msgbox(void) {
|
||||
if (msgbox) {
|
||||
lv_obj_del(msgbox);
|
||||
msgbox = NULL;
|
||||
spinner = NULL;
|
||||
}
|
||||
waiting_for_signal = false;
|
||||
}
|
||||
|
||||
// 定时器回调函数,用于关闭失败弹窗
|
||||
static void _fail_msgbox_timer_cb(lv_timer_t * t) {
|
||||
lv_obj_t * mbox = (lv_obj_t *)lv_timer_get_user_data(t);
|
||||
if (mbox) {
|
||||
lv_obj_del(mbox); // 删除 msgbox
|
||||
}
|
||||
lv_timer_del(t); // 删除定时器
|
||||
}
|
||||
|
||||
// 显示重启提示弹窗
|
||||
static void show_restart_msgbox(void) {
|
||||
// 获取当前视角y pos
|
||||
int32_t view_y = lv_obj_get_scroll_top(ui_SetPage);
|
||||
// 创建 msgbox
|
||||
lv_obj_t * restart_msgbox = lv_obj_create(ui_SetPage);
|
||||
lv_obj_set_size(restart_msgbox, 220, 100);
|
||||
lv_obj_center(restart_msgbox);
|
||||
lv_obj_set_pos(restart_msgbox, 0, view_y);
|
||||
lv_obj_set_style_bg_color(restart_msgbox, lv_color_hex(0x958030), LV_PART_MAIN | LV_STATE_DEFAULT); // 黄色背景
|
||||
lv_obj_set_style_bg_opa(restart_msgbox, 200, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
// 添加文本
|
||||
lv_obj_t * label = lv_label_create(restart_msgbox);
|
||||
lv_label_set_text(label, _("Please reboot to apply\nall changes!"));
|
||||
lv_obj_center(label);
|
||||
if(ui_get_language_select() == 0)
|
||||
{
|
||||
// 如果是English
|
||||
lv_obj_set_style_text_font(label, &lv_font_montserrat_18, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
}
|
||||
else
|
||||
{
|
||||
// 如果是中文
|
||||
lv_obj_set_style_text_font(label, &ui_font_zhongyuan20, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
}
|
||||
lv_obj_set_style_text_align(label, LV_TEXT_ALIGN_CENTER, 0);
|
||||
|
||||
// 设置定时器,2 秒后关闭弹窗
|
||||
lv_timer_t * timer = lv_timer_create(_fail_msgbox_timer_cb, 2000, restart_msgbox); // 重用关闭回调
|
||||
lv_timer_set_repeat_count(timer, 1); // 只执行一次
|
||||
}
|
||||
|
||||
// 显示PPS失败提示弹窗
|
||||
static void show_fail_msgbox(void) {
|
||||
// 获取当前视角y pos
|
||||
int32_t view_y = lv_obj_get_scroll_top(ui_SetPage);
|
||||
// 创建 msgbox
|
||||
msgbox = lv_obj_create(ui_SetPage);
|
||||
lv_obj_set_size(msgbox, 200, 100);
|
||||
lv_obj_center(msgbox);
|
||||
lv_obj_set_pos(msgbox, 0, view_y);
|
||||
lv_obj_set_style_bg_color(msgbox, lv_color_hex(0xFF0000), LV_PART_MAIN | LV_STATE_DEFAULT); // 红色背景
|
||||
lv_obj_set_style_bg_opa(msgbox, 200, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
// 添加文本
|
||||
lv_obj_t * label = lv_label_create(msgbox);
|
||||
lv_label_set_text(label, "PD Setting Failed!");
|
||||
lv_obj_center(label);
|
||||
lv_obj_set_style_text_font(label, &lv_font_montserrat_18, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
// 设置定时器,2 秒后关闭弹窗
|
||||
lv_timer_t * timer = lv_timer_create(_fail_msgbox_timer_cb, 2000, msgbox); // 传递 msgbox 对象
|
||||
lv_timer_set_repeat_count(timer, 1); // 只执行一次
|
||||
}
|
||||
|
||||
/////////////////////// ui_initialize //////////////////////
|
||||
|
||||
void ui_SetPage_screen_init(void)
|
||||
{
|
||||
ui_SetPage = lv_obj_create(NULL);
|
||||
|
||||
ui_PanelBL = lv_obj_create(ui_SetPage);
|
||||
lv_obj_set_width(ui_PanelBL, 234);
|
||||
lv_obj_set_height(ui_PanelBL, 65);
|
||||
lv_obj_set_x(ui_PanelBL, 0);
|
||||
lv_obj_set_y(ui_PanelBL, 5);
|
||||
lv_obj_set_align(ui_PanelBL, LV_ALIGN_TOP_MID);
|
||||
lv_obj_add_flag(ui_PanelBL, LV_OBJ_FLAG_CHECKABLE); /// Flags
|
||||
lv_obj_remove_flag(ui_PanelBL, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
lv_obj_set_style_bg_color(ui_PanelBL, lv_color_hex(0x606060), LV_PART_MAIN | LV_STATE_CHECKED);
|
||||
lv_obj_set_style_bg_opa(ui_PanelBL, 255, LV_PART_MAIN | LV_STATE_CHECKED);
|
||||
|
||||
ui_SliderBL = lv_slider_create(ui_PanelBL);
|
||||
lv_slider_set_value(ui_SliderBL, 50, LV_ANIM_OFF);
|
||||
if(lv_slider_get_mode(ui_SliderBL) == LV_SLIDER_MODE_RANGE) lv_slider_set_left_value(ui_SliderBL, 0, LV_ANIM_OFF);
|
||||
lv_obj_set_width(ui_SliderBL, 200);
|
||||
lv_obj_set_height(ui_SliderBL, 10);
|
||||
lv_obj_set_align(ui_SliderBL, LV_ALIGN_BOTTOM_MID);
|
||||
|
||||
//Compensating for LVGL9.1 draw crash with bar/slider max value when top-padding is nonzero and right-padding is 0
|
||||
if(lv_obj_get_style_pad_top(ui_SliderBL, LV_PART_MAIN) > 0) lv_obj_set_style_pad_right(ui_SliderBL, lv_obj_get_style_pad_right(ui_SliderBL, LV_PART_MAIN) + 1, LV_PART_MAIN);
|
||||
ui_LabelBL = lv_label_create(ui_PanelBL);
|
||||
lv_obj_set_width(ui_LabelBL, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelBL, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_x(ui_LabelBL, 0);
|
||||
lv_obj_set_y(ui_LabelBL, -5);
|
||||
lv_label_set_text(ui_LabelBL, _("Screen Brightness :"));
|
||||
if(ui_get_language_select() == 0)
|
||||
lv_obj_set_style_text_font(ui_LabelBL, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
else
|
||||
lv_obj_set_style_text_font(ui_LabelBL, &ui_font_zhongyuan18, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
|
||||
ui_PanelKS = lv_obj_create(ui_SetPage);
|
||||
lv_obj_set_width(ui_PanelKS, 234);
|
||||
lv_obj_set_height(ui_PanelKS, 45);
|
||||
lv_obj_set_x(ui_PanelKS, 0);
|
||||
lv_obj_set_y(ui_PanelKS, 75);
|
||||
lv_obj_set_align(ui_PanelKS, LV_ALIGN_TOP_MID);
|
||||
lv_obj_add_flag(ui_PanelKS, LV_OBJ_FLAG_CHECKABLE); /// Flags
|
||||
lv_obj_remove_flag(ui_PanelKS, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
lv_obj_set_style_bg_color(ui_PanelKS, lv_color_hex(0x606060), LV_PART_MAIN | LV_STATE_CHECKED);
|
||||
lv_obj_set_style_bg_opa(ui_PanelKS, 255, LV_PART_MAIN | LV_STATE_CHECKED);
|
||||
|
||||
ui_SwitchKS = lv_switch_create(ui_PanelKS);
|
||||
lv_obj_set_width(ui_SwitchKS, 50);
|
||||
lv_obj_set_height(ui_SwitchKS, 25);
|
||||
lv_obj_set_align(ui_SwitchKS, LV_ALIGN_RIGHT_MID);
|
||||
lv_obj_add_state(ui_SwitchKS, LV_STATE_CHECKED); /// States
|
||||
|
||||
ui_LabelKS = lv_label_create(ui_PanelKS);
|
||||
lv_obj_set_width(ui_LabelKS, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelKS, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_align(ui_LabelKS, LV_ALIGN_LEFT_MID);
|
||||
lv_label_set_text(ui_LabelKS, _("Enable key sound"));
|
||||
if(ui_get_language_select() == 0)
|
||||
lv_obj_set_style_text_font(ui_LabelKS, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
else
|
||||
lv_obj_set_style_text_font(ui_LabelKS, &ui_font_zhongyuan18, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_PanelLang = lv_obj_create(ui_SetPage);
|
||||
lv_obj_set_width(ui_PanelLang, 234);
|
||||
lv_obj_set_height(ui_PanelLang, 45);
|
||||
lv_obj_set_x(ui_PanelLang, 0);
|
||||
lv_obj_set_y(ui_PanelLang, 125);
|
||||
lv_obj_set_align(ui_PanelLang, LV_ALIGN_TOP_MID);
|
||||
lv_obj_add_flag(ui_PanelLang, LV_OBJ_FLAG_CHECKABLE); /// Flags
|
||||
lv_obj_remove_flag(ui_PanelLang, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
lv_obj_set_style_bg_color(ui_PanelLang, lv_color_hex(0x606060), LV_PART_MAIN | LV_STATE_CHECKED);
|
||||
lv_obj_set_style_bg_opa(ui_PanelLang, 255, LV_PART_MAIN | LV_STATE_CHECKED);
|
||||
|
||||
ui_SwitchLang = lv_switch_create(ui_PanelLang);
|
||||
lv_obj_set_width(ui_SwitchLang, 50);
|
||||
lv_obj_set_height(ui_SwitchLang, 25);
|
||||
lv_obj_set_align(ui_SwitchLang, LV_ALIGN_RIGHT_MID);
|
||||
|
||||
ui_LabelLang = lv_label_create(ui_PanelLang);
|
||||
lv_obj_set_width(ui_LabelLang, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelLang, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_align(ui_LabelLang, LV_ALIGN_LEFT_MID);
|
||||
lv_label_set_text(ui_LabelLang, _("Enable Chinese"));
|
||||
if(ui_get_language_select() == 0)
|
||||
lv_obj_set_style_text_font(ui_LabelLang, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
else
|
||||
lv_obj_set_style_text_font(ui_LabelLang, &ui_font_zhongyuan18, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_PanelRotate = lv_obj_create(ui_SetPage);
|
||||
lv_obj_set_width(ui_PanelRotate, 234);
|
||||
lv_obj_set_height(ui_PanelRotate, 45);
|
||||
lv_obj_set_x(ui_PanelRotate, 0);
|
||||
lv_obj_set_y(ui_PanelRotate, 175);
|
||||
lv_obj_set_align(ui_PanelRotate, LV_ALIGN_TOP_MID);
|
||||
lv_obj_add_flag(ui_PanelRotate, LV_OBJ_FLAG_CHECKABLE); /// Flags
|
||||
lv_obj_remove_flag(ui_PanelRotate, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
lv_obj_set_style_bg_color(ui_PanelRotate, lv_color_hex(0x606060), LV_PART_MAIN | LV_STATE_CHECKED);
|
||||
lv_obj_set_style_bg_opa(ui_PanelRotate, 255, LV_PART_MAIN | LV_STATE_CHECKED);
|
||||
|
||||
ui_LabelRotation = lv_label_create(ui_PanelRotate);
|
||||
lv_obj_set_width(ui_LabelRotation, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelRotation, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_align(ui_LabelRotation, LV_ALIGN_LEFT_MID);
|
||||
lv_label_set_text(ui_LabelRotation, _("Chose Rotation"));
|
||||
if(ui_get_language_select() == 0)
|
||||
lv_obj_set_style_text_font(ui_LabelRotation, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
else
|
||||
lv_obj_set_style_text_font(ui_LabelRotation, &ui_font_zhongyuan18, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_LabelRotNum = lv_label_create(ui_PanelRotate);
|
||||
lv_obj_set_width(ui_LabelRotNum, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelRotNum, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_align(ui_LabelRotNum, LV_ALIGN_RIGHT_MID);
|
||||
lv_label_set_text(ui_LabelRotNum, "< 180 >");
|
||||
lv_obj_set_style_text_font(ui_LabelRotNum, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_PanelPPS = lv_obj_create(ui_SetPage);
|
||||
lv_obj_set_width(ui_PanelPPS, 234);
|
||||
lv_obj_set_height(ui_PanelPPS, 45);
|
||||
lv_obj_set_x(ui_PanelPPS, 0);
|
||||
lv_obj_set_y(ui_PanelPPS, 225);
|
||||
lv_obj_set_align(ui_PanelPPS, LV_ALIGN_TOP_MID);
|
||||
lv_obj_add_flag(ui_PanelPPS, LV_OBJ_FLAG_CHECKABLE); /// Flags
|
||||
lv_obj_remove_flag(ui_PanelPPS, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
lv_obj_set_style_bg_color(ui_PanelPPS, lv_color_hex(0x606060), LV_PART_MAIN | LV_STATE_CHECKED);
|
||||
lv_obj_set_style_bg_opa(ui_PanelPPS, 255, LV_PART_MAIN | LV_STATE_CHECKED);
|
||||
|
||||
ui_SwitchPPS = lv_switch_create(ui_PanelPPS);
|
||||
lv_obj_set_width(ui_SwitchPPS, 50);
|
||||
lv_obj_set_height(ui_SwitchPPS, 25);
|
||||
lv_obj_set_align(ui_SwitchPPS, LV_ALIGN_RIGHT_MID);
|
||||
|
||||
ui_LabelPPS = lv_label_create(ui_PanelPPS);
|
||||
lv_obj_set_width(ui_LabelPPS, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelPPS, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_align(ui_LabelPPS, LV_ALIGN_LEFT_MID);
|
||||
lv_label_set_text(ui_LabelPPS, _("PD Sink"));
|
||||
if(ui_get_language_select() == 0)
|
||||
lv_obj_set_style_text_font(ui_LabelPPS, &lv_font_montserrat_18, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
else
|
||||
lv_obj_set_style_text_font(ui_LabelPPS, &ui_font_zhongyuan20, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_PanelAbout = lv_obj_create(ui_SetPage);
|
||||
lv_obj_set_width(ui_PanelAbout, 234);
|
||||
lv_obj_set_height(ui_PanelAbout, 100);
|
||||
lv_obj_set_x(ui_PanelAbout, 0);
|
||||
lv_obj_set_y(ui_PanelAbout, 275);
|
||||
lv_obj_set_align(ui_PanelAbout, LV_ALIGN_TOP_MID);
|
||||
lv_obj_add_flag(ui_PanelAbout, LV_OBJ_FLAG_CHECKABLE); /// Flags
|
||||
lv_obj_remove_flag(ui_PanelAbout, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
lv_obj_set_style_bg_color(ui_PanelAbout, lv_color_hex(0x606060), LV_PART_MAIN | LV_STATE_CHECKED);
|
||||
lv_obj_set_style_bg_opa(ui_PanelAbout, 255, LV_PART_MAIN | LV_STATE_CHECKED);
|
||||
|
||||
ui_LabelAbout = lv_label_create(ui_PanelAbout);
|
||||
lv_obj_set_width(ui_LabelAbout, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_LabelAbout, LV_SIZE_CONTENT); /// 1
|
||||
lv_label_set_text(ui_LabelAbout, "About\nPower-Pico\nThe uA current meter\nV 1.0.5");
|
||||
lv_obj_set_style_text_font(ui_LabelAbout, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
// init setting values
|
||||
_setting_init();
|
||||
|
||||
// store panels in array
|
||||
panels[0] = ui_PanelBL;
|
||||
panels[1] = ui_PanelKS;
|
||||
panels[2] = ui_PanelLang;
|
||||
panels[3] = ui_PanelRotate;
|
||||
panels[4] = ui_PanelPPS;
|
||||
panels[5] = ui_PanelAbout;
|
||||
lv_obj_add_state(panels[current_panel_index], LV_STATE_CHECKED);
|
||||
|
||||
// timer
|
||||
_setting_timer = lv_timer_create(_setting_timer_cb, 500, NULL);
|
||||
|
||||
//
|
||||
lv_obj_add_event_cb(ui_SetPage, on_setpage_loaded, LV_EVENT_SCREEN_LOADED, NULL);
|
||||
|
||||
}
|
||||
|
||||
void ui_SetPage_screen_destroy(void)
|
||||
{
|
||||
if(_setting_timer) {
|
||||
lv_timer_delete(_setting_timer);
|
||||
}
|
||||
}
|
||||
@@ -1,26 +0,0 @@
|
||||
// This file was generated by SquareLine Studio
|
||||
// SquareLine Studio version: SquareLine Studio 1.5.3
|
||||
// LVGL version: 9.2.2
|
||||
// Project name: PowerPico
|
||||
|
||||
#ifndef UI_SETPAGE_H
|
||||
#define UI_SETPAGE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// SCREEN: ui_SetPage
|
||||
extern void ui_SetPage_screen_init(void);
|
||||
extern void ui_SetPage_screen_destroy(void);
|
||||
extern lv_obj_t * ui_SetPage;
|
||||
void ui_set_page_key_handler(void *key_event);
|
||||
|
||||
// CUSTOM VARIABLES
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,137 +0,0 @@
|
||||
// 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"
|
||||
|
||||
lv_obj_t * ui_StartPage = NULL;
|
||||
static lv_obj_t * ui_Panel1 = NULL;
|
||||
static lv_obj_t * ui_Image2 = NULL;
|
||||
static lv_obj_t * ui_Label1 = NULL;
|
||||
static lv_obj_t * ui_Panel2 = NULL;
|
||||
static lv_obj_t * ui_Button1 = NULL;
|
||||
static lv_obj_t * ui_Button2 = NULL;
|
||||
static lv_obj_t * ui_Button3 = NULL;
|
||||
static lv_obj_t * ui_Button4 = NULL;
|
||||
|
||||
static lv_timer_t * _flush_timer = NULL;
|
||||
|
||||
// event funtions
|
||||
|
||||
static void ui_startpage_timer_cb(lv_timer_t * timer)
|
||||
{
|
||||
ui_full_screen_refresh(ui_StartPage);
|
||||
}
|
||||
|
||||
// build funtions
|
||||
|
||||
static void _ui_StartPage_btn_animation(void)
|
||||
{
|
||||
lv_lib_anim_user_animation(ui_Button1, 0, 600, 50, 20, 0, 600, 0, LV_ANIM_REPEAT_INFINITE, lv_anim_path_ease_in_out, lv_lib_anim_callback_set_hight, NULL);
|
||||
lv_lib_anim_user_animation(ui_Button2, 200, 600, 50, 20, 0, 600, 0, LV_ANIM_REPEAT_INFINITE, lv_anim_path_ease_in_out, lv_lib_anim_callback_set_hight, NULL);
|
||||
lv_lib_anim_user_animation(ui_Button3, 400, 600, 50, 20, 0, 600, 0, LV_ANIM_REPEAT_INFINITE, lv_anim_path_ease_in_out, lv_lib_anim_callback_set_hight, NULL);
|
||||
lv_lib_anim_user_animation(ui_Button4, 600, 600, 50, 20, 0, 600, 0, LV_ANIM_REPEAT_INFINITE, lv_anim_path_ease_in_out, lv_lib_anim_callback_set_hight, NULL);
|
||||
}
|
||||
|
||||
void ui_StartPage_screen_init(void)
|
||||
{
|
||||
ui_StartPage = lv_obj_create(NULL);
|
||||
lv_obj_remove_flag(ui_StartPage, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
|
||||
ui_Panel1 = lv_obj_create(ui_StartPage);
|
||||
lv_obj_set_width(ui_Panel1, 120);
|
||||
lv_obj_set_height(ui_Panel1, 120);
|
||||
lv_obj_set_x(ui_Panel1, 0);
|
||||
lv_obj_set_y(ui_Panel1, -35);
|
||||
lv_obj_set_align(ui_Panel1, LV_ALIGN_CENTER);
|
||||
lv_obj_remove_flag(ui_Panel1, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
lv_obj_set_style_radius(ui_Panel1, 128, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_color(ui_Panel1, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_opa(ui_Panel1, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_color(ui_Panel1, lv_color_hex(0x000000), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_opa(ui_Panel1, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_Image2 = lv_image_create(ui_Panel1);
|
||||
lv_image_set_src(ui_Image2, &ui_img_chicken_png);
|
||||
lv_obj_set_width(ui_Image2, LV_SIZE_CONTENT); /// 128
|
||||
lv_obj_set_height(ui_Image2, LV_SIZE_CONTENT); /// 128
|
||||
lv_obj_set_x(ui_Image2, -4);
|
||||
lv_obj_set_y(ui_Image2, -2);
|
||||
lv_obj_set_align(ui_Image2, LV_ALIGN_CENTER);
|
||||
lv_obj_add_flag(ui_Image2, LV_OBJ_FLAG_CLICKABLE); /// Flags
|
||||
lv_obj_remove_flag(ui_Image2, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
lv_image_set_scale(ui_Image2, 196);
|
||||
|
||||
ui_Label1 = lv_label_create(ui_StartPage);
|
||||
lv_obj_set_width(ui_Label1, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_height(ui_Label1, LV_SIZE_CONTENT); /// 1
|
||||
lv_obj_set_x(ui_Label1, 0);
|
||||
lv_obj_set_y(ui_Label1, 45);
|
||||
lv_obj_set_align(ui_Label1, LV_ALIGN_CENTER);
|
||||
lv_label_set_text(ui_Label1, "Power-Pico");
|
||||
lv_obj_set_style_text_font(ui_Label1, &lv_font_montserrat_28, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_Panel2 = lv_obj_create(ui_StartPage);
|
||||
lv_obj_set_width(ui_Panel2, 150);
|
||||
lv_obj_set_height(ui_Panel2, 50);
|
||||
lv_obj_set_x(ui_Panel2, 0);
|
||||
lv_obj_set_y(ui_Panel2, 90);
|
||||
lv_obj_set_align(ui_Panel2, LV_ALIGN_CENTER);
|
||||
lv_obj_remove_flag(ui_Panel2, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
lv_obj_set_style_radius(ui_Panel2, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_color(ui_Panel2, lv_color_hex(0xFFFFFF), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_opa(ui_Panel2, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_border_width(ui_Panel2, 0, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_Button1 = lv_button_create(ui_Panel2);
|
||||
lv_obj_set_width(ui_Button1, 30);
|
||||
lv_obj_set_height(ui_Button1, 50);
|
||||
lv_obj_set_x(ui_Button1, -54);
|
||||
lv_obj_set_y(ui_Button1, 0);
|
||||
lv_obj_set_align(ui_Button1, LV_ALIGN_CENTER);
|
||||
lv_obj_add_flag(ui_Button1, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
|
||||
lv_obj_remove_flag(ui_Button1, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
lv_obj_set_style_bg_color(ui_Button1, lv_color_hex(0xE36666), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_opa(ui_Button1, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_Button2 = lv_button_create(ui_Panel2);
|
||||
lv_obj_set_width(ui_Button2, 30);
|
||||
lv_obj_set_height(ui_Button2, 50);
|
||||
lv_obj_set_x(ui_Button2, -18);
|
||||
lv_obj_set_y(ui_Button2, 0);
|
||||
lv_obj_set_align(ui_Button2, LV_ALIGN_CENTER);
|
||||
lv_obj_add_flag(ui_Button2, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
|
||||
lv_obj_remove_flag(ui_Button2, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
lv_obj_set_style_bg_color(ui_Button2, lv_color_hex(0x59D362), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_opa(ui_Button2, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_Button3 = lv_button_create(ui_Panel2);
|
||||
lv_obj_set_width(ui_Button3, 30);
|
||||
lv_obj_set_height(ui_Button3, 50);
|
||||
lv_obj_set_x(ui_Button3, 18);
|
||||
lv_obj_set_y(ui_Button3, 0);
|
||||
lv_obj_set_align(ui_Button3, LV_ALIGN_CENTER);
|
||||
lv_obj_add_flag(ui_Button3, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
|
||||
lv_obj_remove_flag(ui_Button3, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
|
||||
ui_Button4 = lv_button_create(ui_Panel2);
|
||||
lv_obj_set_width(ui_Button4, 30);
|
||||
lv_obj_set_height(ui_Button4, 50);
|
||||
lv_obj_set_x(ui_Button4, 54);
|
||||
lv_obj_set_y(ui_Button4, 0);
|
||||
lv_obj_set_align(ui_Button4, LV_ALIGN_CENTER);
|
||||
lv_obj_add_flag(ui_Button4, LV_OBJ_FLAG_SCROLL_ON_FOCUS); /// Flags
|
||||
lv_obj_remove_flag(ui_Button4, LV_OBJ_FLAG_SCROLLABLE); /// Flags
|
||||
lv_obj_set_style_bg_color(ui_Button4, lv_color_hex(0x9F9960), LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_bg_opa(ui_Button4, 255, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
_ui_StartPage_btn_animation();
|
||||
// _flush_timer = lv_timer_create(ui_startpage_timer_cb, 500, NULL);
|
||||
|
||||
}
|
||||
|
||||
void ui_StartPage_screen_destroy(void)
|
||||
{
|
||||
lv_timer_delete(_flush_timer);
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
// This file was generated by SquareLine Studio
|
||||
// SquareLine Studio version: SquareLine Studio 1.5.3
|
||||
// LVGL version: 9.2.2
|
||||
// Project name: PowerPico
|
||||
|
||||
#ifndef UI_STARTPAGE_H
|
||||
#define UI_STARTPAGE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// SCREEN: ui_StartPage
|
||||
extern void ui_StartPage_screen_init(void);
|
||||
extern void ui_StartPage_screen_destroy(void);
|
||||
extern lv_obj_t * ui_StartPage;
|
||||
|
||||
// CUSTOM VARIABLES
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,260 +0,0 @@
|
||||
// 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 "math.h"
|
||||
|
||||
lv_obj_t * ui_HomeScreen = NULL;
|
||||
static lv_obj_t * ui_ButVal = NULL;
|
||||
static lv_obj_t * ui_LabelUnitVal = NULL;
|
||||
static lv_obj_t * ui_LabelValt = NULL;
|
||||
static lv_obj_t * ui_ButCur = NULL;
|
||||
static lv_obj_t * ui_LabelUnitCur = NULL;
|
||||
static lv_obj_t * ui_LabelCur = NULL;
|
||||
static lv_obj_t * ui_ButEnerge = NULL;
|
||||
static lv_obj_t * ui_LabelUnitEnerge = NULL;
|
||||
static lv_obj_t * ui_LabelEnerge = NULL;
|
||||
static lv_obj_t * ui_ButTime = NULL;
|
||||
static lv_obj_t * ui_LabelTime = NULL;
|
||||
static lv_timer_t * _flush_timer = NULL;
|
||||
|
||||
// other funtions
|
||||
|
||||
#include "key.h"
|
||||
void ui_main_page_key_handler(void* key_event)
|
||||
{
|
||||
if(((key_event_t*)key_event)->id == KEY_ID_B && ((key_event_t*)key_event)->type == KEY_EVT_CLICK)
|
||||
{
|
||||
lv_lib_pm_next();
|
||||
}
|
||||
// else if (((key_event_t*)key_event)->id == KEY_ID_L && ((key_event_t*)key_event)->type == KEY_EVT_CLICK)
|
||||
// {
|
||||
// // rotation - 90 degrees
|
||||
// // rotation – LV_DISPLAY_ROTATION_0/90/180/270
|
||||
// uint16_t rotation = ui_get_display_rotation();
|
||||
// rotation = (rotation + 360 - 90) % 360;
|
||||
// // set rotation value
|
||||
// ui_set_display_rotation(rotation);
|
||||
// // save settings to eeprom
|
||||
// ui_system_settings_save();
|
||||
// ui_full_screen_refresh(ui_HomeScreen);
|
||||
// }
|
||||
// else if (((key_event_t*)key_event)->id == KEY_ID_R && ((key_event_t*)key_event)->type == KEY_EVT_CLICK)
|
||||
// {
|
||||
// // rotation + 90 degrees
|
||||
// uint16_t rotation = ui_get_display_rotation();
|
||||
// rotation = (rotation + 360 + 90) % 360;
|
||||
// // set rotation value
|
||||
// ui_set_display_rotation(rotation);
|
||||
// // save settings to eeprom
|
||||
// ui_system_settings_save();
|
||||
// ui_full_screen_refresh(ui_HomeScreen);
|
||||
// }
|
||||
}
|
||||
|
||||
static void fmt_sig4(char *buf, size_t size, float v)
|
||||
{
|
||||
if (!isfinite(v)) { snprintf(buf, size, "--"); return; }
|
||||
if (fabsf(v) < 1e-9f) v = 0.0f; // 处理接近零的值
|
||||
float av = fabsf(v);
|
||||
int int_digits = (av >= 1.0f) ? ((int)floorf(log10f(av)) + 1) : 0;
|
||||
if(int_digits >= 4) {
|
||||
snprintf(buf, size, "%.0f", roundf(v));
|
||||
return;
|
||||
}
|
||||
int decimals = (int_digits == 0) ? 3 : (4 - int_digits); // 确保总数字为 4
|
||||
snprintf(buf, size, "%.*f", decimals, v);
|
||||
}
|
||||
|
||||
static void set_val_cur_label(float voltage, float current)
|
||||
{
|
||||
char buf[16];
|
||||
|
||||
// voltage (单位: V) -> 4 位有效数字
|
||||
fmt_sig4(buf, sizeof(buf), voltage);
|
||||
lv_label_set_text(ui_LabelValt, buf);
|
||||
|
||||
// current (原始单位: uA)
|
||||
float cur_uA = current;
|
||||
float cur_abs_uA = fabsf(cur_uA);
|
||||
float cur_disp = 0.0f;
|
||||
|
||||
if (cur_abs_uA >= 1e6f) {
|
||||
cur_disp = cur_uA / 1e6f; // A
|
||||
fmt_sig4(buf, sizeof(buf), cur_disp);
|
||||
lv_label_set_text(ui_LabelCur, buf);
|
||||
lv_label_set_text(ui_LabelUnitCur, "A");
|
||||
} else if (cur_abs_uA >= 1e3f) {
|
||||
cur_disp = cur_uA / 1e3f; // mA
|
||||
fmt_sig4(buf, sizeof(buf), cur_disp);
|
||||
lv_label_set_text(ui_LabelCur, buf);
|
||||
lv_label_set_text(ui_LabelUnitCur, "mA");
|
||||
} else {
|
||||
cur_disp = cur_uA; // uA
|
||||
fmt_sig4(buf, sizeof(buf), cur_disp);
|
||||
lv_label_set_text(ui_LabelCur, buf);
|
||||
lv_label_set_text(ui_LabelUnitCur, "uA");
|
||||
}
|
||||
|
||||
// power = V * A,按 W/mW/uW 选择单位,4 位有效数字
|
||||
float power_W = voltage * (cur_uA / 1e6f);
|
||||
float p_abs = fabsf(power_W);
|
||||
|
||||
if (p_abs >= 1.0f) {
|
||||
fmt_sig4(buf, sizeof(buf), power_W); // W
|
||||
lv_label_set_text(ui_LabelEnerge, buf);
|
||||
lv_label_set_text(ui_LabelUnitEnerge, "W");
|
||||
} else if (p_abs >= 1e-3f) {
|
||||
fmt_sig4(buf, sizeof(buf), power_W * 1e3f); // mW
|
||||
lv_label_set_text(ui_LabelEnerge, buf);
|
||||
lv_label_set_text(ui_LabelUnitEnerge, "mW");
|
||||
} else {
|
||||
fmt_sig4(buf, sizeof(buf), power_W * 1e6f); // uW
|
||||
lv_label_set_text(ui_LabelEnerge, buf);
|
||||
lv_label_set_text(ui_LabelUnitEnerge, "uW");
|
||||
}
|
||||
|
||||
// time
|
||||
uint8_t hours = 0, minutes = 0, seconds = 0;
|
||||
ui_GetElapsedTime_HMS(&hours, &minutes, &seconds);
|
||||
snprintf(buf, sizeof(buf), "%02d:%02d:%02d", hours, minutes, seconds);
|
||||
lv_label_set_text(ui_LabelTime, buf);
|
||||
}
|
||||
|
||||
// event funtions
|
||||
|
||||
static void _flush_timer_cb()
|
||||
{
|
||||
float voltage = 0.0;
|
||||
float current = 0.0;
|
||||
ui_get_vol_cur(&voltage, ¤t);
|
||||
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, "0.00");
|
||||
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, "uA");
|
||||
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, "0.00");
|
||||
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, "0.00");
|
||||
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, 250, NULL);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void ui_main_screen_destroy(void)
|
||||
{
|
||||
lv_timer_delete(_flush_timer);
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
#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);
|
||||
void ui_main_page_key_handler(void *key_event);
|
||||
|
||||
extern lv_obj_t * ui_HomeScreen;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user