A27两个不同版本的UI合并到同一个工程
This commit is contained in:
@ -7,10 +7,18 @@
|
||||
|
||||
#include "gpio_protocol.h"
|
||||
|
||||
#include "moto_config.h"
|
||||
|
||||
#if DEVICE_MXC_A58
|
||||
// #define CAN_USE_TX_DEMO
|
||||
#elif DEVICE_MXC_A59
|
||||
// #define CAN_USE_TX_DEMO
|
||||
#else
|
||||
|
||||
#ifdef UI_VIEW_QUICKLY_ARRANGE
|
||||
#define CAN_USE_TX_DEMO
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#define CAN_RX_BUF_NUM 32
|
||||
@ -692,37 +700,52 @@ int iCanGetTransmitErrorCount(CanPort_t *cap)
|
||||
}
|
||||
|
||||
#ifdef CAN_USE_TX_DEMO
|
||||
int cantx_count = 0;
|
||||
static void can_txdemo_thread(void *param)
|
||||
{
|
||||
CanPort_t *cap = param;
|
||||
|
||||
// CanMsg txmsg = {0};
|
||||
// txmsg.IDE = CAN_Id_Standard;
|
||||
// txmsg.DLC = 4;
|
||||
// txmsg.Data[0] = 0x11;
|
||||
// txmsg.Data[1] = 0x22;
|
||||
// txmsg.Data[2] = 0x33;
|
||||
// txmsg.Data[3] = 0x44;
|
||||
uint8_t checksum = 0;
|
||||
CanMsg txmsg = {0};
|
||||
txmsg.StdId = 0x200;
|
||||
txmsg.StdId = 0x213;
|
||||
//txmsg.ExtId = 0x400;
|
||||
txmsg.IDE = CAN_Id_Standard;
|
||||
txmsg.DLC = 8;
|
||||
txmsg.Data[0] = Get_sys_tcs_on_off()?0x8:0x00;
|
||||
|
||||
txmsg.Data[0] = Get_sys_quickly_arrange()?0x0:0x10;
|
||||
if(Get_sys_grade() >= 7)
|
||||
txmsg.Data[1] = 0xFF;//档位
|
||||
else
|
||||
txmsg.Data[1] = Get_sys_grade();//档位
|
||||
txmsg.Data[2] = Get_sys_velocity();//速度
|
||||
txmsg.Data[3] = 0x00;
|
||||
txmsg.Data[4] = 0x00;
|
||||
txmsg.Data[5] = 0x00;
|
||||
txmsg.Data[6] = 0x00;
|
||||
txmsg.Data[7] = 0x00;
|
||||
for (;;) {
|
||||
txmsg.Data[0] = Get_sys_tcs_on_off()?0x8:0x00;
|
||||
iCanWrite(cap, &txmsg, 1, 0);
|
||||
vTaskDelay(pdMS_TO_TICKS(100));
|
||||
if(Get_sys_power_on_self_test() == 100){
|
||||
txmsg.Data[0] = Get_sys_quickly_arrange()?0x0:0x10;
|
||||
if(Get_sys_grade() >= 7)
|
||||
txmsg.Data[1] = 0xFF;//档位
|
||||
else
|
||||
txmsg.Data[1] = Get_sys_grade();
|
||||
txmsg.Data[2] = Get_sys_velocity();
|
||||
iCanWrite(cap, &txmsg, 1, 0);
|
||||
}
|
||||
vTaskDelay(pdMS_TO_TICKS(10));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
uint8_t can101_flag = 0;
|
||||
uint8_t can_flag = 0;
|
||||
extern uint8_t speed_flag;
|
||||
extern uint8_t abs_speed_flag;
|
||||
|
||||
uint8_t mile_flag = 0;
|
||||
|
||||
static void can_rxdemo_thread(void *param)
|
||||
{
|
||||
CanPort_t *cap = param;
|
||||
int tlv_data_value[8] = {0};
|
||||
uint8_t tlv_data_value[8] = {0};
|
||||
|
||||
for (;;) {
|
||||
CanMsg rxmsg[8] = {0};
|
||||
@ -733,72 +756,26 @@ static void can_rxdemo_thread(void *param)
|
||||
for (i = 0; i < revlen; i++) {
|
||||
for (j = 0; j < rxmsg[i].DLC; j++){
|
||||
tlv_data_value[j] = rxmsg[i].Data[j];
|
||||
}
|
||||
// printf("can>> Id = %03x",rxmsg[i].StdId);
|
||||
#if DEVICE_MXC_A58
|
||||
switch(rxmsg[i].StdId){
|
||||
case 0x37B:
|
||||
if(can_flag != 10)
|
||||
can_flag = 10;
|
||||
tcsworking_event_handing(tlv_data_value);//TCS
|
||||
break;
|
||||
case 0x12B:
|
||||
if(can_flag != 10)
|
||||
can_flag = 10;
|
||||
tcsswitch_event_handing(tlv_data_value);//tcs开关
|
||||
break;
|
||||
case 0x401:
|
||||
break;
|
||||
case 0x402://ECU故障码
|
||||
break;
|
||||
case 0xA5://ABS故障码
|
||||
if(can_flag != 10)
|
||||
can_flag = 10;
|
||||
abs_dtc_event_handing(tlv_data_value);
|
||||
break;
|
||||
case 0xA3://ABS数据
|
||||
break;
|
||||
case 0x101://发送机数据
|
||||
if(can101_flag != 10)
|
||||
can101_flag = 10;
|
||||
if(can_flag != 10)
|
||||
can_flag = 10;
|
||||
speed_event_handing(tlv_data_value);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#elif DEVICE_MXC_A59
|
||||
|
||||
switch(rxmsg[i].StdId){
|
||||
case 0x402://ECU故障码
|
||||
if(can_flag != 10)
|
||||
can_flag = 10;
|
||||
A59_dtc_event_handing(tlv_data_value);
|
||||
break;
|
||||
// case 0x101://发送机数据
|
||||
// if(can101_flag != 10)
|
||||
// can101_flag = 10;
|
||||
// if(can_flag != 10)
|
||||
// can_flag = 10;
|
||||
// speed_event_handing(tlv_data_value);
|
||||
// break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
#else
|
||||
}
|
||||
switch(rxmsg[i].StdId){
|
||||
#ifdef SPEED_DATA_CAN
|
||||
// 快排仪表
|
||||
case 0x141: //谟绅ABS
|
||||
if(abs_speed_flag != 10)
|
||||
abs_speed_flag = 10;
|
||||
ASB_141_speed_event_handing(tlv_data_value);
|
||||
break;
|
||||
case 0x101:
|
||||
if(speed_flag != 5)
|
||||
speed_flag = 5;
|
||||
if(speed_flag != 10)
|
||||
speed_flag = 10;
|
||||
speed_event_handing(tlv_data_value);
|
||||
break;
|
||||
case 0x400:
|
||||
tcs_control_event_handing(tlv_data_value);
|
||||
kp_control_event_handing(tlv_data_value);//快排信号指示灯
|
||||
break;
|
||||
case 0x401:
|
||||
if(mile_flag != 10)
|
||||
mile_flag = 10;
|
||||
mil_control_event_handing(tlv_data_value);//引擎开关
|
||||
break;
|
||||
#endif
|
||||
@ -807,7 +784,6 @@ static void can_rxdemo_thread(void *param)
|
||||
break;
|
||||
default:break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -828,14 +804,16 @@ int can_demo(void)
|
||||
CAN_FilterInitTypeDef canfilter = {0};
|
||||
/* 只接收ID的第0位为1的帧 */
|
||||
canfilter.MODE = 1; /* 单滤波器模式 */
|
||||
canfilter.ID = 0x37B;
|
||||
canfilter.IDMASK = 0x7ff;
|
||||
// canfilter.ID = 0x37B;
|
||||
// canfilter.IDMASK = 0x7ff;
|
||||
canfilter.ID = 0x402;
|
||||
canfilter.IDMASK = 0X543;
|
||||
vCanSetFilter(cap, &canfilter);
|
||||
#endif
|
||||
|
||||
/* Create a task to test read can msg */
|
||||
if (xTaskCreate(can_rxdemo_thread, "canrx", configMINIMAL_STACK_SIZE, cap,
|
||||
configMAX_PRIORITIES / 3, NULL) != pdPASS) {
|
||||
configMAX_PRIORITIES / 2, NULL) != pdPASS) {
|
||||
printf("create can rxdemo task fail.\n");
|
||||
return -1;
|
||||
}
|
||||
|
@ -460,9 +460,9 @@ int rtc_init(void)
|
||||
alarm_irq_enable(0);
|
||||
|
||||
rtc_read_time(&tm);
|
||||
// if (tm.tm_year == 70) {
|
||||
// rtc_set_time(&default_tm);
|
||||
// }
|
||||
if (tm.tm_year == 70) {
|
||||
rtc_set_time(&default_tm);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1090,6 +1090,7 @@ static void uart_rx_demo_thread(void *param)
|
||||
|
||||
int uart_rx_demo(void)
|
||||
{
|
||||
printf("3028 Bluetooth Communicator > UART2 OPEN.\r\n");
|
||||
/* Create a task to process uart rx data */
|
||||
if (xTaskCreate(uart_rx_demo_thread, "uartdemo", configMINIMAL_STACK_SIZE, NULL,
|
||||
configMAX_PRIORITIES / 3, NULL) != pdPASS) {
|
||||
|
@ -75,7 +75,7 @@ static void protocol_uart_tx_thread(void *param)
|
||||
for (;;)
|
||||
{
|
||||
if(uart_tx_flag){
|
||||
if (uart_time_request[0] != 0 && uart_time_request[0] == 0xAA)
|
||||
if (uart_time_request[0] != 0 && (uart_time_request[0] == 0xAA || uart_time_request[0] == 0x27))
|
||||
{
|
||||
// printf("UART3 tx-->>> ");
|
||||
for (uint8_t i = 0; i < uart_tx_flag; i++)
|
||||
@ -331,7 +331,7 @@ static void protocol_uart_rx_thread(void *param)
|
||||
// for(j=0;j<str_len;j++){
|
||||
// printf("%02x ",tlv_data_value[j]);
|
||||
// }
|
||||
// tire_pressure_data_analysis(tlv_data_value);
|
||||
tire_pressure_data_analysis(tlv_data_value);
|
||||
mac_data = 0;
|
||||
}else if(bt_state){//存在呼吸 若呼吸不存在
|
||||
bt_communication_heartbeat = 3;
|
||||
@ -408,6 +408,7 @@ static void protocol_uart_rx_thread(void *param)
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#if 1
|
||||
@ -526,6 +527,7 @@ static void protocol_uart_rx_thread(void *param)
|
||||
|
||||
int uart_communicates_with_bt(void)
|
||||
{
|
||||
printf("8018 Bluetooth Communicator > UART3 OPEN.\r\n");
|
||||
/* Create a task to process uart rx data */
|
||||
if (xTaskCreate(protocol_uart_rx_thread, "uart3rx", configMINIMAL_STACK_SIZE, NULL,
|
||||
configMAX_PRIORITIES / 3, NULL) != pdPASS)
|
||||
|
Reference in New Issue
Block a user