mirror of
https://github.com/No-Chicken/Power-Pico.git
synced 2026-04-03 13:02:36 +08:00
更新分层API
This commit is contained in:
@@ -4,7 +4,6 @@
|
|||||||
// Project name: PowerPico
|
// Project name: PowerPico
|
||||||
|
|
||||||
#include "../ui.h"
|
#include "../ui.h"
|
||||||
#include "data_queue.h" // bsp/data_queue.h for voltage/current queues
|
|
||||||
|
|
||||||
lv_obj_t * ui_PPSPage = NULL;
|
lv_obj_t * ui_PPSPage = NULL;
|
||||||
static lv_obj_t * ui_PanelPPSVol = NULL;
|
static lv_obj_t * ui_PanelPPSVol = NULL;
|
||||||
@@ -56,8 +55,8 @@ static void _flush_timer_cb(void) {
|
|||||||
char buf[5];
|
char buf[5];
|
||||||
float voltage = 0.0;
|
float voltage = 0.0;
|
||||||
float current = 0.0;
|
float current = 0.0;
|
||||||
current = queue_average(global_current_queue); // uA
|
current = ui_get_current(); // uA
|
||||||
voltage = queue_average(global_voltage_queue); // V
|
voltage = ui_get_voltage(); // V
|
||||||
sprintf(buf, "%.2f", voltage);
|
sprintf(buf, "%.2f", voltage);
|
||||||
lv_label_set_text(ui_LabelPPSVol, buf);
|
lv_label_set_text(ui_LabelPPSVol, buf);
|
||||||
sprintf(buf, "%.2f", current/1000000.0); // 转换为 A
|
sprintf(buf, "%.2f", current/1000000.0); // 转换为 A
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#include "../ui.h"
|
#include "../ui.h"
|
||||||
#include "ui_mainPage.h"
|
#include "ui_mainPage.h"
|
||||||
#include "data_queue.h" // bsp/data_queue.h for voltage/current queues
|
|
||||||
#include "math.h"
|
#include "math.h"
|
||||||
|
|
||||||
lv_obj_t * ui_HomeScreen = NULL;
|
lv_obj_t * ui_HomeScreen = NULL;
|
||||||
@@ -138,8 +137,8 @@ static void _flush_timer_cb()
|
|||||||
}
|
}
|
||||||
float voltage = 0.0;
|
float voltage = 0.0;
|
||||||
float current = 0.0;
|
float current = 0.0;
|
||||||
current = queue_average(global_current_queue);
|
current = ui_get_current();
|
||||||
voltage = queue_average(global_voltage_queue);
|
voltage = ui_get_voltage();
|
||||||
set_val_cur_label(voltage, current);
|
set_val_cur_label(voltage, current);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#include "BL24C02.h" // system settings
|
#include "BL24C02.h" // system settings
|
||||||
#include "rtc.h" // elapsed time
|
#include "rtc.h" // elapsed time
|
||||||
|
#include "data_queue.h" // bsp/data_queue.h for voltage/current queues
|
||||||
|
|
||||||
#include "./ui.h"
|
#include "./ui.h"
|
||||||
#include "./screens/ui_StartPage.h"
|
#include "./screens/ui_StartPage.h"
|
||||||
#include "./screens/ui_mainPage.h"
|
#include "./screens/ui_mainPage.h"
|
||||||
@@ -30,6 +32,14 @@ uint16_t ui_get_display_rotation(void) {
|
|||||||
return Sys_Get_Rotation();
|
return Sys_Get_Rotation();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float ui_get_voltage(void) {
|
||||||
|
return queue_average(global_voltage_queue);
|
||||||
|
}
|
||||||
|
|
||||||
|
float ui_get_current(void) {
|
||||||
|
return queue_average(global_current_queue);
|
||||||
|
}
|
||||||
|
|
||||||
// set functions
|
// set functions
|
||||||
|
|
||||||
void ui_set_back_light_level(uint8_t level) {
|
void ui_set_back_light_level(uint8_t level) {
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ void ui_GetElapsedTime_HMS(uint8_t *hours, uint8_t *minutes, uint8_t *seconds);
|
|||||||
uint8_t ui_get_back_light_level(void);
|
uint8_t ui_get_back_light_level(void);
|
||||||
bool ui_get_key_sound_enable(void);
|
bool ui_get_key_sound_enable(void);
|
||||||
uint16_t ui_get_display_rotation(void);
|
uint16_t ui_get_display_rotation(void);
|
||||||
|
float ui_get_voltage(void);
|
||||||
|
float ui_get_current(void);
|
||||||
|
|
||||||
// set functions
|
// set functions
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user