lvgl任务与菜单刷新分离;
benchmark fps=1;
freertos分配内存还原至15360;
显存单双buff区别不大,显存扩大至1/8屏;
This commit is contained in:
吴俊潮 2025-01-09 15:25:06 +08:00
parent 440c86a343
commit b22783cfc0
555 changed files with 48578 additions and 81504 deletions

View File

@ -2,7 +2,7 @@
* @Author: wujunchao wujunchao@wuxismart.com * @Author: wujunchao wujunchao@wuxismart.com
* @Date: 2024-12-27 11:50:56 * @Date: 2024-12-27 11:50:56
* @LastEditors: wujunchao wujunchao@wuxismart.com * @LastEditors: wujunchao wujunchao@wuxismart.com
* @LastEditTime: 2025-01-09 09:52:24 * @LastEditTime: 2025-01-09 15:17:28
* @FilePath: \signal_generator\App\APP_WU\Src\apps_gather.c * @FilePath: \signal_generator\App\APP_WU\Src\apps_gather.c
* @Description: ,`customMade`, koroFileHeader查看配置 : https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE * @Description: ,`customMade`, koroFileHeader查看配置 : https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/ */
@ -50,6 +50,7 @@ void scr_init_run(void)
scr_init_bar1 = scr_init_cnt*25; scr_init_bar1 = scr_init_cnt*25;
lv_bar_set_value(guider_ui.screen_init_bar_1, scr_init_bar1, LV_ANIM_OFF); lv_bar_set_value(guider_ui.screen_init_bar_1, scr_init_bar1, LV_ANIM_OFF);
scr_init_cnt ++; scr_init_cnt ++;
} }
} }
@ -134,8 +135,8 @@ void battery_show(void)
{ {
battery_3000ms_flag = 0; battery_3000ms_flag = 0;
bt_cnt = (bt_cnt >= 5)?(0):( bt_cnt + 1);
lv_img_set_src(guider_ui.screen_main_animimg_1, screen_main_animimg_1_imgs[bt_cnt]); lv_img_set_src(guider_ui.screen_main_animimg_1, screen_main_animimg_1_imgs[bt_cnt]);
bt_cnt = (bt_cnt >= 5)?(0):( bt_cnt + 1);
} }
} }
@ -146,8 +147,9 @@ void dynamic_plot(void)
{ {
plot_1500ms_flag = 0; plot_1500ms_flag = 0;
plot_cnt = (plot_cnt > 9)?(0):( plot_cnt + 1);
lv_chart_set_next_value(guider_ui.screen_main_chart_1, guider_ui.screen_main_chart_1_0, 10 * plot_cnt); lv_chart_set_next_value(guider_ui.screen_main_chart_1, guider_ui.screen_main_chart_1_0, 10 * plot_cnt);
plot_cnt = (plot_cnt > 9)?(0):( plot_cnt + 1);
sprintf(scr_main.sig_data_io, "%03d.%03d", 0, 10 * plot_cnt); sprintf(scr_main.sig_data_io, "%03d.%03d", 0, 10 * plot_cnt);
lv_span_set_text(guider_ui.screen_main_spangroup_2_span, scr_main.sig_data_io); lv_span_set_text(guider_ui.screen_main_spangroup_2_span, scr_main.sig_data_io);
@ -179,9 +181,13 @@ void menu_test4_reset(void)
bt_cnt = 0; bt_cnt = 0;
plot_cnt = 0; plot_cnt = 0;
init_scr_del_flag(&guider_ui);
setup_scr_screen_init(&guider_ui); setup_scr_screen_init(&guider_ui);
lv_scr_load(guider_ui.screen_init); lv_scr_load(guider_ui.screen_init);
guider_ui.screen_main_del = true;
lv_obj_del(guider_ui.screen_main);
guider_ui.screen_setting_del = true;
lv_obj_del(guider_ui.screen_setting);
} }
/**********test4**********/ /**********test4**********/

View File

