Commit 0c50574f authored by 高士达's avatar 高士达

Merge branch 'CJL' into 'dev'

Cjl

See merge request !97
parents 2f7f090c 8e13c580
......@@ -275,7 +275,7 @@
</OCR_RVCT3>
<OCR_RVCT4>
<Type>1</Type>
<StartAddress>0x0</StartAddress>
<StartAddress>0x8000</StartAddress>
<Size>0x40000</Size>
</OCR_RVCT4>
<OCR_RVCT5>
......@@ -788,11 +788,6 @@
<FileType>5</FileType>
<FilePath>..\..\..\..\Source\Component\System_Monitor\System_Monitor_User.h</FilePath>
</File>
<File>
<FileName>eepromManage_20240305.lib</FileName>
<FileType>4</FileType>
<FilePath>..\..\..\..\Source\Component\Eeprom\eepromManage_20240305.lib</FilePath>
</File>
<File>
<FileName>Telltales_user.c</FileName>
<FileType>1</FileType>
......@@ -848,6 +843,11 @@
<FileType>4</FileType>
<FilePath>..\..\..\..\Source\Component\CAN_Signal\CAN_Signal.lib</FilePath>
</File>
<File>
<FileName>eepromManage_TestVersion.lib</FileName>
<FileType>4</FileType>
<FilePath>..\..\..\..\Source\Component\Eeprom\eepromManage_TestVersion.lib</FilePath>
</File>
</Files>
</Group>
<Group>
......
......@@ -4,11 +4,31 @@
uint16_t CAN_TX_Count = 0;
uint16_t AliveCountTimer = 0;
uint8_t Power_KL30_Init_flag = 0;
uint8_t AliveCount_KL30_ResettingFlag = 0;
extern uint8_t Tpms_TX_Flag;
#define INVALID_VALUE 0x0
void CAN_TX_Flag_Init(void)
{
Power_KL30_Init_flag = 0;
}
void CAN_TX_Count_Init(void)
{
CAN_TX_Count = 0;
AliveCountTimer = 0;
if(AliveCount_KL30_ResettingFlag > 0)
{
AliveCount_KL30_ResettingFlag = 0;
}
else
{
AliveCountTimer = 0;
}
}
void Can_Set_Buff_220(canlib_uint8_t CopyData[])
{
......@@ -20,15 +40,15 @@ void Can_Set_Buff_220(canlib_uint8_t CopyData[])
p220 = (CANMsg220Union *)CopyData;
if ( p220 != ( void * )0 )
{
for ( i = 0u; i < 8u; i++ )
{
p220->Msg [ i ] = 0x0u;
}
for ( i = 0u; i < 8u; i++ )
{
p220->Msg [ i ] = 0x0u;
}
p220 -> Sig.TCS_TX = u8TCSVal;
p220 -> Sig.AliveCounter = AliveCountTimer;
p220 -> Sig.CheckSum = (u8TCSVal == 1) ? 8 : 0;
}
p220 -> Sig.TCS_TX = u8TCSVal;
p220 -> Sig.AliveCounter = AliveCountTimer;
p220 -> Sig.CheckSum = (u8TCSVal == 1) ? 8 : 0;
}
......@@ -46,21 +66,32 @@ void Can_Set_Buff_6EE(canlib_uint8_t CopyData[])
if ( p6EE != ( void * )0 )
{
for ( i = 0u; i < 8u; i++ )
{
p6EE->Msg [ i ] = 0x0u;
}
p6EE -> Sig.ODO_TX_H = (ODO_tx >> 16) & 0xFF ;
p6EE -> Sig.ODO_TX_M = (ODO_tx >> 8) & 0xFF ;
p6EE -> Sig.ODO_TX_L = ODO_tx & 0xFF ;
if(Fuel_tx > 255)
if(Power_KL30_Init_flag == 1)
{
p6EE -> Sig.Fuel_Res_TX = 0xFF ;
for ( i = 0u; i < 8u; i++ )
{
p6EE->Msg [ i ] = 0x0u;
}
p6EE -> Sig.ODO_TX_H = (ODO_tx >> 16) & 0xFF ;
p6EE -> Sig.ODO_TX_M = (ODO_tx >> 8) & 0xFF ;
p6EE -> Sig.ODO_TX_L = ODO_tx & 0xFF ;
if(Fuel_tx > 255)
{
p6EE -> Sig.Fuel_Res_TX = 0xFF ;
}
else
{
p6EE -> Sig.Fuel_Res_TX = Fuel_tx ;
}
}
else
{
p6EE -> Sig.Fuel_Res_TX = Fuel_tx ;
for ( i = 0u; i < 8u; i++ )
{
p6EE->Msg [ i ] = INVALID_VALUE;
}
}
}
//p6EE -> Sig.Vsppe_H3_TX = (Vspeed_tx >> 8) & 0x7u ;
......@@ -91,12 +122,23 @@ void Can_Set_Buff_6EF(canlib_uint8_t CopyData[])
p6EF = (CANMsg6EFUnion *)CopyData;
if ( p6EF != ( void * )0 )
{
for ( i = 0u; i < 8u; i++ )
if(Power_KL30_Init_flag == 1)
{
p6EF->Msg [ i ] = 0x0u;
for ( i = 0u; i < 8u; i++ )
{
p6EF->Msg [ i ] = 0x0u;
}
p6EF -> Sig.TripA_H = (TripA_tx >> 8) & 0xFF;
p6EF -> Sig.TripA_L = TripA_tx & 0xFF;
}
p6EF -> Sig.TripA_H = (TripA_tx >> 8) & 0xFF;
p6EF -> Sig.TripA_L = TripA_tx & 0xFF;
else
{
for ( i = 0u; i < 8u; i++ )
{
p6EF->Msg [ i ] = INVALID_VALUE;
}
}
}
//p6EF -> Sig.Espeed_TX = Espeed_tx;
......@@ -115,52 +157,63 @@ void Can_Set_Buff_450(canlib_uint8_t CopyData[])
p450 = (CANMsg450Union *)CopyData;
if ( p450 != ( void * )0 )
{
for ( i = 0u; i < 8u; i++ )
{
p450->Msg [ i ] = 0x0u;
}
if(Get_Front_TPMS_Sig_Vaild() == 0\
|| Get_TPMS_Front_Learn() != 2
|| CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CAN_0x373_Msg_Count) == CAN_SIG_LOST\
|| Get_Front_TPMS_ID_Vaild() == 0)
{
p450 -> Sig.Front_Pressure_TX_H = 0;
p450 -> Sig.Front_Pressure_TX_L = 0;
}
else
if(Power_KL30_Init_flag == 1)
{
if((u16FrontTpmsValue + 146) <= 1000U)
for ( i = 0u; i < 8u; i++ )
{
p450->Msg [ i ] = 0x0u;
}
if(Get_Front_TPMS_Sig_Vaild() == 0\
|| Get_TPMS_Front_Learn() != 2
|| CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CAN_0x373_Msg_Count) == CAN_SIG_LOST\
|| Get_Front_TPMS_ID_Vaild() == 0)
{
u16FrontTpms = (u16FrontTpmsValue + 146);
p450 -> Sig.Front_Pressure_TX_H = 0;
p450 -> Sig.Front_Pressure_TX_L = 0;
}
else
{
u16FrontTpms = 1000U;
if((u16FrontTpmsValue + 146) <= 1000U)
{
u16FrontTpms = (u16FrontTpmsValue + 146);
}
else
{
u16FrontTpms = 1000U;
}
p450 -> Sig.Front_Pressure_TX_H = ( u16FrontTpms >> 8) & 0xFF;
p450 -> Sig.Front_Pressure_TX_L = ( u16FrontTpms) & 0xFF;
}
p450 -> Sig.Front_Pressure_TX_H = ( u16FrontTpms >> 8) & 0xFF;
p450 -> Sig.Front_Pressure_TX_L = ( u16FrontTpms) & 0xFF;
}
if(Get_Rear_TPMS_Sig_Vaild() == 0\
|| Get_TPMS_Rear_Learn() != 2
|| CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CAN_0x373_Msg_Count) == CAN_SIG_LOST\
|| Get_Rear_TPMS_ID_Vaild() == 0)
{
p450 -> Sig.Rear_Pressure_TX_H = 0;
p450 -> Sig.Rear_Pressure_TX_L = 0;
}
else
{
if((u16RearTpmsValue + 146) <= 1000U)
if(Get_Rear_TPMS_Sig_Vaild() == 0\
|| Get_TPMS_Rear_Learn() != 2
|| CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CAN_0x373_Msg_Count) == CAN_SIG_LOST\
|| Get_Rear_TPMS_ID_Vaild() == 0)
{
u16RearTpms = (u16RearTpmsValue + 146);
p450 -> Sig.Rear_Pressure_TX_H = 0;
p450 -> Sig.Rear_Pressure_TX_L = 0;
}
else
{
u16RearTpms = 1000U;
if((u16RearTpmsValue + 146) <= 1000U)
{
u16RearTpms = (u16RearTpmsValue + 146);
}
else
{
u16RearTpms = 1000U;
}
p450 -> Sig.Rear_Pressure_TX_H = (u16RearTpms >> 8) & 0xFF;
p450 -> Sig.Rear_Pressure_TX_L = (u16RearTpms) & 0xFF;
}
p450 -> Sig.Rear_Pressure_TX_H = (u16RearTpms >> 8) & 0xFF;
p450 -> Sig.Rear_Pressure_TX_L = (u16RearTpms) & 0xFF;
}
else
{
for ( i = 0u; i < 8u; i++ )
{
p450->Msg [ i ] = INVALID_VALUE;
}
}
}
......
......@@ -12,6 +12,7 @@ static RSCAN0BusoffMonitorStruct RSCAN0Busoff;
void Can_Init(void)
{
CAN_TX_Count_Init();
can_config_st_t Can_Config;
Can_Config.ch = CAN_CH_0;
Can_Config.freq = CAN_500Kbps;
......@@ -262,7 +263,7 @@ void CAN_TX_Init(void)
CAN_CH0_CanMsgTxOp.Can_Write = COM_APP_Process;
CAN_CH0_CanMsgTxOp.u8CAN_TX_ENABLE = CAN_N_TX_Disable;
Can_TX_BuffInit(&CAN_CH0_CanMsgTxOp, CAN_CH0_CANSendAttr, CAN_CH0_ID_SEND_TOTAL, COM_APP_Process);
CAN_TX_SetEnable(&CAN_CH0_CanMsgTxOp, CAN_N_TX_Disable);
CAN_TX_SetEnable(&CAN_CH0_CanMsgTxOp, CAN_N_TX_Enable);
}
#endif
......
......@@ -345,18 +345,26 @@ void Data_Coolant_Temp_Display ( void )
{
DataCoolantTemp_Dis.u8_DownFlashtimer = 0;
DataCoolantTemp_Dis.u8_UpFlashtimer = 0;
DataCoolantTemp_Dis.u8_Holdtimer++;
if (DataCoolantTemp_Dis.u8_Holdtimer >= CoolantFlashtimer)
{
DataCoolantTemp_Dis.u8_Holdtimer = CoolantFlashtimer;
}
DataCoolantTemp_Dis.u8_Holdtimer = CoolantFlashtimer;//++;
// if (DataCoolantTemp_Dis.u8_Holdtimer >= CoolantFlashtimer)
// {
// DataCoolantTemp_Dis.u8_Holdtimer = CoolantFlashtimer;
// }
/*目标格和当前格一致时,数显如何处理*/
/*5S后更新为目标数值*/
u32ColCurNum = Data_Coolant_Cal_Num(DataCoolantTemp_Dis.u8_CurSeg, 2, (CoolantFlashtimer-DataCoolantTemp_Dis.u8_Holdtimer ), u32ColCurNum, DataCoolantTemp.Value*100);
// if(u32ColCurNum < DataCoolantTemp.Value*100)
// {
// u32ColCurNum += 100;
// }
// else if (u32ColCurNum > DataCoolantTemp.Value*100)
// {
// u32ColCurNum -= 100;
// }
// else
// {
// u32ColCurNum = DataCoolantTemp.Value*100;
// }
}
}
......
......@@ -65,6 +65,8 @@ void Can_341_Receive(void)
Can_341_Flg = 1;
}
uint32_t Relaying_Rear_Press_Value = 0;
uint32_t Relaying_Front_Press_Value = 0;
void Data_TPMS_Processing_Service ( void )
{
uint16_t Front_TPMS = 0;
......@@ -516,6 +518,10 @@ void Data_TPMS_Processing_Service ( void )
TPMS.Rear_Press_Value = 0;
TPMS.TPMS_Warning = 0;
}
Relaying_Rear_Press_Value = TPMS.Rear_Press_Value;
Relaying_Front_Press_Value = TPMS.Front_Press_Value;
}
uint32_t Data_Bar_To_Psi (uint32_t bar)
{
......@@ -568,7 +574,7 @@ uint16_t Get_Front_TPMS_Sig_Value (void)
//else
{
//value = TPMS.Front_Press_Value + 50;
value = (uint16_t)((TPMS.Front_Press_Value + 50) / 100);
value = (uint16_t)((Relaying_Rear_Press_Value + 50) / 100);
}
return value;
}
......@@ -587,14 +593,14 @@ uint16_t Get_Rear_TPMS_Sig_Value (void)
//else
{
//value = TPMS.Rear_Press_Value + 50;
value = (uint8_t)((TPMS.Rear_Press_Value + 50) / 100);
value = (uint8_t)((Relaying_Rear_Press_Value + 50) / 100);
}
return value;
}
uint16_t Get_Rear_TPMS_TX (void)
{
uint16_t value = 0;
value = (uint16_t)(Data_Bar_To_Psi(TPMS.Rear_Press_Value) / 100);
value = (uint16_t)(Data_Bar_To_Psi(Relaying_Rear_Press_Value) / 100);
if(value > 990)
{
value = 990;
......@@ -604,7 +610,7 @@ uint16_t Get_Rear_TPMS_TX (void)
uint16_t Get_Front_TPMS_TX (void)
{
uint16_t value = 0;
value = (uint16_t)(Data_Bar_To_Psi(TPMS.Front_Press_Value) / 100);
value = (uint16_t)(Data_Bar_To_Psi(Relaying_Front_Press_Value) / 100);
if(value > 990)
{
value = 990;
......
#include "code.h"
static _st_Init FaultCodeInit;
static uint16_t u16FaultCodeDtcCount = 0;
static uint16_t u16FaultCodeDtcCountBack = 0;
static uint16_t u16FaultCodeDtcCounttemp = 0;
static _st_FaultCode stFaultCode[MaxFaultCode] = {0};
static _st_FaultCode stFaultCodeBack[MaxFaultCode] = {0};
static _st_FaultCode stFaultCodetemp[MaxFaultCode] = {0};
static uint8_t u8FaultCodeValid = 0;
//static _st_Init FaultCodeInit;
//static uint16_t u16FaultCodeDtcCount = 0;
//static uint16_t u16FaultCodeDtcCountBack = 0;
//static uint16_t u16FaultCodeDtcCounttemp = 0;
//static _st_FaultCode stFaultCode[MaxFaultCode] = {0};
//static _st_FaultCode stFaultCodeBack[MaxFaultCode] = {0};
//static _st_FaultCode stFaultCodetemp[MaxFaultCode] = {0};
//static uint8_t u8FaultCodeValid = 0;
FaultCodeList_t FaultCode_t;
uint32_t FaultCodeList [MaxFaultCode];
uint32_t Get_FaultCodeDtc1(void)
{
uint32_t u16FaultCode = 0x0000;
......@@ -122,24 +126,25 @@ uint32_t Get_FaultCodeDtc2(void)
return u16FaultCode;
}
uint16_t Get_FaultCodeNum(void)
{
uint16_t u16FaultCode = 0x0000;
u16FaultCode = Get_CAN_CH0_ID_402_Sig_ECU_DTCAmnt();
return u16FaultCode;
}
uint16_t Get_FaultCodeValid(void)
{
return 1;
}
//uint16_t Get_FaultCodeNum(void)
//{
// uint16_t u16FaultCode = 0x0000;
//
// u16FaultCode = Get_CAN_CH0_ID_402_Sig_ECU_DTCAmnt();
// return u16FaultCode;
//}
//
//uint16_t Get_FaultCodeValid(void)
//{
// return 1;
//}
/**
* @brief 故障码初始化函数
*/
void FaultCode_Init(void)
{
#if 0
uint16_t i = 0;
for (i = 0; i < MaxFaultCode; i++)
{
......@@ -159,8 +164,12 @@ void FaultCode_Init(void)
u16FaultCodeDtcCountBack = 0;
u8FaultCodeValid = 0;
#endif
List_Init(&FaultCode_t, FaultCodeList, (uint8_t)MaxFaultCode);
}
#if 0
/**
* @brief 查询当前故障码是否存在
* @param u32FaultCode 故障码
......@@ -333,16 +342,157 @@ void FaultCode_Service(uint16_t Cycle)
u16FaultCodeDtcCountBack = 0;
}
}
#endif
#if 1
uint8_t List_Init(FaultCodeList_t *CodeList, uint32_t Arr[], uint8_t Len)
{
if((CodeList == NULL) || (Arr == NULL))
{
return 2;//空指针,初始化失败
}
if(Len < 1)
{
return 1;//列表空
}
CodeList->code_list = Arr;
CodeList->len = Len;
CodeList->hade = 0;
CodeList->code_num = 0;
CodeList->tail = 0;
CodeList->disp = 0;
return 0;
}
uint8_t List_Find(FaultCodeList_t *CodeList, uint32_t FaultCode)
{
if(CodeList == NULL)
{
return 2;
}
for(int i=CodeList->hade; i<CodeList->tail; i++)
{
if(CodeList->code_list[i] == FaultCode)
{
return 1;
}
}
return 0;
}
uint8_t List_add(FaultCodeList_t *CodeList, uint32_t FaultCode)
{
if(CodeList == NULL)
{
return 3;
}
if((CodeList->tail+1) >= CodeList->len)
{
return 1;//列表满
}
if(List_Find(CodeList, FaultCode) != 0)
{
return 2;//已存在
}
// if(CodeList->code_num <= (CodeList->tail - CodeList->hade))
// {
// return 3;
// }
CodeList->code_list[CodeList->tail] = FaultCode;
CodeList->tail++;
return 0;
}
uint8_t List_Clear(FaultCodeList_t *CodeList)
{
if(CodeList == NULL)
{
return 2;
}
CodeList->hade = 0;
CodeList->tail = 0;
//CodeList->disp = 0;
//CodeList->code_num = 0;
return 0;
}
uint8_t List_GetNum(FaultCodeList_t *CodeList)
{
if(CodeList == NULL)
{
return 0;
}
return CodeList->tail - CodeList->hade;
}
uint16_t FaultTimeCount = 0;
//10ms
void FaultCode_Servers(void)
{
FaultTimeCount++;
uint16_t FaultCodeNum = Get_CAN_CH0_ID_402_Sig_ECU_DTCAmnt();
if(FaultCode_t.code_num != FaultCodeNum)//故障码数量变化,清空
{
FaultCode_t.code_num = FaultCodeNum;
List_Clear(&FaultCode_t);
}
if((List_GetNum(&FaultCode_t) > FaultCodeNum) )//故障码变化,清空
{
List_Clear(&FaultCode_t);
}
if(FaultCodeNum != 0)
{
List_add(&FaultCode_t, Get_FaultCodeDtc1());
if(FaultCodeNum > 1)
{
List_add(&FaultCode_t, Get_FaultCodeDtc2());
}
}
//else
//{
// //List_Clear(&FaultCode_t);//故障码
//}
}
uint32_t List_Display(FaultCodeList_t *CodeList, uint16_t *TimeCount)
{
if((CodeList == NULL) || (TimeCount == NULL))
{
return 0;
}
if(List_GetNum(CodeList) == 0)
{
return 0;
}
if(*TimeCount >= 500)
{
*TimeCount = 0;
if(++(CodeList->disp) >= (CodeList->tail))
{
CodeList->disp = CodeList->hade;
}
}
return CodeList->code_list[CodeList->disp];
}
#endif
/**
* @brief 获取当前故障码
*/
uint32_t Get_Current_FaultCode(void)
{
return stFaultCode[0].u16FaultCode;
//return stFaultCode[0].u16FaultCode;
return List_Display(&FaultCode_t, &FaultTimeCount);
}
uint8_t Get_FaultCode_Valid(void)
{
return u8FaultCodeValid;
}
// uint8_t Get_FaultCode_Valid(void)
// {
// return u8FaultCodeValid;
// }
......@@ -16,44 +16,58 @@
#define MaxFaultCode 72
#define FaultCodeCount 5000
typedef enum
{
DTC_1,
DTC_2,
DTC_3,
NUM_FAULT_TYPES,
} FaultCodeType_Num;
typedef uint32_t (*FaultCodeCallback)(void); /* 故障码回调函数 */
typedef uint16_t (*FaultCodeNumback)(void); /* 故障码个数回调函数 */
typedef uint16_t (*FaultCodeValidback)(void); /* 故障码有效回调函数 */
typedef struct __attribute__((aligned(4)))
{
uint32_t u16FaultCode; /* 故障码 */
uint16_t u16FaultCodeCount; /* 故障码总数 */
} _st_FaultCode;
typedef struct __attribute__((aligned(4)))
{
FaultCodeCallback callbacks[NUM_FAULT_TYPES];
FaultCodeNumback FaultCodeNumCbk;
FaultCodeValidback FaultCodeVaildCbk;
} _st_Init;
extern void FaultCode_Service(uint16_t Cycle);
extern void FaultCode_Init(void);
uint32_t *code_list;
uint8_t hade;
uint8_t tail;
uint8_t code_num;
uint8_t len;
uint8_t disp;
}FaultCodeList_t;
//typedef enum
//{
// DTC_1,
// DTC_2,
// DTC_3,
// NUM_FAULT_TYPES,
//} FaultCodeType_Num;
//
//typedef uint32_t (*FaultCodeCallback)(void); /* 故障码回调函数 */
//typedef uint16_t (*FaultCodeNumback)(void); /* 故障码个数回调函数 */
//typedef uint16_t (*FaultCodeValidback)(void); /* 故障码有效回调函数 */
//
//typedef struct __attribute__((aligned(4)))
//{
// uint32_t u16FaultCode; /* 故障码 */
// uint16_t u16FaultCodeCount; /* 故障码总数 */
//} _st_FaultCode;
//
//
//
//typedef struct __attribute__((aligned(4)))
//{
// FaultCodeCallback callbacks[NUM_FAULT_TYPES];
// FaultCodeNumback FaultCodeNumCbk;
// FaultCodeValidback FaultCodeVaildCbk;
//
//} _st_Init;
//
//
//
//
//extern void FaultCode_Service(uint16_t Cycle);
//
//extern void FaultCode_Init(void);
extern uint32_t Get_Current_FaultCode(void);
extern uint8_t Get_FaultCode_Valid(void);
//extern uint8_t Get_FaultCode_Valid(void);
uint8_t List_Init(FaultCodeList_t *CodeList, uint32_t Arr[], uint8_t Len);
void FaultCode_Servers(void);
#endif
\ No newline at end of file
......@@ -483,6 +483,7 @@ void Menu_u8Data_Updata_Process(uint8_t updateDir , uint8_t datMax, uint8_t datM
*dat = temp;
}
//extern uint8_t TCS_Init_flag_220;
void MenuData_Unit_Init(void)
{
uint8_t TCS[1] = {0};
......@@ -492,6 +493,7 @@ void MenuData_Unit_Init(void)
//MenuData.Tpms_Unit = 0;
MenuData.Tcs_Val = TCS[0];
//TCS_Init_flag_220 = 1;
}
void MenuData_TCS_Init(void)
{
......@@ -502,6 +504,8 @@ void MenuData_TCS_Init(void)
PageType = Page_Menu;
Hour_Set = 0;
Minute_Set = 0;
//TCS_Init_flag_220 = 1;
}
uint8_t ClearODO_Flag = 0;
......@@ -513,7 +517,7 @@ void TYW_RESET_ODO(void)
{
if(ClearODO_Flag < 1)
{
if((Get_DispVechileSpeed() >= 1990)&&(Get_DispEngineSpeed() >= 12000))
if((Get_ActualVechileSpeed()/*Get_DispVechileSpeed()*/ >= 1990)&&(Get_DispEngineSpeed() >= 12000))
{
ClearODO_Flag = 1;
Data_Mileage_Clear();
......
......@@ -252,6 +252,7 @@ void delay(uint16_t u16Count)
__NOP();
__NOP();
__NOP();
/* __NOP();
__NOP();
__NOP();
__NOP();
......@@ -653,7 +654,7 @@ void delay(uint16_t u16Count)
__NOP();
__NOP();
__NOP();
__NOP();
*/
}
}
......
......@@ -9,7 +9,6 @@ Mileage_t g_ReadMileage;
uint8_t odo_writeState;
uint8_t odo_readState;
uint32_t Milleage_InitFlag = 0U;
/******************************************************************************
Function:Data_ODO_KL30Init
Description:
......@@ -19,6 +18,7 @@ uint32_t Milleage_InitFlag = 0U;
void Data_User_Mileage_KL30Init(void)
{
uint32_t TempBuf[20] = {0};
uint8_t TempBufUser[20] = {0};
Mileage_Init_t MileInit = {0};
Mileage_Func_t Func = {0};
ODO_Init_t ODOInit = {0};
......@@ -98,8 +98,8 @@ void Data_User_Mileage_KL30Init(void)
Data_Trip_KL30_Init(DataTripBuf, TripInit, EM_TRIP_MAX, Func.EEPromWrite_Cbk);
//Data_User_EEPROM_Read(EM_MenuData_Tcs_Val, TempBuf, 1u);
eeprom_ReadRecord(EEPROM_BLOCK_08, (uint8_t *)TempBuf, 1);
if (TempBuf[0u] == 0xFFFFFFFF)
eeprom_ReadRecord(EEPROM_BLOCK_08, (uint8_t *)TempBufUser, 1);
if (TempBufUser[0u] == 0xFF)
{
MenuData.Tcs_Val = 1;
//Data_User_EEPROM_Write(EM_MenuData_Tcs_Val, &MenuData.Tcs_Val, 1u);
......@@ -107,8 +107,8 @@ void Data_User_Mileage_KL30Init(void)
}
//Data_User_EEPROM_Read(EM_MenuData_TPMS_LEARN, TempBuf, 1u);
eeprom_ReadRecord(EEPROM_BLOCK_09, (uint8_t *)TempBuf, 2);
if (TempBuf[0u] == 0xFFFFFFFF)
eeprom_ReadRecord(EEPROM_BLOCK_09, (uint8_t *)TempBufUser, 2);
if (TempBufUser[0u] == 0xFF)
{
TPMSLearn[0] = 0;//MenuData.TPMS_Front_Learn;
TPMSLearn[1] = 0;//MenuData.TPMS_Rear_Learn;
......@@ -143,7 +143,7 @@ uint32_t Get_MileageInit_Status(void)
return Milleage_InitFlag;
}
uint32_t Data_User_EEPROM_Read(uint16_t u16BlockID, uint32_t u32Data[], uint16_t u16Len)
uint32_t Data_User_EEPROM_Read(uint16_t u16BlockID, uint32_t u32Data[], uint16_t u16Len)
{
switch (u16BlockID)
{
......
......@@ -23,6 +23,7 @@ static Power_Status_em Power_Stay_Sleep(void);
extern uint8_t u8LEDDriverCheckCount;
static const st_PowerGroup g_stPwrTasks = {
Power_KL30_Init,
Power_IG_OFF_Init,
......@@ -42,28 +43,20 @@ void PwrMemInit(void)
PowerMemInit(&g_stPwrTasks);
}
extern uint8_t Power_KL30_Init_flag;
extern uint8_t AliveCount_KL30_ResettingFlag;
static void Power_KL30_Init(void)
{
CAN_TX_Flag_Init();
ClearODO_Flag = 0;
Gpio_Init(Gpio_KL30_Init);
Simulated_IIC_2_Init();
eeprom_StoreInfo_Init();
Can_Init();
Can_Init();
Data_TPMS_KL30_Init ();
CAN_TX_Count_Init();
CAN_TX_Init();
CAN_TX_SetEnable(&CAN_CH0_CanMsgTxOp, CAN_N_TX_Enable);
//CAN_TX_SetEnable(&CAN_CH0_CanMsgTxOp, CAN_N_TX_Enable);
DFlash_init();
Data_Read_DiagPara();
Analog_Signal_Conv_Init();
......@@ -109,6 +102,8 @@ static void Power_KL30_Init(void)
// Data_TPMS_Processing_Service();
Common_DataInit();
Power_KL30_Init_flag = 1;
AliveCount_KL30_ResettingFlag = 1;
}
extern uint32_t PowerIgnOffTimeLine;
static void Power_Wakeup_Init(void)
......@@ -127,18 +122,11 @@ static void Power_Wakeup_Init(void)
BU98R10_Init();
Sys_WakeUp_Init();
Data_TPMS_KL15_WAKE_UP_Init();
CanMSg_XMS_Analysis(&CAN_CH0_CanMsgOp,2u);
CanMSg_XMS_Analysis(&CAN_CH0_CanMsgOp,2u);
CanMSg_XMS_Analysis(&CAN_CH0_CanMsgOp,2u);
Data_TPMS_Processing_Service();
//CAN_TX_Count_Init();
CAN_TX_Init();
CAN_TX_Count_Init();
CAN_TX_SetEnable(&CAN_CH0_CanMsgTxOp, CAN_N_TX_Enable);
//CAN_TX_SetEnable(&CAN_CH0_CanMsgTxOp, CAN_N_TX_Enable);
Data_Vehicle_Speed_KL30_Init();
Data_Vehicle_Speed_Wakeup_Init();
......@@ -171,6 +159,8 @@ static void Power_Wakeup_Init(void)
Service_Interval_User_WakeupInit();
Common_DataInit();
Power_KL30_Init_flag = 1;
}
static void Power_LVP_Init(void)
......@@ -191,7 +181,7 @@ static void Power_IG_OFF_Init(void)
static void Power_IG_ON_Init(void)
{
Checkself_Init();
Checkself_Init();
Line_In_KL15_ON_Init();
Telltales_KL15_Init();
Telltales_UserInit();
......@@ -218,7 +208,7 @@ static void Power_Sleep_Init(void)
//TimerM_PWM_CH_Output_init(TIMERM_COUNTER0, TIMERM_CHD, ActiveLevel_High);
//TimerM_PWM_CH_Output_init(TIMERM_COUNTER1, TIMERM_CHB, ActiveLevel_High);
//RTC_Stop();
rte_can_deinit(CAN_CH_0);
rte_can_deinit(CAN_CH_0);
TMM0_Stop();
TMM1_Stop();
TMM_All_Stop();
......@@ -368,5 +358,5 @@ void Sys_Startup_Init(void)
uint8_t u8StartuoMode = 0;
PwrMemInit( );
Power_Management_Init(u8StartuoMode);
}
}
......@@ -166,27 +166,34 @@ uint16_t ADC_Converse(ADC_Channel_t ch, uint32_t times, uint16_t *buf)
volatile uint8_t flag;
uint32_t total = 0;
INTC_DisableIRQ(ADC_IRQn); // disable INTAD interrupt
if(times == 0)
{
return 0;
}
else
{
INTC_DisableIRQ(ADC_IRQn); // disable INTAD interrupt
ADC->ADM0 &= ~ADC_Enable;
ADC->ADM0 &= ~ADC_Enable;
ADC->ADM1 |= ADC_Conv_Oneshot; //enable one-shot convertion
ADC->ADTRG = ADC_ExternalTrig_Software;
ADC->ADM0 |= ADC_Enable;
ADC->ADM1 |= ADC_Conv_Oneshot; //enable one-shot convertion
ADC->ADTRG = ADC_ExternalTrig_Software;
ADC->ADM0 |= ADC_Enable;
ADC->ADS = ch;
ADC->ADS = ch;
for(i=0; i<times;i++)
{
ADC->ADM0 |= ADC_Start_Cmp; //adc start
while(INTC_GetPendingIRQ(ADC_IRQn) == 0);
INTC_ClearPendingIRQ(ADC_IRQn); // clear INTAD interrupt flag
for(i=0; i<times;i++)
{
ADC->ADM0 |= ADC_Start_Cmp; //adc start
while(INTC_GetPendingIRQ(ADC_IRQn) == 0);
INTC_ClearPendingIRQ(ADC_IRQn); // clear INTAD interrupt flag
*buf++ = ADC->ADCR;
total += ADC->ADCR;
*buf++ = ADC->ADCR;
total += ADC->ADCR;
}
return (total / times); // return average value
}
return (total / times); // return average value
}
......
......@@ -161,7 +161,7 @@ void RTE_RTC_Init(RTC_Information_st_t g_stRTCInformation)
RTC_InitStructure.RTC_1HZ_Output = DISABLE; //RTC1HZ diable output
RTC_Init(&RTC_InitStructure);
RTC->SUBCUD = 0x1F;
RTC->SUBCUD = 0x18;
//ISR_Register(RTC_IRQn, rtc_interrupt); //RTC????��????��??��??��
......
......@@ -17,7 +17,7 @@ void Sys_Pseudo_Real_Time_Tasks(void)
void Sys_2ms_Tasks(void)
{
Common_Input_Para();
Common_Input_Para();
//Can_Write_Fun(&CAN_CH0_CanMsgTxOp, 2000u);
Sys_Status_Update_Service();
Analog_Signal_Conv_Service();
......@@ -57,12 +57,13 @@ void Sys_10ms_Tasks(void)
Protocol_Service();
Protocol_Send_Service();
FaultCode_Service(10u);
//FaultCode_Service(10u);
FaultCode_Servers();
}
void Sys_20ms_Tasks(void)
{
//Key_Clear_Time();
//Key_Clear_Time();
//Key_Auto_Save();
Data_Vehicle_Speed_Processing_Service();
Data_Engine_Speed_Processing_Service();
......@@ -74,7 +75,7 @@ void Sys_20ms_Tasks(void)
void Sys_50ms_Tasks(void)
{
LED_Driver_Scan_Refresh();
Telltales_Management();
Gauge_Service();
......
......@@ -312,13 +312,13 @@
#define CheckSumErr 7 // Checksum Error
#define UnknownPartID 8 // Unknown Part ID
#define SWV 0x121 // 0x100 = 1.00 software version 软件版本号
#define SWV 0x122 // 0x100 = 1.00 software version 软件版本号
#define HWV 0x103 // 0x100 = 1.00 hardware version 硬件版本号
#define BTV 0x100 // 0x100 = 1.00 bootloader version boot程序版本号
#define INTLV 0x121 // 0x100 = 1.00 internal version 内部版本号
#define INTLV 0x122 // 0x100 = 1.00 internal version 内部版本号
#define PROG_Y 0x24 // 0x24 = 2024年, program year
#define PROG_M 0x09 // 0x03 = 3月, program month
#define PROG_D 0x14 // 0x19 = 19日, program day
#define PROG_D 0x19 // 0x19 = 19日, program day
/******************************************************************************
Bootloader Variable
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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