Commit b8fe879c authored by 李秉薇's avatar 李秉薇

fix:39992

parent 8a5b0299
......@@ -393,7 +393,7 @@ typedef union
#define DTCNoTestThisCycle 0x40
#define DTCNoError 0xFE
#define AgeingCount 39
#define AgeingCount 40
typedef union
{
......@@ -497,4 +497,6 @@ uint8_t Write_Base_DATA_FROM_FLASH(uint32_t Adrr, uint8_t *Data,uint8_t len);
uint8_t ReadDFlashData(uint32_t u8BlockNum, uint32_t u32Data[], uint16_t u16Len, InitFunction initFunction);
void Ser2EToDFlashInfoInit(void);
void ReadAllDflashData(void);
void DTCAgeing(void);
void UDS_KL15_init(void);
#endif
\ No newline at end of file
......@@ -789,7 +789,7 @@ void WRITE_BZ_inDFLAH2Sector ( INT16U bz )
if ( DFLASH_Erase_Sector ( DFLASH_APPvAddress ) != OK )
return;
mRUL=DFLASH_Program ( DFLASH_APPvAddress, &bz, 1 );
mRUL=DFLASH_Program ( DFLASH_APPvAddress + 4, &bz, 1 );
}
//========================================================
......@@ -2437,7 +2437,13 @@ Get KL15 Status
*/
uint8_t getKL15Status(void)
{
return ANALOG_KL15_VOLTAGE_VALID;
uint8_t flag = 0;
if(ANALOG_KL15_VOLTAGE > 500) {
flag = 1;
} else {
flag = 0;
}
return flag;
}
/*
......@@ -2754,6 +2760,62 @@ uint8_t getMSGStatus(uint8_t cnMsgID)
}
/**
*DTC Aged
*/
void DTCAgeing(void)
{
INT8U i;
for ( i = 0u; i < cnDTCslen; ++i )
{
DiagDtc[ i ].Status.Flag |= (DTCNoTestThisCycle);
if ( ( uint8_t )(DiagDtc[ i ].Status.Flag & DTCErrorThisCycle) != DTCErrorThisCycle )
{
DiagDtc[ i ].Status.Flag = ( uint8_t )(DiagDtc[ i ].Status.Flag & (~DTCPending));
DiagDtc[ i ].FaultPendCount = 0u;
if ( ( uint8_t )(DiagDtc[ i ].Status.Flag & DTCConfirmed) == DTCConfirmed )
{
DiagDtc[ i ].DTCAgingCount++;
if ( DiagDtc[ i ].DTCAgingCount >= AgeingCount )
{
DiagDtc[ i ].Status.Flag = ( uint8_t )(DiagDtc[ i ].Status.Flag & (~DTCConfirmed));
DTCUpdataStatusList [ i ] = 1u;
}
}
}
else
{
DiagDtc[ i ].Status.Flag = ( uint8_t )(DiagDtc[ i ].Status.Flag & (~DTCErrorThisCycle));
}
DiagDtc[ i ].Status.Flag = ( uint8_t )(DiagDtc[ i ].Status.Flag & DTCNoError);
}
}
void UDS_KL15_init(void)
{
INT8U KL15Status = getKL15Status( );
if ( UDSKL15Status == 0u )
{
if ( KL15Status == 1u )
{
UDSKL15Status = 1u;
setDTCEnableTimer(KL15DTCEnableTimer);
SessionType = 1;
//S3_ServiceTimeOut( );
DTCAgeing( );
}
}
else
{
if ( KL15Status == 0u )
{
UDSKL15Status = 0u;
setDTCEnableTimer(KL15DTCEnableTimer);
}
}
}
void UDS_Service_19_Indication ( uint32_t A_TA_type, uint16_t A_Length, uint8_t *A_Data )
{
uint16_t i;
......
......@@ -29,9 +29,9 @@ extern void Data_Fuel_Consumption_Count_ISR(void);
void WDT_Init(void)
{
//配置看门狗
//wdt_reset();
//COPCTL = WDT_PERIOD; //配置看门狗定时周期
// PLLCTL_PCE = 1; //看门狗在Pseudo Stop模式下持续运行
wdt_reset();
COPCTL = WDT_PERIOD; //配置看门狗定时周期
PLLCTL_PCE = 1; //看门狗在Pseudo Stop模式下持续运行
}
/******************************************************************************
......
......@@ -151,6 +151,7 @@ void main(void)
UDS_Server_Application_Service(); //诊断
EEPROM_RW_Service();
TFT_LCD_General_Table_Write_Service();
UDS_KL15_init();
if(SYS_IGN_OFF_DISP_MODE)
{
TFT_LCD_General_Table_Write_Service();
......
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