@ -8,7 +8,7 @@
// LCM resolution:240x320, // LCM resolution:240x320,
// driver IC:ST7789V, // driver IC:ST7789V,
#include <chinese_code.h> //#include <chinese_code.h>
typedef struct typedef struct
{ {
@ -239,19 +239,6 @@ void display_color(int color_data)
} }
} }
// 指定区域填充指定颜色
void display_color_new(int32_t xa, int32_t ya, int32_t xb, int32_t yb ,int color_data)
{
int i, j;
lcd_address(xa, ya, xb, yb);
for (i = xa; i < xb; i++)
{
for (j = ya; j < yb; j++)
{
transfer_data_16(color_data);
}
}
}
void display_black(void) void display_black(void)
{ {
@ -282,6 +269,7 @@ void display_black(void)
} }
} }
#if 0
//显示8x16点阵的字符串 //显示8x16点阵的字符串
void disp_string_8x16(int x, int y, const char *text, int font_color, int back_color) void disp_string_8x16(int x, int y, const char *text, int font_color, int back_color)
{ {
@ -391,6 +379,9 @@ void display_image(int x, int y, const uchar *dp)
} }
} }
} }
void lcd_menu(void) void lcd_menu(void)
{ {
static uint8_t init_flag = 0; static uint8_t init_flag = 0;
@ -410,3 +401,8 @@ void lcd_menu(void)
sprintf(content, "AO:ch[%02d] vol[%2.4f]V.", mux_signal.channel, mux_signal.data_sv / 1000.0f); sprintf(content, "AO:ch[%02d] vol[%2.4f]V.", mux_signal.channel, mux_signal.data_sv / 1000.0f);
disp_string_8x16(10, 70, content, white, blue); disp_string_8x16(10, 70, content, white, blue);
} }
#endif

View File

@ -45,8 +45,6 @@ void lcd_initial(void);
void lcd_menu(void); void lcd_menu(void);
void display_color_new(int32_t xa, int32_t ya, int32_t xb, int32_t yb ,int color_data);
void lcd_address(int XS, int YS, int x_total, int y_total); void lcd_address(int XS, int YS, int x_total, int y_total);
void transfer_data_16(uint16_t data_16bit); void transfer_data_16(uint16_t data_16bit);

View File

@ -64,7 +64,7 @@
#define configTICK_RATE_HZ ((TickType_t)1000) #define configTICK_RATE_HZ ((TickType_t)1000)
#define configMAX_PRIORITIES ( 7 ) #define configMAX_PRIORITIES ( 7 )
#define configMINIMAL_STACK_SIZE ((uint16_t)128) #define configMINIMAL_STACK_SIZE ((uint16_t)128)
#define configTOTAL_HEAP_SIZE ((size_t)50000) #define configTOTAL_HEAP_SIZE ((size_t)15360)
#define configMAX_TASK_NAME_LEN ( 16 ) #define configMAX_TASK_NAME_LEN ( 16 )
#define configUSE_16_BIT_TICKS 0 #define configUSE_16_BIT_TICKS 0
#define configUSE_MUTEXES 1 #define configUSE_MUTEXES 1

View File

