mirror of
https://github.com/No-Chicken/Power-Pico.git
synced 2026-04-03 13:02:36 +08:00
加入电压电流数据传输的消息队列,取消直接访问变量
This commit is contained in:
@@ -8,7 +8,12 @@
|
||||
|
||||
#include "./ui_helpers.h"
|
||||
|
||||
///////////////////// ui help funtions ////////////////////
|
||||
///////////////////// ui variables ////////////////////
|
||||
|
||||
float ui_current_voltage = 0.0f; // 当前电压,单位 V
|
||||
float ui_current_current = 0.0f; // 当前电流,单位 uA
|
||||
|
||||
///////////////////// ui help functions ////////////////////
|
||||
|
||||
void ui_full_screen_refresh(lv_obj_t * screen) {
|
||||
// 标记整个屏幕为脏区域
|
||||
@@ -60,7 +65,12 @@ uint16_t ui_get_display_rotation(void) {
|
||||
|
||||
// 获取当前电压, 单位 V; 当前电流, 单位 uA
|
||||
void ui_get_vol_cur(float *voltage, float *current) {
|
||||
Data_Monitor_Get_Values(voltage, current);
|
||||
if (voltage != NULL) {
|
||||
*voltage = ui_current_voltage;
|
||||
}
|
||||
if (current != NULL) {
|
||||
*current = ui_current_current;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////// set functions ///////////////
|
||||
@@ -85,8 +95,15 @@ void ui_set_display_rotation(uint16_t rotation) {
|
||||
Sys_Set_Rotation(rotation);
|
||||
}
|
||||
|
||||
// 设置 UI 层的电压电流变量, 供 UI 层显示使用, 单位分别为 V 和 uA
|
||||
void ui_update_vol_cur_varables(float voltage, float current) {
|
||||
ui_current_voltage = voltage;
|
||||
ui_current_current = current;
|
||||
}
|
||||
|
||||
void ui_clear_data_monitor(void) {
|
||||
Data_Monitor_Clear();
|
||||
// 不能直接访问其他层的数据,to be write
|
||||
// Data_Monitor_Clear();
|
||||
}
|
||||
|
||||
//////////////// sys save functions ///////////////
|
||||
|
||||
@@ -11,7 +11,12 @@ extern "C" {
|
||||
#include "lvgl.h"
|
||||
#include "stdio.h"
|
||||
|
||||
///////////////////// help funtions ////////////////////
|
||||
///////////////////// ui variables ////////////////////
|
||||
|
||||
extern float ui_current_voltage;
|
||||
extern float ui_current_current;
|
||||
|
||||
///////////////////// help functions ////////////////////
|
||||
|
||||
void ui_full_screen_refresh(lv_obj_t * screen);
|
||||
|
||||
@@ -34,6 +39,7 @@ void ui_set_back_light_level(uint8_t level);
|
||||
void ui_set_key_sound_enable(bool enable);
|
||||
void ui_set_language_select(uint8_t lang);
|
||||
void ui_set_display_rotation(uint16_t rotation);
|
||||
void ui_update_vol_cur_varables(float voltage, float current);
|
||||
void ui_clear_data_monitor(void);
|
||||
|
||||
// sys save function
|
||||
|
||||
Reference in New Issue
Block a user