Commit 305099f8 authored by hu's avatar hu

调整DTC故障码相关逻辑

parent bf8daa9b
......@@ -26,6 +26,11 @@ uint8_t TpmsMsg18033317SendFlag = 0;
uint8_t Msg_18021733[8];
static uint8_t TXNum_18033317;
uint32_t DisDTCNumber[50];
uint8_t DisDTCNum;
/*---------------------------------------------------------------------------
使用しない Byte、bit に関しては全て 1(B)をセットして出力すること
对于不使用的Byte、bit,全部设置1(B)并输出
......@@ -1159,6 +1164,37 @@ uint8_t Common_GetTXNum_18033317(void)
return TXNum_18033317;
}
/*-------------------------------------------------------------------------
* Function Name : Common_DTC_Server
* Description :
* Input : None
* Output : None
* Return : None
* onther : None
--------------------------------------------------------------------------*/
void Common_DTC_Server(void)
{
static uint32_t CurFault[25];
static uint32_t HisFault[25];
uint8_t CurFaultNum = 0;
uint8_t HisFaultNum = 0;
uint8_t i = 0U;
uint8_t j = 0u;
GetAllDtcFault(CurFault, &CurFaultNum, HisFault, &HisFaultNum);
for (i = 0; i < CurFaultNum; i++)
{
DisDTCNumber[i] = CurFault[i];
}
for (j = 0; j < HisFaultNum; j++)
{
DisDTCNumber[i + j] = HisFault[j];
}
DisDTCNum = CurFaultNum + HisFaultNum;
}
/*-------------------------------------------------------------------------
* Function Name : GetAllDtcFault
* Description :
......
......@@ -20,6 +20,9 @@ typedef struct
} USER_ECU;
extern USER_ECU User_ECU;
extern uint32_t DisDTCNumber[50];
extern uint8_t DisDTCNum;
extern void Can_Set_Buff_18FEAE17(uint8_t CopyData[]);
extern void Can_Set_Buff_18FF3E17(uint8_t CopyData[]);
......@@ -64,6 +67,8 @@ void Id18033317_Send_Service(void);
void MSG_18021733_REC_COPY(uint8_t copy[]);
void Common_DTC_Server(void);
void GetAllDtcFault(uint32_t* pCurFault, uint8_t* pCurFaultNum, uint32_t* pHisFault, uint8_t* pHisFaultNum);
void swap32(uint32_t *DwData);
......
......@@ -31,6 +31,7 @@
#include "Popup_Scheduler.h"
#include "Popups.h"
#include "kwp2000_service.h"
#include "CAN_FUNC.h"
#pragma alignvar(8)
Display_Modular_St Display_DTC[DTCNumeber + 1u];
......@@ -39,6 +40,8 @@ uint32_t EolNUM[10u][8u];
uint8_t DTCNumTime = 0u;
static uint8_t GUIDTCNumDis = 0u;
uint8_t DTCDispNum;
uint32_t DTNum = 0u;
_Display_State_Flag State_Flag; /*0-常态 1-小于0 2-小于1000 3-无此功能*/
_TPMS TPMS_Matching;
......@@ -6649,7 +6652,14 @@ void GUI_Display_DTC_Server(void)
uint8_t DTCNum = 0u;
/*发动机故障*/
Display_DTC[0u].Disp_True_False = 1u;
if (DisDTCNum != 0x00u)
{
Display_DTC[0u].Disp_True_False = 1u;
}
else
{
Display_DTC[0u].Disp_True_False = 0u;
}
/*SRC故障*/
Display_DTC[1u].Disp_True_False = 0u;
......@@ -6737,13 +6747,26 @@ void GUI_Display_DTC_Server(void)
* Return : None
* onther : 区域
--------------------------------------------------------------------------*/
uint32_t DTNum = 0u;
void GUI_BG_DTCEngine_Display(uint8_t Mode)
{
uint8_t DTCNumCode = 0u;
uint32_t DTNumValue = 0u;
uint8_t Dig[5];
//uint32_t DTNum = 0u;
if (DTCNumTime == 1)
{
if (DTCDispNum == DisDTCNum)
{
DTCDispNum = 0;
}
DTNum = DisDTCNumber[DTCDispNum];
if (DTCDispNum < DisDTCNum)
{
DTCDispNum++;
}
}
DTCNumCode = (uint8_t)(DTNum >> 28u);
DTNumValue = ((DTNum >> 0x08u) & 0xFFFFFFu);
......
......@@ -10,6 +10,7 @@
#include "RTE_TIME.h"
#include "kwp2000_service.h"
#include "RTE_CAN.h"
#include "CAN_FUNC.h"
uint8_t bMenuSwFlag;
uint8_t g_ClearWin1;
......@@ -20,6 +21,8 @@ uint8_t bOldMenuIDX;
_MenuFlag MenuFlag ;
uint8_t Menu_DTC_DisTime;
const _MenuOptTab MenuOptTab[] =
{
/*---------ENTER---------------------UP-----------------------DOWN----------------------EXIT------------------ENTER------------------DO-----------------EXIT------------*/
......@@ -571,17 +574,31 @@ void Level2_1Menu_1Enter(void)
canMag.Msg[7u] = 0x55u;
Can_Write(&canMag);
Menu_DTC_DisTime = 20u;
}
static uint8_t DTCNumDis = 1u;
void Level2_1Menu_1Do(void)
{
//uint8_t DTCNumDis = 0u;
uint8_t DTCNumDis = 0x00u;
if (Menu_DTC_DisTime != 0x00u)
{
Menu_DTC_DisTime--;
}
//DTCNumDis = 0u;
if (Menu_DTC_DisTime == 0u)
{
DTCNumDis = 1u;
}
else
{
DTCNumDis = 0u;
}
GUI_OftenShow_Display();
if (DTCNumDis == 1u) /*故障码轮显*/
if (DTCNumDis == 1u) /*计时*/
{
GUI_Display_DTC_Server();
//GUI_BG_DTCEngine_Display(GUI_DISP_MODE_NORMAL);
......@@ -1930,11 +1947,58 @@ void LevelF1Menu_6Exit(void)
/**/
/*----工厂模式----DTC显示----发动机故障*-----*/
void LevelF1_1Menu_1Enter(void)
{}
{
//03 19 02 0C 55 55 55 55
_CAN_Msg canMag;
canMag.MsgID = 0x7E0u;
canMag.MsgDLC = 8u;
canMag.MsgPro = 0u;
canMag.MsgStd = 0u;
canMag.MsgRTR = 0u;
canMag.Msg[0u] = 0x03u;
canMag.Msg[1u] = 0x19u;
canMag.Msg[2u] = 0x02u;
canMag.Msg[3u] = 0x0Cu;
canMag.Msg[4u] = 0x55u;
canMag.Msg[5u] = 0x55u;
canMag.Msg[6u] = 0x55u;
canMag.Msg[7u] = 0x55u;
Can_Write(&canMag);
Menu_DTC_DisTime = 20u;
}
void LevelF1_1Menu_1Do(void)
{
uint8_t DTCNumDis = 0x00u;
if (Menu_DTC_DisTime != 0x00u)
{
Menu_DTC_DisTime--;
}
if (Menu_DTC_DisTime == 0u)
{
DTCNumDis = 1u;
}
else
{
DTCNumDis = 0u;
}
GUI_OftenShow_Display();
GUI_BG_DTCEngine_Display(GUI_DISP_MODE_NORMAL);
if (DTCNumDis == 1u) /*计时*/
{
GUI_Display_DTC_Server();
//GUI_BG_DTCEngine_Display(GUI_DISP_MODE_NORMAL);
}
else /*故障码读取中*/
{
GUI_BG_DTCReading_Display(GUI_DISP_MODE_NORMAL);
}
}
void LevelF1_1Menu_1Exit(void)
{}
......@@ -1995,7 +2059,26 @@ void LevelF1_2Menu_2Exit(void)
/*----工厂模式----DTC清除3----清除DTC全部-----*/
void LevelF1_2Menu_3Enter(void)
{}
{
_CAN_Msg canMag;
canMag.MsgID = 0x7E0u;
canMag.MsgDLC = 8u;
canMag.MsgPro = 0u;
canMag.MsgStd = 0u;
canMag.MsgRTR = 0u;
canMag.Msg[0u] = 0x04u;
canMag.Msg[1u] = 0x14u;
canMag.Msg[2u] = 0xFFu;
canMag.Msg[3u] = 0xFFu;
canMag.Msg[4u] = 0xFFu;
canMag.Msg[5u] = 0x55u;
canMag.Msg[6u] = 0x55u;
canMag.Msg[7u] = 0x55u;
Can_Write(&canMag);
}
void LevelF1_2Menu_3Do(void)
{
GUI_OftenShow_Display();
......@@ -2186,10 +2269,58 @@ void LevelD1Menu_6Exit(void)
/*----经销商模式----DTC显示----*/
void LevelD1_1Menu_1Enter(void)
{}
{
//03 19 02 0C 55 55 55 55
_CAN_Msg canMag;
canMag.MsgID = 0x7E0u;
canMag.MsgDLC = 8u;
canMag.MsgPro = 0u;
canMag.MsgStd = 0u;
canMag.MsgRTR = 0u;
canMag.Msg[0u] = 0x03u;
canMag.Msg[1u] = 0x19u;
canMag.Msg[2u] = 0x02u;
canMag.Msg[3u] = 0x0Cu;
canMag.Msg[4u] = 0x55u;
canMag.Msg[5u] = 0x55u;
canMag.Msg[6u] = 0x55u;
canMag.Msg[7u] = 0x55u;
Can_Write(&canMag);
Menu_DTC_DisTime = 20u;
}
void LevelD1_1Menu_1Do(void)
{
uint8_t DTCNumDis = 0x00u;
if (Menu_DTC_DisTime != 0x00u)
{
Menu_DTC_DisTime--;
}
if (Menu_DTC_DisTime == 0u)
{
DTCNumDis = 1u;
}
else
{
DTCNumDis = 0u;
}
GUI_OftenShow_Display();
if (DTCNumDis == 1u) /*计时*/
{
GUI_Display_DTC_Server();
//GUI_BG_DTCEngine_Display(GUI_DISP_MODE_NORMAL);
}
else /*故障码读取中*/
{
GUI_BG_DTCReading_Display(GUI_DISP_MODE_NORMAL);
}
}
void LevelD1_1Menu_1Exit(void)
{}
......@@ -2218,7 +2349,26 @@ void LevelD1_2Menu_2Exit(void)
/*----经销商模式----DTC清除3----*/
void LevelD1_2Menu_3Enter(void)
{}
{
_CAN_Msg canMag;
canMag.MsgID = 0x7E0u;
canMag.MsgDLC = 8u;
canMag.MsgPro = 0u;
canMag.MsgStd = 0u;
canMag.MsgRTR = 0u;
canMag.Msg[0u] = 0x04u;
canMag.Msg[1u] = 0x14u;
canMag.Msg[2u] = 0xFFu;
canMag.Msg[3u] = 0xFFu;
canMag.Msg[4u] = 0xFFu;
canMag.Msg[5u] = 0x55u;
canMag.Msg[6u] = 0x55u;
canMag.Msg[7u] = 0x55u;
Can_Write(&canMag);
}
void LevelD1_2Menu_3Do(void)
{
GUI_OftenShow_Display();
......
......@@ -125,8 +125,8 @@ void Common_DataInit(void)
HIGH_VOLTAGE = 0x0u;
LOW_VOLTAGE = 0x0u;
TPMS_TEST_OFF_TIME = 0u;
Menu_FacDea_Time = 0u;
TPMS_TEST_OFF_TIME = 0x00u;
Menu_FacDea_Time = 0x00u;
}
/*以下由各个处理模块按需调用*/
......
......@@ -650,7 +650,7 @@ void TP_TransmitPDU(void)
//g_bReturn = bsp_CANSendFrame(g_txCanMsg.id, txResNum, (uint8_t *)&g_txCanMsg.msg[0], 8);
/*重新赋值----20220326----*/
canMag.MsgID = 0x7E0u;//g_txCanMsg.id;
canMag.MsgID = g_txCanMsg.id;
canMag.MsgDLC = 8u;
canMag.MsgPro = 0u;
canMag.MsgStd = 0u;
......@@ -689,6 +689,7 @@ void TP_TransmitNegatePDU(_ErrorFrame *Err)
N_US_R_Data_FF.ind.Length = 0;
N_US_R_Data_FF.ind.N_SID = 0;
}
/*
if (Err->N_TAtype == ID_PhyAddr) //物理寻址--回复错误
{
g_txCanMsg.id = ID_ResAddr;
......@@ -721,6 +722,7 @@ void TP_TransmitNegatePDU(_ErrorFrame *Err)
g_bReturn = Can_Write(&canMag);
}
*/
if ((Err->FrameErr != ServiceNotSupported) &&
(Err->FrameErr != SubFunctionNotSupported) &&
(Err->FrameErr != RequestOutOfRange))
......
......@@ -16,9 +16,9 @@
#define ID_BCM_PhyAddr 0x7E0
#define ID_BCM_ResAddr 0x7E8 //BCM物理响应
#define ID_PhyAddr 0x701
#define ID_ResAddr 0x709 //物理响应
#define ID_FunAddr 0x7df
//#define ID_PhyAddr 0x7E8
#define ID_ResAddr 0x7E0 //物理响应
//#define ID_FunAddr 0x7df
#define N_FILL 0x00
......
......@@ -199,24 +199,25 @@ void Diagnosis_main(void)
}
break;
case ID_PhyAddr:
switch (Exct_USData.ind.MsgData[0])
{
case ReqSessionCtlId:
App_10_service((_N_USData*)&Exct_USData);
break;
case ReqECUResetId:
App_11_service((_N_USData*)&Exct_USData);
break;
default:
/* Error.N_TAtype = ID_PhyAddr;
Error.FrameErr = ServiceNotSupported; //服务不支持
Error.RespSerId = Exct_USData.ind.MsgData[0];*/
break;
}
break;
default:;
//case ID_PhyAddr:
// switch (Exct_USData.ind.MsgData[0])
// {
// case ReqSessionCtlId:
// App_10_service((_N_USData*)&Exct_USData);
// break;
// case ReqECUResetId:
// App_11_service((_N_USData*)&Exct_USData);
// break;
// default:
// /* Error.N_TAtype = ID_PhyAddr;
// Error.FrameErr = ServiceNotSupported; //服务不支持
// Error.RespSerId = Exct_USData.ind.MsgData[0];*/
// break;
// }
// break;
default:
;
}
Exct_USData.ind.N_Result = STATE0;
}
......
......@@ -244,6 +244,7 @@ void Sys_Run_Mode_100ms_Tasks(void)
Data_GsLYbL_Speed_Processing();
/**/
Common_Set_K_Line_Value();
Common_DTC_Server();
//YZHD_Count++;
//if (YZHD_Count == 20)
......
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