@ -45,7 +45,6 @@
/* Private variables ---------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/
/* USER CODE BEGIN Variables */ /* USER CODE BEGIN Variables */
/* USER CODE END Variables */ /* USER CODE END Variables */
osThreadId defaultTaskHandle; osThreadId defaultTaskHandle;
osThreadId task_lcdHandle; osThreadId task_lcdHandle;
@ -53,7 +52,9 @@ osThreadId task_hartHandle;
osThreadId task_bleHandle; osThreadId task_bleHandle;
osThreadId task_rs485Handle; osThreadId task_rs485Handle;
osThreadId task_mux_analogHandle; osThreadId task_mux_analogHandle;
osThreadId task_menuHandle;
osMessageQId myQueue01Handle; osMessageQId myQueue01Handle;
osMutexId mutex_lvglHandle;
/* Private function prototypes -----------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/
/* USER CODE BEGIN FunctionPrototypes */ /* USER CODE BEGIN FunctionPrototypes */
@ -66,6 +67,7 @@ void start_task_hart(void const * argument);
void start_task_ble(void const * argument); void start_task_ble(void const * argument);
void start_rs485(void const * argument); void start_rs485(void const * argument);
void start_mux_analog(void const * argument); void start_mux_analog(void const * argument);
void start_menu(void const * argument);
void MX_FREERTOS_Init(void); /* (MISRA C 2004 rule 8.1) */ void MX_FREERTOS_Init(void); /* (MISRA C 2004 rule 8.1) */
@ -94,6 +96,10 @@ void MX_FREERTOS_Init(void) {
/* USER CODE BEGIN Init */ /* USER CODE BEGIN Init */
/* USER CODE END Init */ /* USER CODE END Init */
/* Create the mutex(es) */
/* definition and creation of mutex_lvgl */
osMutexDef(mutex_lvgl);
mutex_lvglHandle = osMutexCreate(osMutex(mutex_lvgl));
/* USER CODE BEGIN RTOS_MUTEX */ /* USER CODE BEGIN RTOS_MUTEX */
/* add mutexes, ... */ /* add mutexes, ... */
@ -122,7 +128,7 @@ void MX_FREERTOS_Init(void) {
defaultTaskHandle = osThreadCreate(osThread(defaultTask), NULL); defaultTaskHandle = osThreadCreate(osThread(defaultTask), NULL);
/* definition and creation of task_lcd */ /* definition and creation of task_lcd */
osThreadDef(task_lcd, start_task_lcd, osPriorityIdle, 0, 1024); osThreadDef(task_lcd, start_task_lcd, osPriorityBelowNormal, 0, 512);
task_lcdHandle = osThreadCreate(osThread(task_lcd), NULL); task_lcdHandle = osThreadCreate(osThread(task_lcd), NULL);
/* definition and creation of task_hart */ /* definition and creation of task_hart */
@ -130,17 +136,21 @@ void MX_FREERTOS_Init(void) {
task_hartHandle = osThreadCreate(osThread(task_hart), NULL); task_hartHandle = osThreadCreate(osThread(task_hart), NULL);
/* definition and creation of task_ble */ /* definition and creation of task_ble */
osThreadDef(task_ble, start_task_ble, osPriorityLow, 0, 128); osThreadDef(task_ble, start_task_ble, osPriorityBelowNormal, 0, 128);
task_bleHandle = osThreadCreate(osThread(task_ble), NULL); task_bleHandle = osThreadCreate(osThread(task_ble), NULL);
/* definition and creation of task_rs485 */ /* definition and creation of task_rs485 */
osThreadDef(task_rs485, start_rs485, osPriorityBelowNormal, 0, 128); osThreadDef(task_rs485, start_rs485, osPriorityNormal, 0, 128);
task_rs485Handle = osThreadCreate(osThread(task_rs485), NULL); task_rs485Handle = osThreadCreate(osThread(task_rs485), NULL);
/* definition and creation of task_mux_analog */ /* definition and creation of task_mux_analog */
osThreadDef(task_mux_analog, start_mux_analog, osPriorityAboveNormal, 0, 128); osThreadDef(task_mux_analog, start_mux_analog, osPriorityAboveNormal, 0, 128);
task_mux_analogHandle = osThreadCreate(osThread(task_mux_analog), NULL); task_mux_analogHandle = osThreadCreate(osThread(task_mux_analog), NULL);
/* definition and creation of task_menu */
osThreadDef(task_menu, start_menu, osPriorityIdle, 0, 512);
task_menuHandle = osThreadCreate(osThread(task_menu), NULL);
/* USER CODE BEGIN RTOS_THREADS */ /* USER CODE BEGIN RTOS_THREADS */
/* add threads, ... */ /* add threads, ... */
/* USER CODE END RTOS_THREADS */ /* USER CODE END RTOS_THREADS */
@ -178,13 +188,16 @@ void StartDefaultTask(void const * argument)
void start_task_lcd(void const * argument) void start_task_lcd(void const * argument)
{ {
/* USER CODE BEGIN start_task_lcd */ /* USER CODE BEGIN start_task_lcd */
// lcd_initial(); osStatus result;
/* Infinite loop */ /* Infinite loop */
for (;;) for (;;)
{ {
//menu_test4(); //menu_test4();
if(result == osMutexWait(mutex_lvglHandle,10))
{
lv_timer_handler(); //LVGL刷新任务 lv_timer_handler(); //LVGL刷新任务
osMutexRelease(mutex_lvglHandle);
}
osDelay(5); osDelay(5);
} }
@ -278,6 +291,25 @@ void start_mux_analog(void const * argument)
/* USER CODE END start_mux_analog */ /* USER CODE END start_mux_analog */
} }
/* USER CODE BEGIN Header_start_menu */
/**
* @brief Function implementing the task_menu thread.
* @param argument: Not used
* @retval None
*/
/* USER CODE END Header_start_menu */
void start_menu(void const * argument)
{
/* USER CODE BEGIN start_menu */
/* Infinite loop */
for(;;)
{
menu_test4();
osDelay(100);
}
/* USER CODE END start_menu */
}
/* Private application code --------------------------------------------------*/ /* Private application code --------------------------------------------------*/
/* USER CODE BEGIN Application */ /* USER CODE BEGIN Application */

View File

@ -112,15 +112,15 @@ int main(void)
/* USER CODE BEGIN 2 */ /* USER CODE BEGIN 2 */
tm1650_init(&hi2c1); tm1650_init(&hi2c1);
lcd_initial(); // LCD初始化 // lcd_initial(); // LCD初始化迁移至lv_port_disp_init()内部
lv_init(); // LVGL 初始化 lv_init(); // LVGL 初始化
lv_port_disp_init(); // 注册LVGL的显示任务初始化 lv_port_disp_init(); // 注册LVGL的显示任务初始化
HAL_TIM_Base_Start_IT(&htim6); HAL_TIM_Base_Start_IT(&htim6);
lv_demo_benchmark(); // lv_demo_benchmark(); //lv_conf.h, line:761
// setup_ui(&guider_ui); // 初始化UI设置与加载初始界面 setup_ui(&guider_ui); // 初始化UI设置与加载初始界面
// events_init(&guider_ui); // 初始化事件 events_init(&guider_ui); // 初始化事件
/* USER CODE END 2 */ /* USER CODE END 2 */

View File

@ -84,8 +84,8 @@ void lv_port_disp_init(void)
/* Example for 1) */ /* Example for 1) */
static lv_disp_draw_buf_t draw_buf_dsc_1; static lv_disp_draw_buf_t draw_buf_dsc_1;
static lv_color_t buf_1[MY_DISP_HOR_RES * MY_DISP_VER_RES / 10]; /*A buffer for 10 rows*/ static lv_color_t buf_1[MY_DISP_HOR_RES * MY_DISP_VER_RES / 8]; /*A buffer for 10 rows*/
lv_disp_draw_buf_init(&draw_buf_dsc_1, buf_1, NULL, MY_DISP_HOR_RES * MY_DISP_VER_RES / 10); /*Initialize the display buffer*/ lv_disp_draw_buf_init(&draw_buf_dsc_1, buf_1, NULL, MY_DISP_HOR_RES * MY_DISP_VER_RES / 8); /*Initialize the display buffer*/
// /* Example for 2) */ // /* Example for 2) */
// static lv_disp_draw_buf_t draw_buf_dsc_2; // static lv_disp_draw_buf_t draw_buf_dsc_2;
@ -147,6 +147,7 @@ void lv_port_disp_init(void)
static void disp_init(void) static void disp_init(void)
{ {
/*You code here*/ /*You code here*/
lcd_initial(); // LCD初始化
} }
volatile bool disp_flush_enabled = true; volatile bool disp_flush_enabled = true;

View File

@ -758,7 +758,7 @@
#define LV_USE_DEMO_KEYPAD_AND_ENCODER 0 #define LV_USE_DEMO_KEYPAD_AND_ENCODER 0
/*Benchmark your system*/ /*Benchmark your system*/
#define LV_USE_DEMO_BENCHMARK 1 #define LV_USE_DEMO_BENCHMARK 0
#if LV_USE_DEMO_BENCHMARK #if LV_USE_DEMO_BENCHMARK
/*Use RGB565A8 images with 16 bit color depth instead of ARGB8565*/ /*Use RGB565A8 images with 16 bit color depth instead of ARGB8565*/
#define LV_DEMO_BENCHMARK_RGB565A8 0 #define LV_DEMO_BENCHMARK_RGB565A8 0

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -82,7 +82,7 @@
</BeforeMake> </BeforeMake>
<AfterMake> <AfterMake>
<RunUserProg1>0</RunUserProg1> <RunUserProg1>0</RunUserProg1>
<RunUserProg2>0</RunUserProg2> <RunUserProg2>1</RunUserProg2>
<UserProg1Name></UserProg1Name> <UserProg1Name></UserProg1Name>
<UserProg2Name></UserProg2Name> <UserProg2Name></UserProg2Name>
<UserProg1Dos16Mode>0</UserProg1Dos16Mode> <UserProg1Dos16Mode>0</UserProg1Dos16Mode>
@ -341,7 +341,7 @@
<MiscControls></MiscControls> <MiscControls></MiscControls>
<Define>USE_HAL_DRIVER,STM32F407xx</Define> <Define>USE_HAL_DRIVER,STM32F407xx</Define>
<Undefine></Undefine> <Undefine></Undefine>
<IncludePath>../Core/Inc;../Drivers/STM32F4xx_HAL_Driver/Inc;../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy;../Middlewares/Third_Party/FreeRTOS/Source/include;../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS;../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM4F;../Drivers/CMSIS/Device/ST/STM32F4xx/Include;../Drivers/CMSIS/Include;../App/LCD;../App/MODBUS;../Utils/inc;../App/BLE;../App/MUX_SIGNAL;../App/DAC8552;../App/HART;../App/RN7302;../App/ADS1220;../App/TM1650;../App/DAC7811;../App/SIG24130;../LVGL;../LVGL/src;../LVGL/examples/porting;../LVGL/myGUI/generated;../LVGL/myGUI/custom;../LVGL/myGUI/generated/guider_fonts;../LVGL/myGUI/generated/guider_customer_fonts;../App/APP_WU/Src;../App/APP_WU/Inc;..\LVGL\demos\benchmark;..\LVGL\demos</IncludePath> <IncludePath>../Core/Inc;../Drivers/STM32F4xx_HAL_Driver/Inc;../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy;../Middlewares/Third_Party/FreeRTOS/Source/include;../Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS;../Middlewares/Third_Party/FreeRTOS/Source/portable/RVDS/ARM_CM4F;../Drivers/CMSIS/Device/ST/STM32F4xx/Include;../Drivers/CMSIS/Include;../App/LCD;../App/MODBUS;../Utils/inc;../App/BLE;../App/MUX_SIGNAL;../App/DAC8552;../App/HART;../App/RN7302;../App/ADS1220;../App/TM1650;../App/DAC7811;../App/SIG24130;../LVGL;../LVGL/src;../LVGL/examples/porting;../LVGL/myGUI/generated;../LVGL/myGUI/custom;../LVGL/myGUI/generated/guider_fonts;../LVGL/myGUI/generated/guider_customer_fonts;../App/APP_WU/Src;../App/APP_WU/Inc;../LVGL/demos/benchmark;../LVGL/demos</IncludePath>
</VariousControls> </VariousControls>
</Cads> </Cads>
<Aads> <Aads>

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -195,6 +195,5 @@ signal_generator\apps_gather.o: ../LVGL/myGUI/generated/events_init.h
signal_generator\apps_gather.o: ../App/APP_WU/Inc/timer.h signal_generator\apps_gather.o: ../App/APP_WU/Inc/timer.h
signal_generator\apps_gather.o: ../App/APP_WU/Inc/apps_gather.h signal_generator\apps_gather.o: ../App/APP_WU/Inc/apps_gather.h
signal_generator\apps_gather.o: E:\Softwares\Keil_v5\ARM\ARMCC\Bin\..\include\stdio.h signal_generator\apps_gather.o: E:\Softwares\Keil_v5\ARM\ARMCC\Bin\..\include\stdio.h
signal_generator\apps_gather.o: ..\LVGL\demos\benchmark\lv_demo_benchmark.h signal_generator\apps_gather.o: ../LVGL/demos/benchmark/lv_demo_benchmark.h
signal_generator\apps_gather.o: ..\LVGL\demos\benchmark\../lv_demos.h signal_generator\apps_gather.o: ../LVGL/demos/benchmark/../lv_demos.h
signal_generator\apps_gather.o: ..\LVGL\demos\benchmark\../benchmark/lv_demo_benchmark.h

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -200,6 +200,5 @@ signal_generator\freertos.o: ../LVGL/myGUI/generated/events_init.h
signal_generator\freertos.o: ../App/APP_WU/Inc/timer.h signal_generator\freertos.o: ../App/APP_WU/Inc/timer.h
signal_generator\freertos.o: ../App/APP_WU/Inc/apps_gather.h signal_generator\freertos.o: ../App/APP_WU/Inc/apps_gather.h
signal_generator\freertos.o: E:\Softwares\Keil_v5\ARM\ARMCC\Bin\..\include\stdio.h signal_generator\freertos.o: E:\Softwares\Keil_v5\ARM\ARMCC\Bin\..\include\stdio.h
signal_generator\freertos.o: ..\LVGL\demos\benchmark\lv_demo_benchmark.h signal_generator\freertos.o: ../LVGL/demos/benchmark/lv_demo_benchmark.h
signal_generator\freertos.o: ..\LVGL\demos\benchmark\../lv_demos.h signal_generator\freertos.o: ../LVGL/demos/benchmark/../lv_demos.h
signal_generator\freertos.o: ..\LVGL\demos\benchmark\../benchmark/lv_demo_benchmark.h

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -46,4 +46,3 @@ signal_generator\jlx240-00301-bn.o: ../App/MUX_SIGNAL/mux_signal.h
signal_generator\jlx240-00301-bn.o: ../Core/Inc/gpio.h signal_generator\jlx240-00301-bn.o: ../Core/Inc/gpio.h
signal_generator\jlx240-00301-bn.o: ../App/TM1650/tm1650.h signal_generator\jlx240-00301-bn.o: ../App/TM1650/tm1650.h
signal_generator\jlx240-00301-bn.o: ../Core/Inc/i2c.h signal_generator\jlx240-00301-bn.o: ../Core/Inc/i2c.h
signal_generator\jlx240-00301-bn.o: ../App/LCD/chinese_code.h

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More