A27两个不同版本的UI合并到同一个工程

This commit is contained in:
2025-07-10 15:16:58 +08:00
parent caf35e2429
commit f0d004e8c5
542 changed files with 53381 additions and 32365 deletions

View File

@ -298,6 +298,10 @@
#define UI_CAN_TORAL6_GRIDS_TEMP_6 116
/**转速限制(客户需求)
* 转速保持在15 不需要上下抖动
*
*/
#define SPEED_STABILTY_LIMIT_LOWER 13
#define SPEED_STABILTY_LIMIT 15
#define SPEED_STABILTY_LIMIT_UPPER 18
@ -305,6 +309,13 @@
//一些通用运算
#define JUDGE_BIT(data, bit) ((data) & (1 << (bit)))

View File

@ -62,6 +62,14 @@ void Return_demo_win(void){//按键返回函数如果停止按键超过15s也
Set_sys_return_demo(0);
}
void dh_refresh(void){
widget_t* win = window_manager();
widget_t* child = window_manager_get_top_main_window(win);
if(child != NULL && strcmp(child->name,"new")!=0 ) {
navigator_replace("new");
}
}
void Power_On_Self_Test(void){//自检函数
widget_t* win = window_manager();
widget_t* progress_circle = widget_lookup(win, "progress_circle", TRUE);
@ -331,6 +339,16 @@ void mil_control_event_handing(int *buf){
}
void kp_control_event_handing(int *buf){
uint8_t data = 0;
*(buf++);
*(buf++);
data = *(buf++);
if(JUDGE_BIN_1(data))
Set_sys_quickly_arrange_state(1);
else
Set_sys_quickly_arrange_state(0);
}
uint8_t mac_address_normal(char mac[],int size){

View File

@ -17,9 +17,6 @@
#define APP_START_PAGE "ui_demo1"
#endif /*APP_START_PAGE*/
uint32_t flash_trip_mile = 0;
uint32_t flash_total_mile = 0;
static uint16_t animo_time = 0;
#ifndef AMT630HV100
static int time_second;
@ -101,9 +98,20 @@ void A27_BT_init(void){
#else
sleep_ms(10);
#endif
printf("BW121 HFP >> Open .\r\n");
console_send_atcmd("AT+HFPCFG=5\r\n", strlen("AT+HFPCFG=5\r\n"));//开三方通话使能
#ifdef AMT630HV100
vTaskDelay(10);
#else
sleep_ms(10);
#endif
printf("BW121 A2D >> Close .\r\n");//若仪表不需要声音,这一块则直接屏蔽声音,保证手机和仪表接入时声音不会走到仪表通道
console_send_atcmd("AT+PROFILE=50314\r\n", strlen("AT+PROFILE=50314\r\n"));//查询profile使能
#else
if(Get_sys_bt_on_off()==0){
DEBUG_PRINT("BT_SWITCH close .\r\n");
@ -169,7 +177,6 @@ extern uint32_t tire_rear_time;
extern uint8_t tire_pressure_flag;//再main函数中
extern uint8_t bt2_state_now_flag;
extern uint8_t bt_reset_flag;
extern uint8_t wifi_time_flag;
uint8_t bw_121_time = 0;
// extern uint8_t bt_connect_flag;
@ -233,21 +240,17 @@ void UI_init(void){
#endif
// console_send_atcmd("AT+ADDR\r\n", strlen("AT+ADDR\r\n"));//开蓝牙
// #ifdef AMT630HV100
// vTaskDelay(10);
// #else
// sleep_ms(10);
// #endif
// #if (MOTO_WARE_HOSE == MOTO_ICMX_GB518_A270T)
// console_send_atcmd("AT+NAME=A27_MOTO_Phone,1\r\n", strlen("AT+NAME=A27_MOTO_Phone,1\r\n"));//修改蓝牙名
// #else
// console_send_atcmd("AT+NAME=A59_MOTO_Phone,1\r\n", strlen("AT+NAME=A59_MOTO_Phone,1\r\n"));//修改蓝牙名
// #endif
// #ifdef AMT630HV100
// vTaskDelay(10);
// #else
// sleep_ms(10);
// #endif
#ifdef AMT630HV100
vTaskDelay(10);
#else
sleep_ms(10);
#endif
console_send_atcmd("AT+NAME=A27_MOTO_Phone,1\r\n", strlen("AT+NAME=A27_MOTO_Phone,1\r\n"));//修改蓝牙名
#ifdef AMT630HV100
vTaskDelay(10);
#else
sleep_ms(10);
#endif
console_send_atcmd("AT+NAME\r\n", strlen("AT+NAME\r\n"));//查询蓝牙名
A27_BT_init();
@ -282,166 +285,6 @@ void UI_init(void){
}
static ret_t on_timer(const idle_info_t* idle){
static uint16_t time_num =0;
uint32_t light_num=0;
uint16_t light=0;
uint8_t power_state =0;
uint8_t light_count = 0;
static uint8_t light_time = 0;
power_state = Get_sys_power_on_self_test();
if(light_time>=4){
pwm_backlight_changes_slowly();//光感控制亮度
light_time = 0;
}
light_time++;
if(power_state == 100){
// #ifndef AMT630HV100
// Simulating_data_changes();
// #endif
widget_t* win = window_manager();
widget_t* child = window_manager_get_top_main_window(win);
if(child != NULL && strcmp(child->name,"set_list")==0){
list_win_init(child);
// }else if(child != NULL && strcmp(child->name,"ui_demo1")==0){
// new_refreshes(child);
// //灯光刷新
// light_refresh(child);
// //通话界面刷新
// call_refresh(child);
}
//光感数据计算
if(light_storage != data_storage){
light_storage = data_storage;
for(uint8_t i=0;i<SAVE_DATA_SIZE;i++){
if(light_buffer[i] != 0){
light += light_buffer[i];
light_count++;
}
}
light_num = (int)(light/light_count);
Set_sys_light_perception_value(light_num);
if(Get_sys_light_perception_value()>=50){//光感大于70 白天 白色背景
Set_sys_display_theme(1);
}else if(Get_sys_light_perception_value()<=20){
Set_sys_display_theme(0);
}
}
//回到主菜单
if(Get_sys_return_demo() ==2){
time_num = 1;
Set_sys_return_demo(1);
}else if(Get_sys_return_demo() ==1){
if(time_num %600 ==0 || Get_sys_velocity() != 0 || Get_sys_call_state()){//10s左右 || 有速度的情况下直接退回主界面 || 有通话
time_num = 0;
printf("time ok return demo . %d \r\n",Get_sys_return_demo());
Return_demo_win();
}
time_num++;
}else if(Get_sys_return_demo() ==3){
Return_demo_win();//如果目标是非主demo界面or投屏界面 则返回主demo界面
}
// if(uart3_flag == 1){
// //uart_init();
// //将通讯串口配置为gpio端口
// UART3_Modification_Type();
// printf("uart3>>close.\r\n");
// uart3_flag = 2;
// }
if(Get_sys_upgrade_Flag()==2){//退出升级标志
DEBUG_PRINT("exit >> prompt .\r\n");
navigator_replace("ui_demo1");
Set_sys_upgrade_Flag(0);
Set_sys_plan(0);//1.修复升级一定进度失败后 再次进入升级 进度条未清零问题
Set_sys_pace(0);
}
#ifdef AMT630HV100
//1s一刷
if(xTaskGetTickCount() - idletick > configTICK_RATE_HZ){
if(ttrb_mesg()){ //查询时间 首次开机需要去询问时间
Send_software_version();
#if UI_VIEW_TIRE_PRESSURE
}else if(!tire_pressure_mesg()){ //发送胎压信息
Send_tire_pressure_information();
#endif
}else if(!ttrb_time_mesg()){ //发送时间 当用户通过UI设置时间后需要检测是否发送时间
Send_bt_time();
#ifndef DATA_CAN
}else if(!odo_reset_mesg()){ //发送清零命令 当用户长按时清零
Send_trip_reset();
#endif
}else if(fault_code_mesg()){ //发送故障码 为1是需要发送故障码
Send_defect_code();
}
if(bw_121_time)//蓝牙按钮时间控制
bw_121_time--;
// if(bt_connect_flag){
// select_bt_conntect();
// bt_connect_flag = 0;
// }
if(wifi_time_flag)
wifi_time_flag--;
// //串口检测蓝牙通讯
// if(uart_state && (Get_sys_bt_upgrade()==0 && Get_sys_upgrade_Flag()==0)){
// uart_state--;
// if(!uart_state){
// printf("uart3 >gpio.\r\n");
// UART3_Modification_Type();//将通讯串口配置为gpio端口
// }
// }else{
// uart_state = 5;
// printf("uart3 > regression.\r\n");
// UART3_Type_regression();//串口恢复正常
// }
if(bt_reset_flag){
if(bt_reset_flag==2){
Send_software_version();
#if UI_VIEW_TIRE_PRESSURE
}else{
Send_tire_pressure_init_information();
#endif
}
bt_reset_flag--;
}
//串口检测蓝牙心跳 + 接收发送
if(bt_communication_heartbeat && (Get_sys_bt_upgrade()==0 && Get_sys_upgrade_Flag()==0)){
bt_communication_heartbeat--;
if(!bt_communication_heartbeat){//需要去重新初始化一次串口
uart_flag = 1;
bt_communication_heartbeat = 10;
}
}
idletick = xTaskGetTickCount();
}
if(xTaskGetTickCount() - refresh500ms_idletick > 500){
refresh500ms_flag = refresh500ms_flag?0:1;
refresh500ms_idletick = xTaskGetTickCount();
}
#else
refresh500ms_flag = 1;
printf("refresh500ms_flag = %d.\r\n",refresh500ms_flag);
#endif
}
return RET_OK;
}
static void ui_system_timer(void){
static uint16_t time_num =0;
uint32_t light_num=0;
@ -449,6 +292,7 @@ static void ui_system_timer(void){
uint8_t power_state =0;
uint8_t light_count = 0;
static uint8_t light_time = 0;
static uint8_t dh=0;
power_state = Get_sys_power_on_self_test();
if(light_time>=4){
@ -590,6 +434,14 @@ static void ui_system_timer(void){
bt_communication_heartbeat = 10;
}
}
//检测是否投屏
if(Get_sys_wifi_state() && dh==0){
dh_refresh();
dh = 1;
}else if(Get_sys_wifi_state()==0 && dh){
dh = 0;
}
idletick = xTaskGetTickCount();
}
@ -709,142 +561,6 @@ static ret_t ui_timer_refresh(const timer_info_t* timer){ //demo Progress bar Co
extern uint8_t power_on_flag;
void* test_timer_queue(void *args){
// int test_time =0 ;
#ifndef AMT630HV100
// // Set_sys_power_on_self_test(DEMO_UI_SELF_START);
// char produce[5] = {0};
// produce[0] = 65;
// produce[1] = 53;
// produce[2] = 56;
// produce[3] = 48;
// produce[4] = 65;
// Set_device_produce_num(produce);
// char dtc[5] = {0};
// dtc[4] = 0x31;
// dtc[3] = 0x30;
// dtc[2] = 0x32;
// dtc[1] = 0x31;
// dtc[0] = 0x43;
// // Set_can_abs_dtc(dtc);
// dtc[4] = 0x33;
// dtc[3] = 0x32;
// // Set_can_abs_his_dtc(dtc);
// strcpy(UI_uuid,"CARBITDC0D3050230C");
// strcpy(strQrText,"http://www.carbit.com.cn/down6/642/643/_ylqx?modelid=49801&sn=ZAT4&action=9&ssid=AP630_CARLINK_7A8D&pwd=88888888&auth=WPA-PSK&name=DIRECT-AP630_CARLINK_p2p_7A8D");
// extern char bt121_name[50];
// strcpy(bt121_name,"AWTK_TEST");
#endif
//收数据
for(;;){
if(animo_time < 510){
date_time_t dt;
date_time_init(&dt);
animo_time++;
if(Get_sys_power_on_self_test()<DEMO_UI_SELF_START){
#ifndef AMT630HV100
Set_sys_power_on_self_test(DEMO_UI_SELF_START);
#endif
#ifdef ANIMO_CLOSE
if(animo_time>110){
BrightnessPowerOnSetting();
pwm_enable(2);
pwm_enable(3);
extern void anim_close_lcd_open(void);
anim_close_lcd_open();
}
if(animo_time>=130)
Set_sys_power_on_self_test(DEMO_UI_SELF_START);
#endif
}else if(Get_sys_power_on_self_test()==DEMO_UI_SELF_START){
#ifdef AMT630HV100
idletick = xTaskGetTickCount();
#else
time_second = dt.second;
printf("time_second = %d .",time_second);
printf("start demo animo .\n");
#endif
if(!power_on_flag)
power_on_flag = 1;
Send_tire_pressure_init_information();//胎压
Set_sys_power_on_self_test(DEMO_UI_SELF_CHECKING);//设置为自检中
// console_send_atcmd("AT+NAME=A27_MOTO_Phone,1\r\n", strlen("AT+NAME=A27_MOTO_Phone,1\r\n"));//修改蓝牙名
#ifdef AMT630HV100
vTaskDelay(1000);
#else
sleep_ms(100);
#endif
Power_On_Self_Test();
// console_send_atcmd("AT+BTEN=0\r\n", strlen("AT+BTEN=0\r\n"));//关蓝牙
#ifdef AMT630HV100
}else if(Get_sys_power_on_self_test()==DEMO_UI_SELF_CHECKING){
if(xTaskGetTickCount() - idletick > configTICK_RATE_HZ * 3){
// #ifdef AMT630HV100
// vTaskDelay(100);
// #else
// sleep_ms(100);
// #endif
UI_init();
}
}
#else
}else if(time_second<57){
if((dt.second-time_second)>2){
printf("animo_time <57 ,second = %d ,end demo animo \n",dt.second);
UI_init();
}
}else if(time_second==57){
if(dt.second==0){
printf("animo_time ==57 ,second = %d ,end demo animo \n",dt.second);
UI_init();
}
}else if(time_second==58){
if(dt.second==1){
printf("animo_time ==58 ,second = %d ,end demo animo \n",dt.second);
UI_init();
}
}else{
if(dt.second==2){
printf("animo_time ==59 ,second = %d ,end demo animo \n",dt.second);
UI_init();
}
}
#endif
}
if(Get_sys_power_on_self_test() != DEMO_UI_SELF_UPGRADE_BEGINS){
idle_queue(on_timer,args);
}else if(Get_sys_upgrade_Flag()==1){
DEBUG_PRINT("start >> prompt .\r\n");
navigator_replace("prompt");
Set_sys_upgrade_Flag(3);
DEBUG_PRINT("screen >> prompt ok .\r\n");
}
#ifdef AMT630HV100
vTaskDelay(20);
#else
sleep_ms(20);
#endif
//立即保存flash
if(save_flag){
SaveDataToFlash(custom_data.user_data);
save_flag = 0;
}
//printf(".\r\n");
}
return NULL;
}
/**
* 初始化程序
*/
@ -881,14 +597,6 @@ ret_t application_init(void) {
,custom_data.user_data.r_mac_address[6],custom_data.user_data.r_mac_address[7],custom_data.user_data.r_mac_address[8]);
printf("******************************************\n");
// Set_sys_light_perception_value(30);
Set_sys_light(30);
// //UI刷新线程
// tk_thread_t *thread = NULL;
// thread =tk_thread_create(test_timer_queue,NULL);
// tk_thread_start(thread);
widget_add_timer(window_manager(), ui_timer_refresh, 20);//进度条颜色刷新
char country[3];