mirror of
https://github.com/No-Chicken/Power-Pico.git
synced 2026-04-03 13:02:36 +08:00
外置一个全局UI定时器,定时全刷新LCD
This commit is contained in:
@@ -21,8 +21,6 @@ static lv_obj_t * ui_ButTime = NULL;
|
|||||||
static lv_obj_t * ui_LabelTime = NULL;
|
static lv_obj_t * ui_LabelTime = NULL;
|
||||||
static lv_timer_t * _flush_timer = NULL;
|
static lv_timer_t * _flush_timer = NULL;
|
||||||
|
|
||||||
static uint8_t timecount = 0;
|
|
||||||
|
|
||||||
// other funtions
|
// other funtions
|
||||||
|
|
||||||
#include "key.h"
|
#include "key.h"
|
||||||
@@ -130,11 +128,6 @@ static void set_val_cur_label(float voltage, float current)
|
|||||||
|
|
||||||
static void _flush_timer_cb()
|
static void _flush_timer_cb()
|
||||||
{
|
{
|
||||||
timecount++;
|
|
||||||
if(timecount >= 2) { // 1s
|
|
||||||
timecount = 0;
|
|
||||||
ui_full_screen_refresh(ui_HomeScreen);
|
|
||||||
}
|
|
||||||
float voltage = 0.0;
|
float voltage = 0.0;
|
||||||
float current = 0.0;
|
float current = 0.0;
|
||||||
current = ui_get_current();
|
current = ui_get_current();
|
||||||
@@ -264,6 +257,5 @@ void ui_main_screen_init(void)
|
|||||||
|
|
||||||
void ui_main_screen_destroy(void)
|
void ui_main_screen_destroy(void)
|
||||||
{
|
{
|
||||||
timecount = 0;
|
|
||||||
lv_timer_delete(_flush_timer);
|
lv_timer_delete(_flush_timer);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,8 @@ Page_t pages[] = {
|
|||||||
*/
|
*/
|
||||||
static void main_timer_cb(lv_timer_t * timer)
|
static void main_timer_cb(lv_timer_t * timer)
|
||||||
{
|
{
|
||||||
// do nothing
|
// 1s 刷新一次全屏,防止有时候不知什么原因的LCD刷新错误(需要后续找到问题从根本解决)
|
||||||
|
ui_full_screen_refresh(ui_HomeScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////// Animation //////////////////////
|
////////////////////////// Animation //////////////////////
|
||||||
|
|||||||
Reference in New Issue
Block a user