Commit c350e0ac authored by 郑萍's avatar 郑萍

feat:车速行车电脑与显示对接完成,以及can中断调通

parent f38d4795
......@@ -15,8 +15,8 @@ void Can_Init(void)
can_config_st_t Can_Config;
Can_Config.ch = CAN_CH_0;
Can_Config.freq = CAN_500Kbps;
Can_Config.MASK[0] = 0x001fffffU;
Can_Config.MASK[1] = 0x000fffffU;
Can_Config.MASK[0] = 0x1fffffffU;
Can_Config.MASK[1] = 0x1fffffffU;
Can_Config.MASK[2] = 0x1fffffffU;
Can_Config.MASK[3] = 0x1fffffffU;
Can_Config.rx_callback = Can_Rx_Cak;
......
......@@ -82,8 +82,7 @@ void Data_Vehicle_Speed_Processing_Service(void)
if ((CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CH0_101_Msg_Count) == CAN_SIG_LOST) || (Vehicle_Speed > 0XFF))
{
/* 先判断掉线 */
//if (CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CAN_0x101_Msg_Count) == CAN_SIG_LOST)
if(1)
if (CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CH0_101_Msg_Count) == CAN_SIG_LOST)
{
DataVSpeedValid = 0;
DataVSpeedActual = 0;
......
......@@ -2474,7 +2474,7 @@ static void AMT630H_GUI_VSpeed(uint16_t VSpeed)
VSpeedNumber = VSpeed;
DisplayNumPara.NumList = NumbeList_VSpeed_DAY;
if (100 <= VSpeedNumber <= 199)
if (100 <= VSpeedNumber)
{
DisplayNumPara.x = 574;
DisplayNumPara.NumInterval = GROUP_PIC_DIR_LEFT | 118;
......@@ -2484,7 +2484,7 @@ static void AMT630H_GUI_VSpeed(uint16_t VSpeed)
DisplayNum(GRAPHICS_PAGE_0, &DisplayNumPara, VSpeedNumber);
}
else if (10 <= VSpeedNumber < 100)
else if ((10 <= VSpeedNumber))
{
DisplayNumPara.x = 515;
DisplayNumPara.NumInterval = GROUP_PIC_DIR_LEFT | 118;
......@@ -2494,7 +2494,7 @@ static void AMT630H_GUI_VSpeed(uint16_t VSpeed)
DisplayNum(GRAPHICS_PAGE_0, &DisplayNumPara, VSpeedNumber);
}
else if (0 <= VSpeedNumber < 10)
else if (0 <= VSpeedNumber)
{
if (VSpeedNumber == 1)
{
......@@ -2510,6 +2510,10 @@ static void AMT630H_GUI_VSpeed(uint16_t VSpeed)
DisplayNumPara.MinDigits = 1;
DisplayNum(GRAPHICS_PAGE_0, &DisplayNumPara, VSpeedNumber);
}
else
{
;
}
}
else if ((Pic_mode == PIC_NIGHTTIME_Main_CH) || (Pic_mode == PIC_NIGHTTIME_Main_EN))
{
......@@ -2522,7 +2526,7 @@ static void AMT630H_GUI_VSpeed(uint16_t VSpeed)
VSpeedNumber = VSpeed;
DisplayNumPara.NumList = NumbeList_VSpeed_NIGHT;
if (100 <= VSpeedNumber <= 199)
if (100 <= VSpeedNumber)
{
DisplayNumPara.x = 574;
DisplayNumPara.NumInterval = GROUP_PIC_DIR_LEFT | 118;
......@@ -2532,7 +2536,7 @@ static void AMT630H_GUI_VSpeed(uint16_t VSpeed)
DisplayNum(GRAPHICS_PAGE_0, &DisplayNumPara, VSpeedNumber);
}
else if (10 <= VSpeedNumber < 100)
else if (10 <= VSpeedNumber)
{
DisplayNumPara.x = 515;
DisplayNumPara.NumInterval = GROUP_PIC_DIR_LEFT | 118;
......@@ -2542,7 +2546,7 @@ static void AMT630H_GUI_VSpeed(uint16_t VSpeed)
DisplayNum(GRAPHICS_PAGE_0, &DisplayNumPara, VSpeedNumber);
}
else if (0 <= VSpeedNumber < 10)
else if (0 <= VSpeedNumber)
{
if (VSpeedNumber == 1)
{
......@@ -2654,7 +2658,7 @@ static void AMT630H_GUI_ESpeed(uint16_t ESpeed)
/******************************************************************************************/
/**
* @brief 菜单背景
* @brief 主界面显示
*
*/
void AMT630H_GUI_BACKGRAND()
......@@ -2685,7 +2689,14 @@ void AMT630H_GUI_BACKGRAND()
AMT630H_GUI_Fuel(2);
AMT630H_GUI_Voltage(123);
AMT630H_GUI_ODO(123456);
AMT630H_GUI_VSpeed(123);
if(Get_VechileSpeedValid() == 1)
{
AMT630H_GUI_VSpeed(Get_DispVechileSpeed()/10);
}
else
{
AMT630H_GUI_VSpeed(0);
}
AMT630H_GUI_ESpeed(1234);
}
......
......@@ -6,8 +6,21 @@
CANMSG_Type* CANMSG;
CanTxRxMsg CAN_RecvMsg;
CANBuffList_t CanBufList = {0};
can_rx_callback can_rx_handler = NULL;
uint8_t Read_RingBuff(CanTxRxMsg *data)
{
if (CanBufList.length == 0)
{
return 0;
}
*data = CanBufList.data[CanBufList.Head];
CanBufList.Head = (CanBufList.Head + 1) % LIST_BUF_MAX_NUM;
CanBufList.length--;
return 1;
}
/**
* @brief CAN就收完成回调
*
......@@ -20,9 +33,9 @@ static void can_recv_handler(void *msg)
if (CAN_GetFlagStatus(CAN0, CAN_FLAG_REC) != RESET)
{
CAN_ClearFlag(CAN0, CAN_FLAG_REC);
// CANMSG = CAN_Get_CANxMSGy(CAN0);
// CAN_Receive_IT(CAN0, &CAN_RecvMsg);
CAN_Receive_IT(CAN0, &CanBufList);
Read_RingBuff(&CAN_RecvMsg);
if (can_rx_handler != NULL)
{
can_rx_handler(&CAN_RecvMsg);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment