界面切换方式调整,消除内存碎片
This commit is contained in:
parent
c7fae1073a
commit
b2324f2d19
|
@ -57,6 +57,7 @@ extern const lv_img_dsc_t * screen_main_ani_out_sign_imgs[3];
|
|||
#include "stdio.h"
|
||||
#include "ip5310_i2c.h"
|
||||
#include "eeprom_spi.h"
|
||||
#include "stdlib.h"
|
||||
//#include "lv_demo_benchmark.h"
|
||||
|
||||
typedef enum
|
||||
|
|
|
@ -227,11 +227,7 @@ void key_functions_main(void)
|
|||
set_working_mode(SIG_CURRENT, CURRENT_MA);
|
||||
|
||||
//加载菜单界面
|
||||
setup_scr_screen_setting(&guider_ui);
|
||||
scr_setting_recover();
|
||||
|
||||
delay_cnt(100);
|
||||
|
||||
lv_obj_clear_flag(guider_ui.screen_setting, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_scr_load(guider_ui.screen_setting);
|
||||
|
||||
//按键标志置0,等待一段时间后再切换至设置菜单的按键功能
|
||||
|
@ -251,8 +247,8 @@ void key_functions_main(void)
|
|||
|
||||
if( (m5data.tick_cur - m5data.tick_prv) >= screen_switch_wait) //tick间隔达到目标后,执行功能
|
||||
{
|
||||
//清除主界面对象,释放内存
|
||||
lv_obj_del(guider_ui.screen_main);
|
||||
//隐藏主界面对象
|
||||
lv_obj_add_flag(guider_ui.screen_main, LV_OBJ_FLAG_HIDDEN);
|
||||
|
||||
//等待结束,切换成设置菜单的按键功能
|
||||
m5data.scr_now = SCREEN_SETTING; //当前界面为详细设置菜单
|
||||
|
@ -595,12 +591,13 @@ void scr_init_run(void)
|
|||
|
||||
case 2:
|
||||
{
|
||||
// //开机动画结束后,清除初始界面内部组件,保留对象,释放内存
|
||||
// lv_obj_clean(guider_ui.screen_init);
|
||||
|
||||
//加载主界面
|
||||
//加载主界面和设置界面的内容
|
||||
setup_scr_screen_main(&guider_ui);
|
||||
setup_scr_screen_setting(&guider_ui);
|
||||
|
||||
//额外处理,也用于界面切换
|
||||
scr_main_recover();
|
||||
scr_setting_recover();
|
||||
|
||||
delay_cnt(500);
|
||||
|
||||
|
@ -615,7 +612,8 @@ void scr_init_run(void)
|
|||
lv_scr_load(guider_ui.screen_main);
|
||||
|
||||
//删除初始界面对象,释放剩余内存
|
||||
lv_obj_del(guider_ui.screen_init);
|
||||
//lv_obj_del(guider_ui.screen_init);
|
||||
lv_obj_add_flag(guider_ui.screen_init, LV_OBJ_FLAG_HIDDEN);
|
||||
|
||||
m5data.tick_prv = xTaskGetTickCount(); //记录起始时刻
|
||||
}else
|
||||
|
|
|
@ -136,13 +136,7 @@ void key_functions_setting(void)
|
|||
tabdata.item_cursor = 0;
|
||||
|
||||
//加载主界面
|
||||
setup_scr_screen_main(&guider_ui);
|
||||
|
||||
//恢复之前显示的数据
|
||||
scr_main_recover();
|
||||
|
||||
delay_cnt(100);
|
||||
|
||||
lv_obj_clear_flag(guider_ui.screen_main, LV_OBJ_FLAG_HIDDEN);
|
||||
lv_scr_load(guider_ui.screen_main);
|
||||
|
||||
//设置菜单按键使能置零,等待一段时间后切换至主界面的按键功能
|
||||
|
@ -162,8 +156,8 @@ void key_functions_setting(void)
|
|||
|
||||
if( (m5data.tick_cur - m5data.tick_prv) >= screen_switch_wait) //tick间隔达到目标后,执行功能
|
||||
{
|
||||
//清除设置界面对象,释放内存
|
||||
lv_obj_del(guider_ui.screen_setting);
|
||||
//隐藏设置界面对象
|
||||
lv_obj_add_flag(guider_ui.screen_setting, LV_OBJ_FLAG_HIDDEN);
|
||||
|
||||
//等待结束,切换至主界面的按键功能
|
||||
m5data.scr_now = SCREEN_MAIN;
|
||||
|
|
|
@ -147,7 +147,7 @@ void physical_quantity_init(void)
|
|||
}
|
||||
|
||||
//切换屏幕的等待时间(ms)
|
||||
uint16_t screen_switch_wait = 300;
|
||||
uint16_t screen_switch_wait = 200;
|
||||
void screen_run(void)
|
||||
{
|
||||
if(m5data.menu_reset_flag)
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
#define configTICK_RATE_HZ ((TickType_t)1000)
|
||||
#define configMAX_PRIORITIES ( 7 )
|
||||
#define configMINIMAL_STACK_SIZE ((uint16_t)128)
|
||||
#define configTOTAL_HEAP_SIZE ((size_t)17360)
|
||||
#define configTOTAL_HEAP_SIZE ((size_t)20360)
|
||||
#define configMAX_TASK_NAME_LEN ( 16 )
|
||||
#define configUSE_TRACE_FACILITY 1
|
||||
#define configUSE_STATS_FORMATTING_FUNCTIONS 1
|
||||
|
|
|
@ -24,10 +24,10 @@
|
|||
* STATIC PROTOTYPES
|
||||
**********************/
|
||||
|
||||
static void touchpad_init(void);
|
||||
static void touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data);
|
||||
static bool touchpad_is_pressed(void);
|
||||
static void touchpad_get_xy(lv_coord_t * x, lv_coord_t * y);
|
||||
// static void touchpad_init(void);
|
||||
// static void touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data);
|
||||
// static bool touchpad_is_pressed(void);
|
||||
// static void touchpad_get_xy(lv_coord_t * x, lv_coord_t * y);
|
||||
|
||||
//static void mouse_init(void);
|
||||
//static void mouse_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data);
|
||||
|
@ -50,7 +50,7 @@ static void touchpad_get_xy(lv_coord_t * x, lv_coord_t * y);
|
|||
/**********************
|
||||
* STATIC VARIABLES
|
||||
**********************/
|
||||
lv_indev_t * indev_touchpad;
|
||||
//lv_indev_t * indev_touchpad;
|
||||
//lv_indev_t * indev_mouse;
|
||||
//lv_indev_t * indev_keypad;
|
||||
//lv_indev_t * indev_encoder;
|
||||
|
@ -81,20 +81,20 @@ void lv_port_indev_init(void)
|
|||
* You should shape them according to your hardware
|
||||
*/
|
||||
|
||||
static lv_indev_drv_t indev_drv;
|
||||
//static lv_indev_drv_t indev_drv;
|
||||
|
||||
/*------------------
|
||||
* Touchpad
|
||||
* -----------------*/
|
||||
|
||||
/*Initialize your touchpad if you have*/
|
||||
touchpad_init();
|
||||
//touchpad_init();
|
||||
|
||||
/*Register a touchpad input device*/
|
||||
lv_indev_drv_init(&indev_drv);
|
||||
indev_drv.type = LV_INDEV_TYPE_POINTER;
|
||||
indev_drv.read_cb = touchpad_read;
|
||||
indev_touchpad = lv_indev_drv_register(&indev_drv);
|
||||
// lv_indev_drv_init(&indev_drv);
|
||||
// indev_drv.type = LV_INDEV_TYPE_POINTER;
|
||||
// indev_drv.read_cb = touchpad_read;
|
||||
// indev_touchpad = lv_indev_drv_register(&indev_drv);
|
||||
|
||||
/*------------------
|
||||
* Mouse
|
||||
|
@ -180,48 +180,48 @@ void lv_port_indev_init(void)
|
|||
* -----------------*/
|
||||
|
||||
/*Initialize your touchpad*/
|
||||
static void touchpad_init(void)
|
||||
{
|
||||
/*Your code comes here*/
|
||||
}
|
||||
// static void touchpad_init(void)
|
||||
// {
|
||||
// /*Your code comes here*/
|
||||
// }
|
||||
|
||||
/*Will be called by the library to read the touchpad*/
|
||||
static void touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
|
||||
{
|
||||
static lv_coord_t last_x = 0;
|
||||
static lv_coord_t last_y = 0;
|
||||
// static void touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
|
||||
// {
|
||||
// static lv_coord_t last_x = 0;
|
||||
// static lv_coord_t last_y = 0;
|
||||
|
||||
/*Save the pressed coordinates and the state*/
|
||||
if(touchpad_is_pressed()) {
|
||||
touchpad_get_xy(&last_x, &last_y);
|
||||
data->state = LV_INDEV_STATE_PR;
|
||||
}
|
||||
else {
|
||||
data->state = LV_INDEV_STATE_REL;
|
||||
}
|
||||
// /*Save the pressed coordinates and the state*/
|
||||
// if(touchpad_is_pressed()) {
|
||||
// touchpad_get_xy(&last_x, &last_y);
|
||||
// data->state = LV_INDEV_STATE_PR;
|
||||
// }
|
||||
// else {
|
||||
// data->state = LV_INDEV_STATE_REL;
|
||||
// }
|
||||
|
||||
/*Set the last pressed coordinates*/
|
||||
data->point.x = last_x;
|
||||
data->point.y = last_y;
|
||||
}
|
||||
// /*Set the last pressed coordinates*/
|
||||
// data->point.x = last_x;
|
||||
// data->point.y = last_y;
|
||||
// }
|
||||
|
||||
/*Return true is the touchpad is pressed*/
|
||||
static bool touchpad_is_pressed(void)
|
||||
{
|
||||
/*Your code comes here*/
|
||||
//添加触摸检测函数,暂无
|
||||
return false; //有触摸检测函数的情况下,注释掉此行
|
||||
}
|
||||
// static bool touchpad_is_pressed(void)
|
||||
// {
|
||||
// /*Your code comes here*/
|
||||
// //添加触摸检测函数,暂无
|
||||
// return false; //有触摸检测函数的情况下,注释掉此行
|
||||
// }
|
||||
|
||||
/*Get the x and y coordinates if the touchpad is pressed*/
|
||||
static void touchpad_get_xy(lv_coord_t * x, lv_coord_t * y)
|
||||
{
|
||||
/*Your code comes here*/
|
||||
//添加坐标获取函数,暂无
|
||||
(*x) = 0;
|
||||
(*y) = 0;
|
||||
//触摸时,可以添加一个画点,用于测试识别到的触摸点位是否正确
|
||||
}
|
||||
// static void touchpad_get_xy(lv_coord_t * x, lv_coord_t * y)
|
||||
// {
|
||||
// /*Your code comes here*/
|
||||
// //添加坐标获取函数,暂无
|
||||
// (*x) = 0;
|
||||
// (*y) = 0;
|
||||
// //触摸时,可以添加一个画点,用于测试识别到的触摸点位是否正确
|
||||
// }
|
||||
|
||||
/*------------------
|
||||
* Mouse
|
||||
|
|
|
@ -60,9 +60,9 @@
|
|||
#endif
|
||||
|
||||
#else /*LV_MEM_CUSTOM*/
|
||||
#define LV_MEM_CUSTOM_INCLUDE <stdlib.h> /*Header for the dynamic memory function*/
|
||||
#define LV_MEM_CUSTOM_ALLOC malloc
|
||||
#define LV_MEM_CUSTOM_FREE free
|
||||
#define LV_MEM_CUSTOM_INCLUDE "apps_gather.h" /*Header for the dynamic memory function*/
|
||||
#define LV_MEM_CUSTOM_ALLOC pvPortMalloc
|
||||
#define LV_MEM_CUSTOM_FREE vPortFree
|
||||
#define LV_MEM_CUSTOM_REALLOC realloc
|
||||
#endif /*LV_MEM_CUSTOM*/
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -27,7 +27,7 @@ FREERTOS.INCLUDE_uxTaskGetStackHighWaterMark=1
|
|||
FREERTOS.IPParameters=Tasks01,FootprintOK,configUSE_TICKLESS_IDLE,configGENERATE_RUN_TIME_STATS,configTOTAL_HEAP_SIZE,configUSE_STATS_FORMATTING_FUNCTIONS,configUSE_TRACE_FACILITY,configUSE_IDLE_HOOK,INCLUDE_uxTaskGetStackHighWaterMark
|
||||
FREERTOS.Tasks01=defaultTask,-3,128,StartDefaultTask,Default,NULL,Dynamic,NULL,NULL;task_lcd,1,768,start_task_lcd,Default,NULL,Dynamic,NULL,NULL;task_hart,2,256,start_task_hart,Default,NULL,Dynamic,NULL,NULL;task_ble,-1,256,start_task_ble,Default,NULL,Dynamic,NULL,NULL;task_rs485,2,256,start_rs485,Default,NULL,Dynamic,NULL,NULL;task_mux_analog,3,128,start_mux_analog,Default,NULL,Dynamic,NULL,NULL;task_menu,0,512,start_menu,Default,NULL,Dynamic,NULL,NULL;task_monitor,-3,128,start_task_monitor,Default,NULL,Dynamic,NULL,NULL
|
||||
FREERTOS.configGENERATE_RUN_TIME_STATS=0
|
||||
FREERTOS.configTOTAL_HEAP_SIZE=17360
|
||||
FREERTOS.configTOTAL_HEAP_SIZE=20360
|
||||
FREERTOS.configUSE_IDLE_HOOK=0
|
||||
FREERTOS.configUSE_STATS_FORMATTING_FUNCTIONS=1
|
||||
FREERTOS.configUSE_TICKLESS_IDLE=0
|
||||
|
|
Loading…
Reference in New Issue