增加了全局结构体,将UI定时器函数中全局变量替换成结构体变量
This commit is contained in:
parent
c0b6bd173d
commit
d224a48a7f
|
@ -151,7 +151,8 @@ static void test_win1_handle(lv_event_t* e)
|
||||||
//close_ui_refresh_timer();
|
//close_ui_refresh_timer();
|
||||||
close_all_win();
|
close_all_win();
|
||||||
|
|
||||||
if(pTime_refresh_timer!=NULL){
|
if(pTime_refresh_timer!=NULL)
|
||||||
|
{
|
||||||
lv_timer_del(pTime_refresh_timer);
|
lv_timer_del(pTime_refresh_timer);
|
||||||
pTime_refresh_timer = NULL;
|
pTime_refresh_timer = NULL;
|
||||||
}
|
}
|
||||||
|
@ -187,7 +188,8 @@ static void test_win2_handle(lv_event_t* e)
|
||||||
//close_ui_refresh_timer();
|
//close_ui_refresh_timer();
|
||||||
close_all_win();
|
close_all_win();
|
||||||
|
|
||||||
if(pTime_refresh_timer!=NULL){
|
if(pTime_refresh_timer!=NULL)
|
||||||
|
{
|
||||||
lv_timer_del(pTime_refresh_timer);
|
lv_timer_del(pTime_refresh_timer);
|
||||||
pTime_refresh_timer = NULL;
|
pTime_refresh_timer = NULL;
|
||||||
}
|
}
|
||||||
|
@ -201,7 +203,8 @@ static void test_win2_handle(lv_event_t* e)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/******************3.定时器******************/
|
/******************3.定时器****************/
|
||||||
|
#if 0
|
||||||
void refresh_MainUItimer_cb(lv_timer_t* pTimer)
|
void refresh_MainUItimer_cb(lv_timer_t* pTimer)
|
||||||
{
|
{
|
||||||
static uint16_t arc_num=60,speed=0,voltage=0,current=0,power=0;//转速 电压 电流 功率
|
static uint16_t arc_num=60,speed=0,voltage=0,current=0,power=0;//转速 电压 电流 功率
|
||||||
|
@ -246,51 +249,55 @@ void refresh_MainUItimer_cb(lv_timer_t* pTimer)
|
||||||
//油量
|
//油量
|
||||||
lv_bar_set_value(pOilColor, oil_quantity, LV_ANIM_OFF);
|
lv_bar_set_value(pOilColor, oil_quantity, LV_ANIM_OFF);
|
||||||
|
|
||||||
lv_label_set_text_fmt(pRunTime, "%d", time_num);
|
lv_label_set_text_fmt(pRunTime, "%d", time_num);
|
||||||
lv_label_set_text_fmt(pLeftTime, "%d", time_num);
|
lv_label_set_text_fmt(pLeftTime, "%d", time_num);
|
||||||
lv_label_set_text_fmt(pTotalTime, "%d", time_num);
|
lv_label_set_text_fmt(pTotalTime, "%d", time_num);
|
||||||
|
|
||||||
lv_label_set_text_fmt(pFreqNum, "%d", load_num);
|
lv_label_set_text_fmt(pFreqNum, "%d", load_num);
|
||||||
lv_label_set_text_fmt(pPercentNum, "%d", frequency_num);
|
lv_label_set_text_fmt(pPercentNum, "%d", frequency_num);
|
||||||
lv_label_set_text_fmt(pPowerNum, "%d", power);
|
lv_label_set_text_fmt(pPowerNum, "%d", power);
|
||||||
|
|
||||||
if((time_num/10)%2==0){
|
if((time_num/10)%2==0)
|
||||||
lv_obj_clear_flag(img_bt,LV_OBJ_FLAG_HIDDEN);
|
{
|
||||||
lv_obj_clear_flag(img_power,LV_OBJ_FLAG_HIDDEN);
|
lv_obj_clear_flag(img_bt,LV_OBJ_FLAG_HIDDEN);
|
||||||
lv_obj_clear_flag(img_error,LV_OBJ_FLAG_HIDDEN);
|
lv_obj_clear_flag(img_power,LV_OBJ_FLAG_HIDDEN);
|
||||||
}else{
|
lv_obj_clear_flag(img_error,LV_OBJ_FLAG_HIDDEN);
|
||||||
lv_obj_add_flag(img_bt,LV_OBJ_FLAG_HIDDEN);
|
}
|
||||||
lv_obj_add_flag(img_power,LV_OBJ_FLAG_HIDDEN);
|
else
|
||||||
lv_obj_add_flag(img_error,LV_OBJ_FLAG_HIDDEN);
|
{
|
||||||
}
|
lv_obj_add_flag(img_bt,LV_OBJ_FLAG_HIDDEN);
|
||||||
|
lv_obj_add_flag(img_power,LV_OBJ_FLAG_HIDDEN);
|
||||||
|
lv_obj_add_flag(img_error,LV_OBJ_FLAG_HIDDEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
speed+=100;
|
speed+=100;
|
||||||
if(speed >=10000)
|
if(speed >=10000)
|
||||||
speed =0;
|
speed =0;
|
||||||
|
|
||||||
power+=100;
|
power+=100;
|
||||||
if(power >=60000)
|
if(power >=60000)
|
||||||
power =0;
|
power =0;
|
||||||
|
|
||||||
voltage++;
|
voltage++;
|
||||||
if(voltage>=1000)
|
if(voltage>=1000)
|
||||||
voltage=0;
|
voltage=0;
|
||||||
|
|
||||||
current++;
|
current++;
|
||||||
if(current>=100)
|
if(current>=100)
|
||||||
current=0;
|
current=0;
|
||||||
|
|
||||||
time_num++;
|
time_num++;
|
||||||
if(time_num>=100)
|
if(time_num>=100)
|
||||||
time_num=0;
|
time_num=0;
|
||||||
|
|
||||||
load_num++;
|
load_num++;
|
||||||
if(time_num>=100)
|
if(time_num>=100)
|
||||||
time_num=0;
|
time_num=0;
|
||||||
|
|
||||||
frequency_num++;
|
frequency_num++;
|
||||||
if(time_num>=100)
|
if(time_num>=100)
|
||||||
time_num=0;
|
time_num=0;
|
||||||
|
|
||||||
if(oil_flag%2==0)
|
if(oil_flag%2==0)
|
||||||
oil_quantity++;
|
oil_quantity++;
|
||||||
|
@ -312,10 +319,97 @@ void refresh_MainUItimer_cb(lv_timer_t* pTimer)
|
||||||
|
|
||||||
if(oil_quantity>=95)
|
if(oil_quantity>=95)
|
||||||
oil_flag++;
|
oil_flag++;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
void refresh_MainUItimer_cb(lv_timer_t* pTimer)
|
||||||
|
{
|
||||||
|
static uint16_t arc_num=60;//转速 电压 电流 功率
|
||||||
|
static uint8_t oil_quantity=0,time_num=0;//油量 时间 负载 频率
|
||||||
|
static uint8_t arc_flag=0,oil_flag=0;
|
||||||
|
//检查定时器指针合法性
|
||||||
|
lv_obj_t *parent = pTimer->user_data;
|
||||||
|
if(!lv_obj_is_valid(parent))
|
||||||
|
{
|
||||||
|
printf("parent lv_obj_is_valid() fail.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if(NULL == parent)
|
||||||
|
{
|
||||||
|
printf("parent NULL\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取MainUI创建的各子对象的指针
|
||||||
|
//转速数据
|
||||||
|
lv_obj_t* arc1 = lv_obj_get_child(parent, 1);
|
||||||
|
lv_obj_t* arc2 = lv_obj_get_child(parent, 2);
|
||||||
|
lv_obj_t* pRotrateNum = lv_obj_get_child(parent, 4);
|
||||||
|
lv_obj_t* pVoltageNum = lv_obj_get_child(parent, 5);
|
||||||
|
lv_obj_t* pCurrentNum = lv_obj_get_child(parent, 6);
|
||||||
|
lv_obj_t* img_bt = lv_obj_get_child(parent, 7);
|
||||||
|
lv_obj_t* img_power = lv_obj_get_child(parent, 8);
|
||||||
|
lv_obj_t* img_error = lv_obj_get_child(parent, 9);
|
||||||
|
lv_obj_t* pOilColor = lv_obj_get_child(parent, 10);
|
||||||
|
lv_obj_t* pRunTime = lv_obj_get_child(parent, 11);
|
||||||
|
lv_obj_t* pLeftTime = lv_obj_get_child(parent, 12);
|
||||||
|
lv_obj_t* pTotalTime = lv_obj_get_child(parent, 13);
|
||||||
|
lv_obj_t* pFreqNum = lv_obj_get_child(parent, 14);
|
||||||
|
lv_obj_t* pPercentNum = lv_obj_get_child(parent, 15);
|
||||||
|
lv_obj_t* pPowerNum = lv_obj_get_child(parent, 17);
|
||||||
|
|
||||||
|
lv_arc_set_value(arc1, arc_num);
|
||||||
|
lv_arc_set_value(arc2, arc_num);
|
||||||
|
lv_label_set_text_fmt(pRotrateNum, "%d", g_UserData.uiData.mEngineSpeed);
|
||||||
|
lv_label_set_text_fmt(pVoltageNum, "%d", g_UserData.uiData.mVoltValue);
|
||||||
|
lv_label_set_text_fmt(pCurrentNum, "%d", g_UserData.uiData.mCurrentValue);
|
||||||
|
//油量
|
||||||
|
lv_bar_set_value(pOilColor, g_UserData.uiData.mOilValue, LV_ANIM_OFF);
|
||||||
|
|
||||||
|
lv_label_set_text_fmt(pRunTime, "%d", g_UserData.uiData.mRunTime);
|
||||||
|
lv_label_set_text_fmt(pLeftTime, "%d", g_UserData.uiData.mLeftTime);
|
||||||
|
lv_label_set_text_fmt(pTotalTime, "%d", g_UserData.uiData.mTotalTime);
|
||||||
|
|
||||||
|
lv_label_set_text_fmt(pFreqNum, "%d", g_UserData.uiData.mFreqValue);
|
||||||
|
lv_label_set_text_fmt(pPercentNum, "%d", g_UserData.uiData.mPercentValue);
|
||||||
|
lv_label_set_text_fmt(pPowerNum, "%d", g_UserData.uiData.mPowerValue);
|
||||||
|
|
||||||
|
if((time_num/10)%2==0)
|
||||||
|
{
|
||||||
|
lv_obj_clear_flag(img_bt,LV_OBJ_FLAG_HIDDEN);
|
||||||
|
lv_obj_clear_flag(img_power,LV_OBJ_FLAG_HIDDEN);
|
||||||
|
lv_obj_clear_flag(img_error,LV_OBJ_FLAG_HIDDEN);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lv_obj_add_flag(img_bt,LV_OBJ_FLAG_HIDDEN);
|
||||||
|
lv_obj_add_flag(img_power,LV_OBJ_FLAG_HIDDEN);
|
||||||
|
lv_obj_add_flag(img_error,LV_OBJ_FLAG_HIDDEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(oil_flag%2==0)
|
||||||
|
oil_quantity++;
|
||||||
|
else
|
||||||
|
oil_quantity--;
|
||||||
|
|
||||||
|
if(arc_flag%2==0)
|
||||||
|
arc_num++;
|
||||||
|
else
|
||||||
|
arc_num--;
|
||||||
|
|
||||||
|
if(arc_flag%2==0)
|
||||||
|
arc_num++;
|
||||||
|
else
|
||||||
|
arc_num--;
|
||||||
|
//模拟器跑60-76 板子跑20-37
|
||||||
|
if(arc_num>77 || arc_num<=60)
|
||||||
|
arc_flag++;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if 0
|
||||||
void refresh_TWOUItimer_cb(lv_timer_t* pTimer)
|
void refresh_TWOUItimer_cb(lv_timer_t* pTimer)
|
||||||
{
|
{
|
||||||
static uint16_t temp=0,voltage=0,count=0;//温度 电压 次数
|
static uint16_t temp=0,voltage=0,count=0;//温度 电压 次数
|
||||||
|
@ -362,17 +456,53 @@ void refresh_TWOUItimer_cb(lv_timer_t* pTimer)
|
||||||
count--;
|
count--;
|
||||||
if(count>=50 || count==0)
|
if(count>=50 || count==0)
|
||||||
count_flag++;
|
count_flag++;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
void refresh_TWOUItimer_cb(lv_timer_t* pTimer)
|
||||||
|
{
|
||||||
|
static uint16_t temp=0,voltage=0,count=0;//温度 电压 次数
|
||||||
|
static uint8_t temp_flag=0,voltage_flag=0,count_flag=0;
|
||||||
|
//检查定时器指针合法性
|
||||||
|
lv_obj_t *parent = pTimer->user_data;
|
||||||
|
if(!lv_obj_is_valid(parent))
|
||||||
|
return;
|
||||||
|
if(NULL == parent)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//获取MainUI创建的各子对象的指针
|
||||||
|
lv_obj_t* IGBTtemp_label1 = lv_obj_get_child(parent, 16);
|
||||||
|
lv_obj_t* voltage_label = lv_obj_get_child(parent, 17);
|
||||||
|
lv_obj_t* MCUtemp_label2 = lv_obj_get_child(parent, 18);
|
||||||
|
lv_obj_t* Cylindertemp_label3 = lv_obj_get_child(parent, 19);
|
||||||
|
lv_obj_t* reversal_times = lv_obj_get_child(parent, 20);
|
||||||
|
|
||||||
|
//lv_label_set_text_fmt(temp_label1, "%d°C", temp);
|
||||||
|
//lv_label_set_text_fmt(temp_label2, "%d°C", temp);
|
||||||
|
//lv_label_set_text_fmt(temp_label3, "%d°C", temp);
|
||||||
|
//lv_label_set_text_fmt(voltage_label, "%d V", voltage);
|
||||||
|
//lv_label_set_text_fmt(reversal_times, "%d", count);
|
||||||
|
|
||||||
|
lv_label_set_text_fmt(IGBTtemp_label1, "%d°C", g_UserData.inverterData.IGBTTemper);
|
||||||
|
lv_label_set_text_fmt(MCUtemp_label2, "%d°C", g_UserData.inverterData.MCUTemper);
|
||||||
|
lv_label_set_text_fmt(Cylindertemp_label3, "%d°C", g_UserData.upLoadData.mCylinderTemp);
|
||||||
|
lv_label_set_text_fmt(voltage_label, "%d V", g_UserData.inverterData.BusVolt);
|
||||||
|
lv_label_set_text_fmt(reversal_times, "%d", g_UserData.upLoadData.mRevDragStartUP);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
/******************4.界面入口******************/
|
/******************4.界面入口******************/
|
||||||
//获取主屏幕
|
//获取主屏幕
|
||||||
void Generator_src_win(lv_obj_t * scr_parent_main)
|
void Generator_src_win(lv_obj_t * scr_parent_main)
|
||||||
{
|
{
|
||||||
// lv_obj_t * scr_parent_main = get_root_win();
|
// lv_obj_t * scr_parent_main = get_root_win();
|
||||||
|
|
||||||
lv_obj_t * MainUI_win = lv_obj_create(scr_parent_main);
|
//liulin 2024.3.18
|
||||||
|
//先初始化全局结构体
|
||||||
|
SystemDataInit();
|
||||||
|
|
||||||
|
lv_obj_t* MainUI_win = lv_obj_create(scr_parent_main);
|
||||||
lv_obj_set_scrollbar_mode(MainUI_win, LV_SCROLLBAR_MODE_OFF); //关闭滑轮功能
|
lv_obj_set_scrollbar_mode(MainUI_win, LV_SCROLLBAR_MODE_OFF); //关闭滑轮功能
|
||||||
lv_obj_set_size(MainUI_win, LV_PCT(100), LV_PCT(100)); //设置主界面100%显示
|
lv_obj_set_size(MainUI_win, LV_PCT(100), LV_PCT(100)); //设置主界面100%显示
|
||||||
lv_obj_set_style_pad_all(MainUI_win, 0, 0); //
|
lv_obj_set_style_pad_all(MainUI_win, 0, 0); //
|
||||||
|
@ -382,10 +512,10 @@ void Generator_src_win(lv_obj_t * scr_parent_main)
|
||||||
lv_obj_set_style_bg_color(MainUI_win, lv_color_black(), 0); //设置背景为全黑
|
lv_obj_set_style_bg_color(MainUI_win, lv_color_black(), 0); //设置背景为全黑
|
||||||
lv_obj_clear_flag(MainUI_win, LV_OBJ_FLAG_SCROLLABLE);
|
lv_obj_clear_flag(MainUI_win, LV_OBJ_FLAG_SCROLLABLE);
|
||||||
//异形进度条弧 0
|
//异形进度条弧 0
|
||||||
lv_obj_t* arc_img = lv_img_big_create(MainUI_win,arc_src,52,60,3,0);
|
lv_obj_t* arc_img = lv_img_big_create(MainUI_win, arc_src, 52, 60, 3, 0);
|
||||||
// 1
|
// 1
|
||||||
lv_obj_t *ui_Arc1 = lv_arc_create(MainUI_win);
|
lv_obj_t *ui_Arc1 = lv_arc_create(MainUI_win);
|
||||||
lv_obj_set_size(ui_Arc1,2400,2400);
|
lv_obj_set_size(ui_Arc1, 2400, 2400);
|
||||||
lv_obj_set_pos(ui_Arc1, -816, 373);
|
lv_obj_set_pos(ui_Arc1, -816, 373);
|
||||||
lv_obj_set_align( ui_Arc1, LV_ALIGN_CENTER );
|
lv_obj_set_align( ui_Arc1, LV_ALIGN_CENTER );
|
||||||
lv_arc_set_value(ui_Arc1, 60);
|
lv_arc_set_value(ui_Arc1, 60);
|
||||||
|
@ -415,6 +545,7 @@ void Generator_src_win(lv_obj_t * scr_parent_main)
|
||||||
lv_obj_set_style_arc_rounded(ui_Arc2, false, LV_PART_INDICATOR| LV_STATE_DEFAULT);
|
lv_obj_set_style_arc_rounded(ui_Arc2, false, LV_PART_INDICATOR| LV_STATE_DEFAULT);
|
||||||
lv_obj_set_style_bg_color(ui_Arc2, lv_color_hex(0xFFFFFF), LV_PART_KNOB | LV_STATE_DEFAULT );
|
lv_obj_set_style_bg_color(ui_Arc2, lv_color_hex(0xFFFFFF), LV_PART_KNOB | LV_STATE_DEFAULT );
|
||||||
lv_obj_set_style_bg_opa(ui_Arc2, 0, LV_PART_KNOB| LV_STATE_DEFAULT);
|
lv_obj_set_style_bg_opa(ui_Arc2, 0, LV_PART_KNOB| LV_STATE_DEFAULT);
|
||||||
|
|
||||||
//3
|
//3
|
||||||
lv_obj_t* demo_bg = lv_img_big_create(MainUI_win,demo_bg_src,0,0,9,0);
|
lv_obj_t* demo_bg = lv_img_big_create(MainUI_win,demo_bg_src,0,0,9,0);
|
||||||
|
|
||||||
|
@ -807,8 +938,6 @@ void Generator_SubUI_Gtor_src_win(lv_obj_t * scr_parent_main)
|
||||||
lv_label_set_text(pLabel_hardwareData, "ICMX-2.57");
|
lv_label_set_text(pLabel_hardwareData, "ICMX-2.57");
|
||||||
lv_obj_align(pLabel_hardwareData, LV_ALIGN_TOP_LEFT, 30, 273);
|
lv_obj_align(pLabel_hardwareData, LV_ALIGN_TOP_LEFT, 30, 273);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//IGBT温度数据 16
|
//IGBT温度数据 16
|
||||||
lv_obj_t* pLabel_IGBTTempData = lv_label_create(pSubUI_Gtor_win);
|
lv_obj_t* pLabel_IGBTTempData = lv_label_create(pSubUI_Gtor_win);
|
||||||
lv_obj_set_style_text_font(pLabel_IGBTTempData, LV_FONT_MXC_MSYAHEI_CT_18PX, LV_STATE_DEFAULT);
|
lv_obj_set_style_text_font(pLabel_IGBTTempData, LV_FONT_MXC_MSYAHEI_CT_18PX, LV_STATE_DEFAULT);
|
||||||
|
@ -822,7 +951,6 @@ void Generator_SubUI_Gtor_src_win(lv_obj_t * scr_parent_main)
|
||||||
lv_label_set_text(pLabel_VoltageData, "220V");
|
lv_label_set_text(pLabel_VoltageData, "220V");
|
||||||
lv_obj_align(pLabel_VoltageData, LV_ALIGN_TOP_LEFT, 228, 188);
|
lv_obj_align(pLabel_VoltageData, LV_ALIGN_TOP_LEFT, 228, 188);
|
||||||
|
|
||||||
|
|
||||||
//内部温度数据 18
|
//内部温度数据 18
|
||||||
lv_obj_t* pLabel_TemperatureData = lv_label_create(pSubUI_Gtor_win);
|
lv_obj_t* pLabel_TemperatureData = lv_label_create(pSubUI_Gtor_win);
|
||||||
lv_obj_set_style_text_font(pLabel_TemperatureData, LV_FONT_MXC_MSYAHEI_CT_18PX, LV_STATE_DEFAULT);
|
lv_obj_set_style_text_font(pLabel_TemperatureData, LV_FONT_MXC_MSYAHEI_CT_18PX, LV_STATE_DEFAULT);
|
||||||
|
@ -891,12 +1019,10 @@ void Generator_SubUI_ERROR_src_win(lv_obj_t * scr_parent_main)
|
||||||
|
|
||||||
lv_obj_add_event_cb(pSubUI_ERROR_win, WinKey_event_ErrToMain_handle, LV_EVENT_KEY, NULL);
|
lv_obj_add_event_cb(pSubUI_ERROR_win, WinKey_event_ErrToMain_handle, LV_EVENT_KEY, NULL);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void roller1_refresh(lv_timer_t *t){
|
void roller1_refresh(lv_timer_t *t)
|
||||||
|
{
|
||||||
lv_obj_t *parent = t->user_data;
|
lv_obj_t *parent = t->user_data;
|
||||||
if(!lv_obj_is_valid(parent)){
|
if(!lv_obj_is_valid(parent)){
|
||||||
printf("parent lv_obj_is_valid fail.\n");
|
printf("parent lv_obj_is_valid fail.\n");
|
||||||
|
@ -923,7 +1049,8 @@ void roller1_refresh(lv_timer_t *t){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void roller2_refresh(lv_timer_t *t){
|
void roller2_refresh(lv_timer_t *t)
|
||||||
|
{
|
||||||
lv_obj_t *parent = t->user_data;
|
lv_obj_t *parent = t->user_data;
|
||||||
if(!lv_obj_is_valid(parent)){
|
if(!lv_obj_is_valid(parent)){
|
||||||
printf("parent lv_obj_is_valid fail.\n");
|
printf("parent lv_obj_is_valid fail.\n");
|
||||||
|
@ -1076,7 +1203,7 @@ void Generator_test1_src_win(lv_obj_t * scr_parent_main)
|
||||||
lv_obj_center(roller2);
|
lv_obj_center(roller2);
|
||||||
lv_roller_set_selected(roller2, 1, LV_ANIM_OFF);
|
lv_roller_set_selected(roller2, 1, LV_ANIM_OFF);
|
||||||
|
|
||||||
pTime_refresh_timer = lv_timer_create(roller1_refresh,2000,pSubUI_ERROR_win);
|
pTime_refresh_timer = lv_timer_create(roller1_refresh, 2000, pSubUI_ERROR_win);
|
||||||
|
|
||||||
|
|
||||||
//将GtorUI放到按键编组中,相应按钮时间,切换到Err界面
|
//将GtorUI放到按键编组中,相应按钮时间,切换到Err界面
|
||||||
|
@ -1222,9 +1349,6 @@ void Generator_test2_src_win(lv_obj_t * scr_parent_main)
|
||||||
|
|
||||||
lv_obj_add_event_cb(pSubUI_ERROR_win, test_win2_handle, LV_EVENT_KEY, NULL);
|
lv_obj_add_event_cb(pSubUI_ERROR_win, test_win2_handle, LV_EVENT_KEY, NULL);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,57 @@
|
||||||
#include "menu_list.h"
|
#include "menu_list.h"
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************发电机仪表面板****************************/
|
||||||
|
|
||||||
|
//liulin 2024.3.15
|
||||||
|
//定义全局的数据变量用于接收从驱动传来的值
|
||||||
|
//UpLoadData_t g_DataFromDrv;
|
||||||
|
//UIData_t g_DataForMainUI;
|
||||||
|
//InverterData_t g_InverterData;
|
||||||
|
|
||||||
|
UserData_t g_UserData;
|
||||||
|
|
||||||
|
//初始化接收数据变量
|
||||||
|
void SystemDataInit()
|
||||||
|
{
|
||||||
|
//1.初始化接收数据结构体
|
||||||
|
g_UserData.upLoadData.mEngineSpeed = 0;
|
||||||
|
g_UserData.upLoadData.mVoltAge = 0;
|
||||||
|
g_UserData.upLoadData.mCurrent = 0;
|
||||||
|
g_UserData.upLoadData.mPercent = 0;
|
||||||
|
g_UserData.upLoadData.mErrCode = 0;
|
||||||
|
g_UserData.upLoadData.mStatus = 0;
|
||||||
|
g_UserData.upLoadData.mInverterType = 0;
|
||||||
|
g_UserData.upLoadData.mInverterData = 0;
|
||||||
|
g_UserData.upLoadData.mCylinderTemp = 0;
|
||||||
|
g_UserData.upLoadData.mRevDragStartUP = 0;
|
||||||
|
g_UserData.upLoadData.mRevDragErrCode = 0;
|
||||||
|
|
||||||
|
//2.初始化UI需要数据
|
||||||
|
g_UserData.uiData.mPowerValue = 0.0;
|
||||||
|
g_UserData.uiData.mVoltValue = 0.0;
|
||||||
|
g_UserData.uiData.mCurrentValue = 0.0;
|
||||||
|
g_UserData.uiData.mRunTime = 0;
|
||||||
|
g_UserData.uiData.mLeftTime = 0;
|
||||||
|
g_UserData.uiData.mTotalTime = 0;
|
||||||
|
g_UserData.uiData.mOilValue = 0;
|
||||||
|
g_UserData.uiData.mBTFlag = 0;
|
||||||
|
g_UserData.uiData.mErrFlag = 0;
|
||||||
|
g_UserData.uiData.mPowerFlag = 0;
|
||||||
|
g_UserData.uiData.mFreqValue = 0;
|
||||||
|
g_UserData.uiData.mPercentValue = 0.0;
|
||||||
|
g_UserData.uiData.mEngineSpeed = 0;
|
||||||
|
g_UserData.uiData.mFuelType = 0;
|
||||||
|
|
||||||
|
//3.初始化逆变器常规数据
|
||||||
|
g_UserData.inverterData.MCUTemper = 0;
|
||||||
|
g_UserData.inverterData.IGBTTemper = 0;
|
||||||
|
g_UserData.inverterData.BusVolt = 0;
|
||||||
|
g_UserData.inverterData.ACFreq = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************机车仪表面板******************************/
|
||||||
Local_UiCommon_t local_UiCommon = {0};
|
Local_UiCommon_t local_UiCommon = {0};
|
||||||
daily_data_t custom_data;
|
daily_data_t custom_data;
|
||||||
lv_coord_t child_id = 0;
|
lv_coord_t child_id = 0;
|
||||||
|
@ -166,12 +217,9 @@ void system_date_init(void)
|
||||||
custom_data.warning.fan = 0;
|
custom_data.warning.fan = 0;
|
||||||
custom_data.warning.null = 0;
|
custom_data.warning.null = 0;
|
||||||
|
|
||||||
|
|
||||||
custom_data.now_defect_code = 0x2255;
|
custom_data.now_defect_code = 0x2255;
|
||||||
custom_data.his_defect_code = 0x400;
|
custom_data.his_defect_code = 0x400;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
custom_data.ttrb = 0;
|
custom_data.ttrb = 0;
|
||||||
custom_data.ttrb_time = 10;
|
custom_data.ttrb_time = 10;
|
||||||
custom_data.odo_reset = 10;
|
custom_data.odo_reset = 10;
|
||||||
|
@ -180,7 +228,6 @@ void system_date_init(void)
|
||||||
custom_data.plan = 0;
|
custom_data.plan = 0;
|
||||||
custom_data.pace = 0;
|
custom_data.pace = 0;
|
||||||
custom_data.upgrade = 0;
|
custom_data.upgrade = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateCurTime()
|
void updateCurTime()
|
||||||
|
@ -241,7 +288,6 @@ void InitSysDateTime(void)
|
||||||
GetSysDateTime(DEF_DATE_YEAR, DEF_DATE_MONTH, DEF_DATE_DAY);
|
GetSysDateTime(DEF_DATE_YEAR, DEF_DATE_MONTH, DEF_DATE_DAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GetSysDateTime(uint16_t year, uint8_t month, uint8_t day)
|
void GetSysDateTime(uint16_t year, uint8_t month, uint8_t day)
|
||||||
{
|
{
|
||||||
custom_data.time.ucYear = year;
|
custom_data.time.ucYear = year;
|
||||||
|
|
|
@ -96,7 +96,6 @@ void init_root_win(void)//Ö÷ÆÁÄ»³õʼ»¯
|
||||||
lv_obj_set_style_radius(g_parent_root_win, 0, 0);
|
lv_obj_set_style_radius(g_parent_root_win, 0, 0);
|
||||||
lv_obj_set_style_border_width(g_parent_root_win, 0, LV_PART_MAIN);
|
lv_obj_set_style_border_width(g_parent_root_win, 0, LV_PART_MAIN);
|
||||||
lv_obj_set_style_border_color(g_parent_root_win, lv_color_black(), 0);
|
lv_obj_set_style_border_color(g_parent_root_win, lv_color_black(), 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,7 +6,7 @@ typedef void (*btn_event_func)(lv_obj_t *obj);
|
||||||
#define LV_KEY_Q 113
|
#define LV_KEY_Q 113
|
||||||
#define LV_KEY_W 10
|
#define LV_KEY_W 10
|
||||||
|
|
||||||
|
/*****************************发电机仪表面板******************************/
|
||||||
//liulin 2024.3.5 用于发电机项目切换各个界面
|
//liulin 2024.3.5 用于发电机项目切换各个界面
|
||||||
typedef enum _ENUM_CONTROL_WIN_ID_GTOR
|
typedef enum _ENUM_CONTROL_WIN_ID_GTOR
|
||||||
{
|
{
|
||||||
|
@ -15,7 +15,156 @@ typedef enum _ENUM_CONTROL_WIN_ID_GTOR
|
||||||
GTOR_SUBUI_ERROR_WIN_ID
|
GTOR_SUBUI_ERROR_WIN_ID
|
||||||
}ENUM_CONTROL_WIN_ID_GTOR;
|
}ENUM_CONTROL_WIN_ID_GTOR;
|
||||||
|
|
||||||
|
#pragma pack(1)
|
||||||
|
//上传实时数据
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint16_t mCurrent; //电流大小(放大了64倍)
|
||||||
|
uint16_t mVoltage; //电压大小 (放大了64倍)
|
||||||
|
int16_t mPercent; //负载百分比(低15位有效)
|
||||||
|
uint16_t mEngine_speed; //发动机转速
|
||||||
|
uint16_t mInverter_Errcode; //逆变器错误代码
|
||||||
|
uint8_t mInverter_Status; //逆变器状态
|
||||||
|
uint16_t mInverter_type; //逆变器类型
|
||||||
|
uint16_t mInverter_Volt; //逆变器电压
|
||||||
|
uint16_t mInverter_Freq; //频率信息 1=50/60Hz 2=50Hz 3=60Hz
|
||||||
|
uint16_t mInverter_Custom; //客户信息
|
||||||
|
uint16_t mInverter_Software; //软件版本
|
||||||
|
uint16_t mInverter_Hardware; //硬件版本
|
||||||
|
uint16_t mRelease_Year; //程序发行时间 年
|
||||||
|
uint16_t mRelease_Month; //程序发行时间 月(低8位有效)
|
||||||
|
uint16_t mRelease_Date; //程序发行时间 日(低8位有效)
|
||||||
|
int16_t MCUTemper; //单片机内部温度
|
||||||
|
int16_t IGBTTemper; //IGBT温度
|
||||||
|
uint16_t DCBusVolt; //直流母线电压
|
||||||
|
uint16_t ActualFreq; //当前交流输出实际频率
|
||||||
|
uint16_t ReverseDragErrCode; //反拖故障代码
|
||||||
|
}DataParse, *pDataParse;
|
||||||
|
|
||||||
|
//UI显示需要的数据
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
float mPowerValue; //功率值
|
||||||
|
float mVoltValue; //电压值
|
||||||
|
float mCurrentValue; //电流值
|
||||||
|
int mRunTime; //运行时间
|
||||||
|
int mLeftTime; //剩余时间
|
||||||
|
int mTotalTime; //累计时间
|
||||||
|
int mOilValue; //油量值
|
||||||
|
uint8_t mBTFlag; //蓝牙标记
|
||||||
|
uint8_t mErrFlag; //故障标记
|
||||||
|
uint8_t mPowerFlag; //充电状态标记
|
||||||
|
uint8_t mFreqValue; //频率显示
|
||||||
|
float mPercentValue; //负载百分比
|
||||||
|
uint16_t mEngineSpeed; //转速
|
||||||
|
uint8_t mFuelType; //燃油类型
|
||||||
|
}UIData_t, *pUIData;
|
||||||
|
|
||||||
|
//控制器上传数据帧结构
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint16_t mEngineSpeed; //发动机转速
|
||||||
|
uint16_t mVoltAge; //电压
|
||||||
|
uint16_t mCurrent; //电流
|
||||||
|
uint16_t mPercent; //负载百分比
|
||||||
|
uint16_t mErrCode; //故障代码
|
||||||
|
uint16_t mStatus; //状态指示
|
||||||
|
uint16_t mInverterType; //逆变器类型
|
||||||
|
uint16_t mInverterData; //逆变器常规数据
|
||||||
|
uint16_t mCylinderTemp; //缸温
|
||||||
|
uint16_t mRevDragStartUP; //反拖启动次数
|
||||||
|
uint16_t mRevDragErrCode; //反拖故障代码
|
||||||
|
}UpLoadData_t, *pUpLoadData;
|
||||||
|
|
||||||
|
//仪表下发命令或实时数据应答帧结构
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint8_t mDownLoadCommand; //下发命令码/固定标记
|
||||||
|
uint8_t mInverterStatus; //逆变器命令状态
|
||||||
|
uint8_t mStartStopCommand; //启停命令
|
||||||
|
}DownLoadData_t, *pDownLoadData;
|
||||||
|
|
||||||
|
//逆变器故障代码
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint8_t mDCBusHigh;
|
||||||
|
uint8_t mDCBusLow;
|
||||||
|
uint8_t mOutVoltHigh;
|
||||||
|
uint8_t mOutVoltLow;
|
||||||
|
uint8_t mIGBTTempHigh;
|
||||||
|
uint8_t mOutOverCurrent;
|
||||||
|
uint8_t mEngineSpeedLoss;
|
||||||
|
uint8_t mMCUTempHigh;
|
||||||
|
uint8_t mHPeakcurrentProtect;
|
||||||
|
uint8_t mReferVoltErr;
|
||||||
|
}InverterErr, *pInverterErr;
|
||||||
|
|
||||||
|
|
||||||
|
//逆变器状态指示
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint8_t mFreqSwitchingStatus;
|
||||||
|
uint8_t mResetSwitchStatus;
|
||||||
|
uint8_t mHAndLSpeedSwitchStatus;
|
||||||
|
uint8_t mFaultLightStatus;
|
||||||
|
uint8_t mWorkLightStatus;
|
||||||
|
uint8_t mBattleChargeState;
|
||||||
|
uint8_t mFuelType;
|
||||||
|
}InverterStatus, *pInverterStatus;
|
||||||
|
|
||||||
|
//逆变器类型
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
float mPower;
|
||||||
|
float mVolt;
|
||||||
|
uint8_t mFreq; //1=50/60Hz 2=50Hz 3=60Hz
|
||||||
|
char chCustom[10]; //客户信息
|
||||||
|
char chSoft[10]; //软件版本号
|
||||||
|
char chHard[10]; //硬件版本号
|
||||||
|
//stTime_type ReleaseTime; //程序发行时间
|
||||||
|
}InverterType, *pInvertertype;
|
||||||
|
|
||||||
|
//逆变器常规数据
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
int16_t MCUTemper; //单片机内部温度
|
||||||
|
int16_t IGBTTemper; //IGBT温度
|
||||||
|
uint16_t BusVolt; //直流母线电压
|
||||||
|
uint16_t ACFreq; //当前交流输出频率
|
||||||
|
}InverterData_t, *pInverterData;
|
||||||
|
|
||||||
|
//反拖故障代码
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint8_t LowVoltProtect; //低压保护
|
||||||
|
uint8_t SoftCurrentProtect; //软件电流保护
|
||||||
|
uint8_t HardCurrentProtect; //硬件电流保护
|
||||||
|
uint8_t LockedRotorProtect; //堵转保护
|
||||||
|
uint8_t PeakOvercurrentProtect; //峰值过流保护
|
||||||
|
uint8_t TemperFault; //温度故障
|
||||||
|
uint8_t IgnitionFailure; //点火失败
|
||||||
|
uint8_t OverVoltProtect; //过压保护
|
||||||
|
uint8_t OilMalfunction; //机油故障
|
||||||
|
}ReverseDragErr, *pReverseDragErr;
|
||||||
|
|
||||||
|
|
||||||
|
//用户数据结构体,最外层结构体
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
UIData_t uiData; //MainUI界面需要的数据
|
||||||
|
UpLoadData_t upLoadData; //控制器上传数据
|
||||||
|
InverterData_t inverterData; //逆变器常规数据
|
||||||
|
}UserData_t, *pUserData;
|
||||||
|
|
||||||
|
#pragma pack()
|
||||||
|
|
||||||
|
extern UserData_t g_UserData;
|
||||||
|
|
||||||
|
//extern UpLoadData_t g_DataFromDrv;
|
||||||
|
//extern UIData_t g_DataForMainUI;
|
||||||
|
//extern InverterData_t g_InverterData;
|
||||||
|
|
||||||
|
/*****************************机车仪表面板******************************/
|
||||||
|
|
||||||
typedef enum _ENUM_CONTROL_WIN_ID
|
typedef enum _ENUM_CONTROL_WIN_ID
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#define img_head_address 0x0
|
#define img_head_address 0x0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define IMG_ARC_IMG_1 (const lv_img_dsc_t *)(img_head_address + 0x0)
|
#define IMG_ARC_IMG_1 (const lv_img_dsc_t *)(img_head_address + 0x0)
|
||||||
#define IMG_ARC_IMG_2 (const lv_img_dsc_t *)(img_head_address + 0xd168)
|
#define IMG_ARC_IMG_2 (const lv_img_dsc_t *)(img_head_address + 0xd168)
|
||||||
#define IMG_ARC_IMG_3 (const lv_img_dsc_t *)(img_head_address + 0x1a2d0)
|
#define IMG_ARC_IMG_3 (const lv_img_dsc_t *)(img_head_address + 0x1a2d0)
|
||||||
|
|
Loading…
Reference in New Issue