新建测试任务待完善
This commit is contained in:
parent
0816204ee9
commit
8621bb3f16
3
.vscode/settings.json
vendored
3
.vscode/settings.json
vendored
@ -47,6 +47,7 @@
|
||||
"random": "c",
|
||||
"time.h": "c",
|
||||
"types.h": "c",
|
||||
"timespec.h": "c"
|
||||
"timespec.h": "c",
|
||||
"fluxprotocol.h": "c"
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,11 +12,71 @@
|
||||
#include <stdio.h>
|
||||
#include "FluxProtocol.h"
|
||||
|
||||
#include "esp_log.h"
|
||||
|
||||
/*记录spirits3的没分钟输出的体积*/
|
||||
float Spirit3_Volume[4] = { 210,420,630,750};
|
||||
float Spirit6_Volume[6] = { 210,420,630,840,1050,1200};
|
||||
float YULite8_Volume[6] = { 210,420,630,840,1050,1200};
|
||||
|
||||
/*
|
||||
* @brief 拼接测试过程中用于展示的字符串
|
||||
* 1.时间设置发送成功 Time setting sent successfully
|
||||
* 2.开始测试 start testing
|
||||
* 3.等待测试结束 Waiting for the end of the test
|
||||
* 4.当前频率测试结束 The current frequency test has ended
|
||||
* 5.所有频率测试完毕,请记录。 All frequency tests have been completed, please record.
|
||||
* 6.设备已启动成功,请开始测试。 Device started successfully, please start testing.
|
||||
*/
|
||||
char *test_info[] = {"Time setting sent successfully!!",\
|
||||
"start testing....",\
|
||||
"Waiting for the end of the test...",\
|
||||
"The current frequency test has ended!!",\
|
||||
"All frequency tests have been completed!!",\
|
||||
"Device started successfully!!!!"
|
||||
};
|
||||
|
||||
/* 导出协议数据结构体 */
|
||||
struct FluxProtocol fluxProtocol;
|
||||
|
||||
/**
|
||||
* @brief 新建用于进行带BS测试的任务函数
|
||||
*
|
||||
* @param[in] arg not used
|
||||
*
|
||||
*/
|
||||
void bs_test_task(void* arg)
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||
|
||||
ESP_LOGI("bs_test_task", "bs_test_task");
|
||||
|
||||
vTaskDelay(4000 / portTICK_PERIOD_MS);
|
||||
ESP_LOGI("bs_test_task", "bs_test_task end?");
|
||||
|
||||
ESP_LOGI("bs_test_timer_func","hahahahhahah............");
|
||||
|
||||
/* 显示测试成功 */
|
||||
lv_label_set_text(ui_pageHome_labelBSInfo,test_info[3]);
|
||||
|
||||
vTaskDelay(4000/portTICK_PERIOD_MS);
|
||||
lv_label_set_text(ui_pageHome_labelBSInfo,test_info[4]);
|
||||
|
||||
vTaskDelay(4000/portTICK_PERIOD_MS);
|
||||
lv_label_set_text(ui_pageHome_labelBSInfo,test_info[5]);
|
||||
|
||||
vTaskDelay(4000/portTICK_PERIOD_MS);
|
||||
lv_label_set_text(ui_pageHome_labelBSInfo,test_info[1]);
|
||||
|
||||
vTaskDelay(4000/portTICK_PERIOD_MS);
|
||||
lv_label_set_text(ui_pageHome_labelBSInfo,test_info[2]);
|
||||
|
||||
ESP_LOGI("bs_test_timer_func","bs_test_timer_func end right");
|
||||
|
||||
vTaskDelete(NULL);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -36,6 +36,9 @@ extern float Spirit3_Volume[4];
|
||||
extern float Spirit6_Volume[6];
|
||||
extern float YULite8_Volume[6];
|
||||
|
||||
/* 导出消息数据*/
|
||||
extern char *test_info[];
|
||||
|
||||
/* 声明设备类型 */
|
||||
typedef enum DeviceType{
|
||||
Spirit3,
|
||||
@ -85,6 +88,14 @@ typedef struct FluxCommand
|
||||
uint32_t PLC_ADDR;
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief 新建用于进行带BS测试的任务函数
|
||||
*
|
||||
* @param[in] arg not used
|
||||
*
|
||||
*/
|
||||
void bs_test_task(void* arg);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /*extern "C"*/
|
||||
#endif
|
||||
|
||||
@ -35,11 +35,11 @@ fonts/ui_font_homeText_1.c
|
||||
fonts/ui_font_LenovoHTC.c
|
||||
fonts/ui_font_MiSansB40.c
|
||||
fonts/ui_font_MiSansM.c
|
||||
fonts/ui_font_MisansM10.c
|
||||
fonts/ui_font_MiSansN.c
|
||||
fonts/ui_font_MiSansN14.c
|
||||
fonts/ui_font_symbols16.c
|
||||
fonts/ui_font_symbolsalibaba.c
|
||||
fonts/ui_font_MisansM10.c
|
||||
ui_event_wifi.c
|
||||
ui_event_debug.c
|
||||
ui_event_light.c
|
||||
|
||||
@ -35,8 +35,8 @@ fonts/ui_font_homeText_1.c
|
||||
fonts/ui_font_LenovoHTC.c
|
||||
fonts/ui_font_MiSansB40.c
|
||||
fonts/ui_font_MiSansM.c
|
||||
fonts/ui_font_MisansM10.c
|
||||
fonts/ui_font_MiSansN.c
|
||||
fonts/ui_font_MiSansN14.c
|
||||
fonts/ui_font_symbols16.c
|
||||
fonts/ui_font_symbolsalibaba.c
|
||||
fonts/ui_font_MisansM10.c
|
||||
|
||||
@ -673,7 +673,7 @@ void ui_pageHome_screen_init(void)
|
||||
lv_obj_set_y(ui_pageHome_labelBSInfo, 62);
|
||||
lv_obj_set_align(ui_pageHome_labelBSInfo, LV_ALIGN_CENTER);
|
||||
lv_label_set_text(ui_pageHome_labelBSInfo, "Start testing at 15BPM");
|
||||
lv_obj_set_style_text_font(ui_pageHome_labelBSInfo, &ui_font_MisansM10, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_text_font(ui_pageHome_labelBSInfo, &lv_font_montserrat_12, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
|
||||
ui_pageHome_labelstr23 = lv_label_create(ui_pageHome_panelResult1);
|
||||
lv_obj_set_width(ui_pageHome_labelstr23, LV_SIZE_CONTENT); /// 1
|
||||
|
||||
@ -458,11 +458,11 @@ LV_FONT_DECLARE(ui_font_homeText_1);
|
||||
LV_FONT_DECLARE(ui_font_LenovoHTC);
|
||||
LV_FONT_DECLARE(ui_font_MiSansB40);
|
||||
LV_FONT_DECLARE(ui_font_MiSansM);
|
||||
LV_FONT_DECLARE(ui_font_MisansM10);
|
||||
LV_FONT_DECLARE(ui_font_MiSansN);
|
||||
LV_FONT_DECLARE(ui_font_MiSansN14);
|
||||
LV_FONT_DECLARE(ui_font_symbols16);
|
||||
LV_FONT_DECLARE(ui_font_symbolsalibaba);
|
||||
LV_FONT_DECLARE(ui_font_MisansM10);
|
||||
|
||||
// UI INIT
|
||||
void ui_init(void);
|
||||
|
||||
@ -430,26 +430,109 @@ static void comulate_result_read(lv_timer_t * timer)
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BS界面设备类型选择响应函数
|
||||
* @brief 带呼吸模拟器定时器响应函数
|
||||
*
|
||||
* 值改变后执行以下操作
|
||||
* 1.更新Home界面显示设备类型
|
||||
* 2.更改挡位调节范围
|
||||
* 时间到达后执行
|
||||
* 定时器响应函数,用于定时获取测试结果,并更新界面。
|
||||
*
|
||||
* 3.更新测试标准值
|
||||
* 4.根据测试标准刷新判断结果
|
||||
*
|
||||
* @param[in] e not used
|
||||
* @param[in] timer not used
|
||||
*/
|
||||
void on_buttonStartTestBS_clicked(lv_event_t * e)
|
||||
static void bs_test_timer_func(lv_timer_t * timer)
|
||||
{
|
||||
ESP_LOGI("bs_test_timer_func","bs_test_timer_func");
|
||||
|
||||
/* 显示测试成功 */
|
||||
lv_label_set_text(ui_pageHome_labelBSInfo,test_info[3]);
|
||||
|
||||
vTaskDelay(4000/portTICK_PERIOD_MS);
|
||||
lv_label_set_text(ui_pageHome_labelBSInfo,test_info[4]);
|
||||
|
||||
vTaskDelay(4000/portTICK_PERIOD_MS);
|
||||
lv_label_set_text(ui_pageHome_labelBSInfo,test_info[5]);
|
||||
|
||||
vTaskDelay(4000/portTICK_PERIOD_MS);
|
||||
lv_label_set_text(ui_pageHome_labelBSInfo,test_info[1]);
|
||||
|
||||
vTaskDelay(4000/portTICK_PERIOD_MS);
|
||||
lv_label_set_text(ui_pageHome_labelBSInfo,test_info[2]);
|
||||
|
||||
ESP_LOGI("bs_test_timer_func","bs_test_timer_func end");
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BS界面 带BS测试 按键按下事件
|
||||
*
|
||||
* 按键按下后执行以下操作
|
||||
* 1.设置15BPM测试时间
|
||||
* 2.开始测试
|
||||
* 3.等待结果
|
||||
* 4.重复测试
|
||||
*
|
||||
* @param[in] e not used
|
||||
*/
|
||||
void on_buttonStartTestBS_clicked(lv_event_t * e)
|
||||
{
|
||||
/* 设置15BPM测试时间 */
|
||||
uint8_t bytes[4];
|
||||
float time = 40.0;
|
||||
memcpy(bytes, &time, 4);
|
||||
|
||||
/* 下发命令 */
|
||||
flux_frame.ADDR = FLUX_ADDR;
|
||||
flux_frame.FUNC = FLUX_FUNC_SET_SINGLE;
|
||||
flux_frame.DATA[0] = 0x00;
|
||||
flux_frame.DATA[1] = 0x02;
|
||||
flux_frame.DATA[2] = bytes[3];
|
||||
flux_frame.DATA[3] = bytes[2];
|
||||
|
||||
/* 下发15BPM测试时间指令*/
|
||||
ESP_ERROR_CHECK(ModbusRTU_Send_0306(ECHO_UART_PORT_NUM1,&flux_frame));
|
||||
|
||||
/* 屏幕中显示下发成功 */
|
||||
lv_label_set_text(ui_pageHome_labelBSInfo,test_info[0]);
|
||||
|
||||
/* 下发启动测试指令 */
|
||||
flux_frame_start.ADDR = FLUX_ADDR;
|
||||
flux_frame_start.FUNC = FLUX_FUNC_SET_SINGLE;
|
||||
flux_frame_start.DATA[0] = 0x00;
|
||||
flux_frame_start.DATA[1] = 0x01;
|
||||
flux_frame_start.DATA[2] = 0x00;
|
||||
flux_frame_start.DATA[3] = 0x01;
|
||||
ESP_ERROR_CHECK(ModbusRTU_Send_0306(ECHO_UART_PORT_NUM1,&flux_frame_start));
|
||||
|
||||
/* 屏幕中显示下发成功 */
|
||||
lv_label_set_text(ui_pageHome_labelBSInfo,test_info[1]);
|
||||
|
||||
#if 0
|
||||
/* 创建定时器 */
|
||||
lv_timer_t * bsTestTimer;
|
||||
/* 创建定时器调用函数 */
|
||||
bsTestTimer = lv_timer_create(bs_test_timer_func, 4*1000, NULL);
|
||||
|
||||
lv_timer_set_period(bsTestTimer, 4*1000);
|
||||
lv_timer_set_repeat_count(bsTestTimer, 1);
|
||||
|
||||
/* 开启定时器 */
|
||||
lv_timer_enable(bsTestTimer);
|
||||
|
||||
/* 显示正在测试中 */
|
||||
lv_label_set_text(ui_pageHome_labelBSInfo,test_info[2]);
|
||||
#else
|
||||
|
||||
/* 不创建定时器,而是创建任务函数 ,使用任务函数进行依次测试 */
|
||||
xTaskCreate(bs_test_task, "bs_test_task", 1024*4, NULL, 5, NULL);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
ESP_LOGI("on_buttonStartTestBS_clicked","on_buttonStartTestBS_clicked end");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief BS界面设备类型选择响应函数
|
||||
*
|
||||
* 值改变后执行以下操作
|
||||
* 1.更新Home界面显示设备类型
|
||||
* 2.更新测试标准值
|
||||
* 3.根据测试标准刷新判断结果
|
||||
|
||||
Loading…
Reference in New Issue
Block a user