Commit ea2bb0b7 authored by 高士达's avatar 高士达

Merge branch 'lijianshuang' into 'dev'

Lijianshuang

See merge request !31
parents 6a066f61 81fc3a52
......@@ -339,7 +339,7 @@
<MiscControls></MiscControls>
<Define>USE_STDPERIPH_DRIVER,BAT32G139_64PIN</Define>
<Undefine></Undefine>
<IncludePath>..\..\..\..\Source\Device\Cmsemicon\BAT32A239\RTE;..\..\..\..\Source\Component;..\..\..\..\Source\Device\Cmsemicon\BAT32A239\Library\Driver\include;..\..\..\..\Source\Device\Cmsemicon\BAT32A239\Library\Device\Include;..\..\..\..\Source\Application;..\..\..\..\Source;..\..\..\..\Source\Component\LED_Driver;..\..\..\..\Source\UDS</IncludePath>
<IncludePath>..\..\..\..\Source\Device\Cmsemicon\BAT32A239\RTE;..\..\..\..\Source\Component;..\..\..\..\Source\Device\Cmsemicon\BAT32A239\Library\Driver\include;..\..\..\..\Source\Device\Cmsemicon\BAT32A239\Library\Device\Include;..\..\..\..\Source\Application;..\..\..\..\Source;..\..\..\..\Source\Component\LED_Driver;..\..\..\..\Source\UDS;..\..\..\..\Source\Component\System_Monitor</IncludePath>
</VariousControls>
</Cads>
<Aads>
......
......@@ -18,6 +18,7 @@
#include "Data_TPMS/Data_TPMS.h"
#include "Data_Voltage/Data_Voltage.h"
#include "FaultCode/FaultCode.h"
#include "FaultCode/code.h"
#include "BLUETOOTH/BlueTooth.h"
#include "BLUETOOTH/Protocol_CRC16.h"
#include "BLUETOOTH/Protocol_Lib.h"
......
......@@ -12,6 +12,8 @@ void BlueTooth_KL30_KL15_Wakeup_Init(void)
void Send_UUID_To_Esp32(void)
{
Protocol_Send(MCU_ESP32_0x03, UUIDData, 32);
//Protocol_Send(MCU_ESP32_0x03, Ser2EDataForDFlash.DID_F184, 32);
}
uint8_t Get_Navigation_St_Dis(void)
{
......
......@@ -10,7 +10,10 @@
#define MCU_ESP32_0x20 0x20 //蓝牙模组启动后,MCU回复ID
#define ESP32_MCU_0x01 0x01 //ESP32发送蓝牙导航信息的ID
#define ESP32_MCU_0x12 0x12 //低功耗蓝牙启动状态及蓝牙名称
#define ESP32_MCU_0x05 0x05 //esp32版本号
#define MCU_ESP32_0x03 0x03 //MCU发送UUID
#define ESP32_MCU_0x02 0x02 //ESP32发送重启请求
#define MCU_ESP32_0x04 0x04 //MCU发送重启命令
enum
{
BLUE_STATE_Starting, //蓝牙模组启动中
......@@ -23,7 +26,9 @@ typedef struct __attribute__((aligned(4)))
uint8_t Navigation_St;/*导航状态 0x35 未导航或导航结束 0x33 正在导航*/
uint8_t Navigation_Code;/*蓝牙导向编码*/
uint32_t Navigation_Mileage;/*剩余里程*/
uint8_t BLE_St;
uint8_t BLE_St;
uint8_t ESP32_Reset;
uint8_t ESP32_SWV;
} BlueTooth_t;
typedef enum __attribute__((aligned(4)))
......
#include "Protocol_User.h"
#include "RTE.h"
#include "System_Monitor_User.h"
#define UART_TX_MAX_DEPTH 1024UL //(2 * 1024UL) // 4K
#define UART_RX_MAX_DEPTH (2 * 1024UL) // 4K
......@@ -169,7 +169,7 @@ static Protocol_uint32_t Protocol_UartSend(const Protocol_uint8_t *pData, Protoc
static void Protocol_UartHandle(const Protocol_Data_t *pData)
{
uint8_t ID04[1] = {0};
if ( pData->CmdID == ESP32_MCU_0x10 )
{
BlueTooth.BlueTooth_St = pData->Data[0];
......@@ -182,6 +182,28 @@ static void Protocol_UartHandle(const Protocol_Data_t *pData)
{
BlueTooth.BLE_St = pData->Data[0];
}
else if ( pData->CmdID == ESP32_MCU_0x05 )
{
BlueTooth.ESP32_SWV = pData->Data[0];
}
else if ( pData->CmdID == ESP32_MCU_0x02 )
{
BlueTooth.ESP32_Reset = pData->Data[0];
if (BlueTooth.ESP32_Reset == 1)
{
ID04[0] = 1;
Protocol_Send(MCU_ESP32_0x04, ID04, 1);
}
else if(BlueTooth.ESP32_Reset == 2)
{
__NVIC_SystemReset();
}
else
{
;
}
}
else if(pData->CmdID == ESP32_MCU_0x01 )
{
if (pData->Data[0] == 0x33)
......
......@@ -79,6 +79,16 @@ const st_CANMsgAttribute CAN_CH0_CAN_MSG_CONST_ARRAY[CAN_CH0_ID_TOTAL_MAX] =
(( void * )0),
(( void * )0),
},
{
{0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u},
{0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u},
{0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u},
2000ul,
0x373ul,
(( void * )0),
(( void * )0),
(( void * )0),
},
};
uint8_t Get_CAN_CH0_ID_402_Sig_ECU_Warning_Lamp(void)
......@@ -357,7 +367,20 @@ uint8_t Get_CAN_CH0_ID_101_Sig_ECU_101_Checksum(void)
{
return (((uint8_t)((uint8_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x101_Msg_Count, 7u) >> 0u) & 0xFFu));
}
uint32_t Get_CAN_CH0_ID_373_Sig_Front_id(void)
{
return (((uint32_t)((uint32_t)((uint32_t)((uint32_t)((uint32_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x373_Msg_Count, 0u) >> 0u) & 0xFFu) << 8u) + \
((uint32_t)((uint32_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x373_Msg_Count, 1u) >> 0u) & 0xFFu) << 8u) + \
((uint32_t)((uint32_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x373_Msg_Count, 2u) >> 0u) & 0xFFu) << 8u) + \
((uint32_t)((uint32_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x373_Msg_Count, 3u) >> 0u) & 0xFFu));
}
uint32_t Get_CAN_CH0_ID_373_Sig_Rear_id(void)
{
return (((uint32_t)((uint32_t)((uint32_t)((uint32_t)((uint32_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x373_Msg_Count, 4u) >> 0u) & 0xFFu) << 8u) + \
((uint32_t)((uint32_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x373_Msg_Count, 5u) >> 0u) & 0xFFu) << 8u) + \
((uint32_t)((uint32_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x373_Msg_Count, 6u) >> 0u) & 0xFFu) << 8u) + \
((uint32_t)((uint32_t)CAN_MSG_Read(CAN_CH0,CAN_CH0_ID_CAN_0x373_Msg_Count, 7u) >> 0u) & 0xFFu));
}
uint8_t Co_Can_ConvertSubID_CAN_CH0(uint32_t MsgID)
{
uint8_t u8Result = CAN_CH0_ID_TOTAL_MAX;
......@@ -381,6 +404,9 @@ uint8_t Co_Can_ConvertSubID_CAN_CH0(uint32_t MsgID)
case CAN_CH0_ID_CAN_0x101_Msg:
u8Result = CAN_CH0_ID_CAN_0x101_Msg_Count;
break;
case CAN_CH0_ID_CAN_0x373_Msg:
u8Result = CAN_CH0_ID_CAN_0x373_Msg_Count;
break;
default :
u8Result = CAN_CH0_ID_TOTAL_MAX;
break;
......
......@@ -14,6 +14,7 @@ typedef enum
CAN_CH0_ID_CAN_0x401_Msg_Count,
CAN_CH0_ID_CAN_0x120_Msg_Count,
CAN_CH0_ID_CAN_0x101_Msg_Count,
CAN_CH0_ID_CAN_0x373_Msg_Count,
CAN_CH0_ID_TOTAL_MAX,
} CAN_CH0_CAN_MSG_ID_t;
......@@ -40,6 +41,7 @@ extern const st_CAN_SendAttribute CAN_CH0_CANSendAttr[CAN_CH0_ID_SEND_TOTAL]
#define CAN_CH0_ID_CAN_0x220_Msg 0x220ul
#define CAN_CH0_ID_CAN_0x120_Msg 0x120ul
#define CAN_CH0_ID_CAN_0x101_Msg 0x101ul
#define CAN_CH0_ID_CAN_0x373_Msg 0x373ul
extern uint8_t Get_CAN_CH0_ID_402_Sig_ECU_Warning_Lamp(void);
extern uint8_t Get_CAN_CH0_ID_402_Sig_ECU_DTCL2(void);
......@@ -95,6 +97,8 @@ extern uint8_t Get_CAN_CH0_ID_101_Sig_ECU_Engine_Speed_State(void);
extern uint16_t Get_CAN_CH0_ID_101_Sig_ECU_Engine_Speed(void);
extern uint8_t Get_CAN_CH0_ID_101_Sig_ECU_101_Livecounter(void);
extern uint8_t Get_CAN_CH0_ID_101_Sig_ECU_101_Checksum(void);
extern uint32_t Get_CAN_CH0_ID_373_Sig_Front_id(void);
extern uint32_t Get_CAN_CH0_ID_373_Sig_Rear_id(void);
extern uint8_t Co_Can_ConvertSubID_CAN_CH0(uint32_t MsgID);
......
......@@ -34,22 +34,22 @@ void Can_Set_Buff_6EE(canlib_uint8_t CopyData[])
p6EE->Msg [ i ] = 0xFFu;
}
}
p6EE -> Sig.Vsppe_H3_TX = (Vspeed_tx >> 8) & 0x7u ;
p6EE -> Sig.Vsppe_L8_TX = Vspeed_tx & 0xFF ;
//p6EE -> Sig.Vsppe_H3_TX = (Vspeed_tx >> 8) & 0x7u ;
//p6EE -> Sig.Vsppe_L8_TX = Vspeed_tx & 0xFF ;
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 ;
p6EE -> Sig.Uint_TX = Get_Dis_KM_Unit() ;
p6EE -> Sig.Coolant_Seg_TX = GET_DataCoolantTempSegDisp() ;
if (GET_DataCollantTempWarnflg() == 2)
{
p6EE -> Sig.Coolant_Warn_TX = 1;
}
else
{
p6EE -> Sig.Coolant_Warn_TX = 0;
}
p6EE -> Sig.Fuel_Seg_TX = Get_CurFuelSetp() ;
// p6EE -> Sig.Uint_TX = Get_Dis_KM_Unit() ;
// p6EE -> Sig.Coolant_Seg_TX = GET_DataCoolantTempSegDisp() ;
//if (GET_DataCollantTempWarnflg() == 2)
//{
// p6EE -> Sig.Coolant_Warn_TX = 1;
//}
//else
//{
// p6EE -> Sig.Coolant_Warn_TX = 0;
//}
//p6EE -> Sig.Fuel_Seg_TX = Get_CurFuelSetp() ;
if(Get_Fuel_RES() > 255)
{
p6EE -> Sig.Fuel_Res_TX = 0xFF ;
......@@ -77,10 +77,10 @@ void Can_Set_Buff_6EF(canlib_uint8_t CopyData[])
p6EF->Msg [ i ] = 0xFFu;
}
}
p6EF -> Sig.Espeed_TX = Espeed_tx;
//p6EF -> Sig.Espeed_TX = Espeed_tx;
p6EF -> Sig.TripA_H = (TripA_tx >> 8) & 0xFF;
p6EF -> Sig.TripA_L = TripA_tx & 0xFF;
p6EF -> Sig.Coolant_TX = GET_DataCoolantTempValueDisp() + 40;
//p6EF -> Sig.Coolant_TX = GET_DataCoolantTempValueDisp() + 40;
}
void Can_Set_Buff_450(canlib_uint8_t CopyData[])
{
......@@ -121,7 +121,7 @@ void Can_Set_Buff_580(canlib_uint8_t CopyData[])
p580 -> Sig.TPMS_LEARN_CND_BYTE3 = 0x08;
p580 -> Sig.TPMS_LEARN_CND_BYTE4 = 0x00;
}
else if(Get_Tpms_TX_Flag() == 1)
else if(Get_Tpms_TX_Flag() == 2)
{
p580 -> Sig.TPMS_LEARN_CND_BYTE0 = 0x31;
p580 -> Sig.TPMS_LEARN_CND_BYTE1 = 0x01;
......
......@@ -90,6 +90,15 @@ void Can_RX_Apply_Buff(void)
CAN_MessageCache_Init(CAN0MSG11, &CAN_RecvMsg);
CAN_MessageCache_OverWriteConfig(CAN0MSG11, ENABLE);
CAN_RecvMsg.Id = 0x373;
CAN_RecvMsg.IDE = CAN_Id_Standard;
CAN_RecvMsg.CacheType = CAN_CacheType_Rx_NoMask;
CAN_RecvMsg.RTR = CAN_RTR_Data;
CAN_RecvMsg.Interrupt = ENABLE;
CAN_MessageCache_DeInit(CAN0MSG15);
CAN_MessageCache_Init(CAN0MSG15, &CAN_RecvMsg);
CAN_MessageCache_OverWriteConfig(CAN0MSG15, ENABLE);
CAN_RecvMsg.Id = DIAG_ID_Rx_PHY;
CAN_RecvMsg.IDE = CAN_Id_Standard;
CAN_RecvMsg.CacheType = CAN_CacheType_Rx_NoMask;
......@@ -335,9 +344,11 @@ void Can_Write(st_CAN_Msg *Msg)
case 0x220:
CAN_Transmit(CAN0MSG10, &CAN_SendMsg);
break;
#if (IC_Current == TY200_080000b_ty)
case 0x580:
CAN_Transmit(CAN0MSG14, &CAN_SendMsg);
break;
#endif
default:
break;
}
......
......@@ -11,10 +11,10 @@
#define DATA_ENGINE_RUNNING_THRESHOLD 400 //发动机运转阈值
#define DATA_ENGINE_STOP_THRESHOLD 300 //发动机停止阈值
#define DATA_ESPEED_DAMPING_FACTOR 4 //阻尼系数
#define DATA_ESPEED_DAMPING_FACTOR 3 //阻尼系数
#define DATA_ESPEED_INC_STEP 10 //速度增加时慢加速速度变化步长
#define DATA_ESPEED_DEC_STEP 20 //方向改变时急减速速度变化步长
#define DATA_ESPEED_APPR_SPEED_MIN 10 //最小逼近速度
#define DATA_ESPEED_APPR_SPEED_MIN 25 //最小逼近速度
#define DATA_ESPEED_HYSTERESIS 80 //回差
/*** 控制结构 ***/
......
......@@ -10,8 +10,10 @@ typedef struct __attribute__((aligned(4)))
uint8_t Rear_TPMS_Valid;
uint8_t TPMS_Warning;
uint8_t TPMS_Unit;
uint32_t TPMS_Front_Learn;
uint32_t TPMS_Rear_Learn;
uint8_t TPMS_Front_Learn;
uint8_t TPMS_Rear_Learn;
uint8_t TPMS_Front_FirstLearn_Flag;
uint8_t TPMS_Rear_FirstLearn_Flag;
}_TPMS_Display;
typedef enum
......@@ -32,4 +34,6 @@ uint16_t Get_Rear_TPMS_Sig_Value (void);
uint16_t Get_Rear_TPMS_TX (void);
uint16_t Get_Front_TPMS_TX (void);
void Data_TPMS_KL15_WAKE_UP_Init ( void );
uint8_t Get_Front_FirstLearn_Flag (void);
uint8_t Get_Rear_FirstLearn_Flag (void);
#endif
#include "FaultCode\FaultCode.h"
#include "Application.h"
uint8_t DTC_Amnt_Number = 0;
uint8_t DTC_Amnt_Number_Count = 0;
uint8_t FaultCode_Number = 0;
uint8_t DTC_Amnt_Number = 0;
uint8_t DTC_Amnt_Number_Count = 0;
uint8_t FaultCode_Number = 0;
uint32_t DTC_Data[FualtCodeMax] = {0};
uint32_t DTC_Data_Count[FualtCodeMax] = {0};
uint32_t FaultCode_Data[FualtCodeMax] = {0};
uint32_t DTC_Data[FualtCodeMax] = {0};
uint32_t DTC_Data_Count[FualtCodeMax] = {0};
uint32_t FaultCode_Data[FualtCodeMax] = {0};
uint32_t u32Countbuf = 0UL;
void Fault_Code_Receive(uint8_t CopyData[])
{
uint8_t i = 0;
ECU_FaultCode_Processing_Service();
//ECU_FaultCode_Processing_Service();
}
uint8_t FaultCode_Compare(uint32_t FaultCode, uint32_t* CodeList, uint8_t len)
uint8_t FaultCode_Compare(uint32_t FaultCode, uint32_t *CodeList, uint8_t len)
{
uint8_t i = 0;
uint8_t result = 0;
for(i = 0; i < len; i++)
uint8_t result = 0;
for (i = 0; i < len; i++)
{
if(FaultCode == CodeList[i])
if (FaultCode == CodeList[i])
{
result = 1;
}
......@@ -50,7 +50,10 @@ static void Fault_Code_App_SortNByte(uint32_t *SortData, uint8_t len)
}
}
}
void ECU_FaultCode_Processing_Service ( void )
uint32_t u32YZHDArray[200];
uint32_t u32YZHDArraycount = 0;
uint32_t u32YZHDCount=0;
void ECU_FaultCode_Processing_Service(void)
{
uint8_t DTCH1 = 0;
uint8_t DTCM1 = 0;
......@@ -58,20 +61,21 @@ void ECU_FaultCode_Processing_Service ( void )
uint8_t DTCM2 = 0;
uint32_t DTC1 = 0;
uint32_t DTC2 = 0;
uint32_t i = 0;
if ( Common_Get_IG_Sts() == COMMON_POWER_ON )
uint32_t i = 0;
if (Common_Get_IG_Sts() == COMMON_POWER_ON)
{
if(CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CAN_0x402_Msg_Count) == CAN_SIG_LOST)
if (CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CAN_0x402_Msg_Count) == CAN_SIG_LOST)
{
memset (FaultCode_Data, 0, FaultCode_Number);
memset(FaultCode_Data, 0, FaultCode_Number);
FaultCode_Number = 0;
}
else
{
DTCH1 = Get_CAN_CH0_ID_402_Sig_ECU_DTCH1();
DTCM1 = Get_CAN_CH0_ID_402_Sig_ECU_DTCM1();
DTCH2 = Get_CAN_CH0_ID_402_Sig_ECU_DTCH2();
DTCM2 = Get_CAN_CH0_ID_402_Sig_ECU_DTCM2();
u32YZHDCount = 0;
DTCH1 = Get_CAN_CH0_ID_402_Sig_ECU_DTCH1();
DTCM1 = Get_CAN_CH0_ID_402_Sig_ECU_DTCM1();
DTCH2 = Get_CAN_CH0_ID_402_Sig_ECU_DTCH2();
DTCM2 = Get_CAN_CH0_ID_402_Sig_ECU_DTCM2();
DTC_Amnt_Number = Get_CAN_CH0_ID_402_Sig_ECU_DTCAmnt();
if (((DTCH1 & 0xF0) >> 4) >= 0xA)
......@@ -80,7 +84,7 @@ void ECU_FaultCode_Processing_Service ( void )
}
else
{
DTC1 |= (DTCH1 & 0xF0) >> 4 ;
DTC1 |= (DTCH1 & 0xF0) >> 4;
}
DTC1 <<= 8;
if ((DTCH1 & 0xF) >= 0xA)
......@@ -89,17 +93,17 @@ void ECU_FaultCode_Processing_Service ( void )
}
else
{
DTC1 |= DTCH1 & 0xF ;
DTC1 |= DTCH1 & 0xF;
}
DTC1 <<= 8;
if (((DTCM1 & 0xF0) >> 4) >= 0xA)
{
DTC1 |= ((DTCM1 & 0xF0) >> 4) + 3;
}
else
{
DTC1 |= (DTCM1 & 0xF0) >> 4 ;
DTC1 |= (DTCM1 & 0xF0) >> 4;
}
DTC1 <<= 8;
if ((DTCM1 & 0xF) >= 0xA)
......@@ -108,7 +112,7 @@ void ECU_FaultCode_Processing_Service ( void )
}
else
{
DTC1 |= DTCM1 & 0xF ;
DTC1 |= DTCM1 & 0xF;
}
if (((DTCH2 & 0xF0) >> 4) >= 0xA)
......@@ -117,7 +121,7 @@ void ECU_FaultCode_Processing_Service ( void )
}
else
{
DTC2 |= (DTCH2 & 0xF0) >> 4 ;
DTC2 |= (DTCH2 & 0xF0) >> 4;
}
DTC2 <<= 8;
if ((DTCH2 & 0xF) >= 0xA)
......@@ -126,17 +130,17 @@ void ECU_FaultCode_Processing_Service ( void )
}
else
{
DTC2 |= DTCH2 & 0xF ;
DTC2 |= DTCH2 & 0xF;
}
DTC2 <<= 8;
if (((DTCM2 & 0xF0) >> 4) >= 0xA)
{
DTC2 |= ((DTCM2 & 0xF0) >> 4) + 3;
}
else
{
DTC2 |= (DTCM2 & 0xF0) >> 4 ;
DTC2 |= (DTCM2 & 0xF0) >> 4;
}
DTC2 <<= 8;
if ((DTCM2 & 0xF) >= 0xA)
......@@ -145,10 +149,9 @@ void ECU_FaultCode_Processing_Service ( void )
}
else
{
DTC2 |= DTCM2 & 0xF ;
DTC2 |= DTCM2 & 0xF;
}
if (DTC_Amnt_Number == 0)
{
for (i = 0; i < FualtCodeMax; i++)
......@@ -159,29 +162,29 @@ void ECU_FaultCode_Processing_Service ( void )
}
DTC_Amnt_Number_Count = 0;
}
if(DTC_Amnt_Number_Count < DTC_Amnt_Number)
if (DTC_Amnt_Number_Count < DTC_Amnt_Number)
{
if ((DTC1 != 0) && (FaultCode_Compare(DTC1, &DTC_Data_Count[0], DTC_Amnt_Number_Count) == 0))
{
DTC_Data_Count[DTC_Amnt_Number_Count] = DTC1;
DTC_Amnt_Number_Count ++;
DTC_Amnt_Number_Count++;
Fault_Code_App_SortNByte(DTC_Data_Count, DTC_Amnt_Number_Count);
}
}
if(DTC_Amnt_Number_Count < DTC_Amnt_Number)
if (DTC_Amnt_Number_Count < DTC_Amnt_Number)
{
if ((DTC2 != 0) && (FaultCode_Compare(DTC2, &DTC_Data_Count[0], DTC_Amnt_Number_Count) == 0))
{
DTC_Data_Count[DTC_Amnt_Number_Count] = DTC2;
DTC_Amnt_Number_Count ++;
DTC_Amnt_Number_Count++;
Fault_Code_App_SortNByte(DTC_Data_Count, DTC_Amnt_Number_Count);
}
}
if(DTC_Amnt_Number_Count > DTC_Amnt_Number)
if (DTC_Amnt_Number_Count > DTC_Amnt_Number)
{
for (i = 0; i < FualtCodeMax; i++)
{
//FaultCode_Data[i] = 0;
// FaultCode_Data[i] = 0;
DTC_Data_Count[i] = 0;
DTC_Data[i] = 0;
}
......@@ -189,7 +192,7 @@ void ECU_FaultCode_Processing_Service ( void )
}
if (DTC_Amnt_Number_Count == DTC_Amnt_Number)
{
for(i = 0; i < DTC_Amnt_Number_Count; i++)
for (i = 0; i < DTC_Amnt_Number_Count; i++)
{
DTC_Data[i] = DTC_Data_Count[i];
DTC_Data_Count[i] = 0;
......@@ -198,21 +201,25 @@ void ECU_FaultCode_Processing_Service ( void )
FaultCode_Number = DTC_Amnt_Number;
DTC_Amnt_Number_Count = 0;
for(i = 0; i < FaultCode_Number; i++)
for (i = 0; i < FaultCode_Number; i++)
{
if(FaultCode_Data[i] != DTC_Data[i])
if (FaultCode_Data[i] != DTC_Data[i])
{
FaultCode_Data[i] = DTC_Data[i];
Fault_Code_App_SortNByte(FaultCode_Data, FaultCode_Number);
}
}
}
if (u32YZHDArraycount < 200)
{
u32YZHDArray[u32YZHDArraycount++] = u32YZHDCount;
}
}
}
else
{
memset (FaultCode_Data, 0, FaultCode_Number);
memset(FaultCode_Data, 0, FaultCode_Number);
FaultCode_Number = 0;
}
}
......@@ -12,4 +12,5 @@ void ECU_FaultCode_Processing_Service ( void );
extern void Fault_Code_Receive(uint8_t CopyData[]);
static void Fault_Code_App_SortNByte(uint32_t *SortData, uint8_t len);
static void Fault_Code_App_Swap(uint32_t *pData1, uint32_t *pData2);
extern uint32_t u32YZHDCount;
#endif
#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;
uint32_t Get_FaultCodeDtc1(void)
{
uint32_t u16FaultCode = 0x0000;
uint8_t DTCH1 = 0;
uint8_t DTCM1 = 0;
uint32_t DTC1 = 0;
DTCH1 = Get_CAN_CH0_ID_402_Sig_ECU_DTCH1();
DTCM1 = Get_CAN_CH0_ID_402_Sig_ECU_DTCM1();
if (((DTCH1 & 0xF0) >> 4) >= 0xA)
{
DTC1 |= ((DTCH1 & 0xF0) >> 4) + 3;
}
else
{
DTC1 |= (DTCH1 & 0xF0) >> 4;
}
DTC1 <<= 8;
if ((DTCH1 & 0xF) >= 0xA)
{
DTC1 |= (DTCH1 & 0xF) + 3;
}
else
{
DTC1 |= DTCH1 & 0xF;
}
DTC1 <<= 8;
if (((DTCM1 & 0xF0) >> 4) >= 0xA)
{
DTC1 |= ((DTCM1 & 0xF0) >> 4) + 3;
}
else
{
DTC1 |= (DTCM1 & 0xF0) >> 4;
}
DTC1 <<= 8;
if ((DTCM1 & 0xF) >= 0xA)
{
DTC1 |= (DTCM1 & 0xF) + 3;
}
else
{
DTC1 |= DTCM1 & 0xF;
}
if (DTC1 == 0)
{
return 0XFFFF;
}
u16FaultCode = DTC1;
return u16FaultCode;
}
uint32_t Get_FaultCodeDtc2(void)
{
uint32_t u16FaultCode = 0x0000;
uint8_t DTCH2 = 0;
uint8_t DTCM2 = 0;
uint32_t DTC2 = 0;
DTCH2 = Get_CAN_CH0_ID_402_Sig_ECU_DTCH2();
DTCM2 = Get_CAN_CH0_ID_402_Sig_ECU_DTCM2();
if (((DTCH2 & 0xF0) >> 4) >= 0xA)
{
DTC2 |= ((DTCH2 & 0xF0) >> 4) + 3;
}
else
{
DTC2 |= (DTCH2 & 0xF0) >> 4;
}
DTC2 <<= 8;
if ((DTCH2 & 0xF) >= 0xA)
{
DTC2 |= (DTCH2 & 0xF) + 3;
}
else
{
DTC2 |= DTCH2 & 0xF;
}
DTC2 <<= 8;
if (((DTCM2 & 0xF0) >> 4) >= 0xA)
{
DTC2 |= ((DTCM2 & 0xF0) >> 4) + 3;
}
else
{
DTC2 |= (DTCM2 & 0xF0) >> 4;
}
DTC2 <<= 8;
if ((DTCM2 & 0xF) >= 0xA)
{
DTC2 |= (DTCM2 & 0xF) + 3;
}
else
{
DTC2 |= DTCM2 & 0xF;
}
if (DTC2 == 0)
{
return 0XFFFF;
}
u16FaultCode = DTC2;
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;
}
/**
* @brief 故障码初始化函数
*/
void FaultCode_Init(void)
{
uint16_t i = 0;
for (i = 0; i < MaxFaultCode; i++)
{
stFaultCode[i].u16FaultCode = 0;
stFaultCode[i].u16FaultCodeCount = 0;
stFaultCodeBack[i].u16FaultCode = 0;
stFaultCodeBack[i].u16FaultCodeCount = 0;
stFaultCodetemp[i].u16FaultCode = 0;
stFaultCodetemp[i].u16FaultCodeCount = 0;
}
FaultCodeInit.callbacks[DTC1] = Get_FaultCodeDtc1;
FaultCodeInit.callbacks[DTC2] = Get_FaultCodeDtc2;
FaultCodeInit.callbacks[DTC3] = NULL;
FaultCodeInit.FaultCodeVaildCbk = Get_FaultCodeValid;
FaultCodeInit.FaultCodeNumCbk = Get_FaultCodeNum;
u16FaultCodeDtcCountBack = 0;
u8FaultCodeValid = 0;
}
/**
* @brief 查询当前故障码是否存在
* @param u32FaultCode 故障码
* @param FaultCodeGrpup 故障码组
* @param len 故障码组长度
* @return 0:存在 1:不存在 2:无效故障码不存储
*/
uint8_t FaultCode_Check(const uint32_t u32FaultCode, const _st_FaultCode *FaultCodeGrpup, const uint16_t len)
{
uint16_t i = 0;
uint8_t Result = 1;
if ((u32FaultCode == 0XFFFF) || (u32FaultCode == 0))
{
return 2;
}
if (len == 1)
{
return 1;
}
for (i = 0; i < len; i++)
{
if (u32FaultCode == FaultCodeGrpup[i].u16FaultCode)
{
Result = 0;
return Result;
}
}
return Result;
}
/**
* 添加新的故障码到故障码数组中。
* @param faultCodes 指向故障码数组的指针。
* @param count 指向当前已添加故障码数量的指针。
* @param faultCode 要添加的故障码。
* @param len 实际故障码数量,用于检测数组中是否存在当前故障码
* @note 如果故障码数组已满或者新的故障码已存在,则不添加。
*/
void AddNewFaultCode(_st_FaultCode *faultCodes, uint16_t *count, uint32_t faultCode, uint16_t len)
{
if (*count >= MaxFaultCode || FaultCode_Check(faultCode, faultCodes, len) != 1)
{
return; // 数组已满或故障码已存在,不进行添加
}
faultCodes[*count].u16FaultCode = faultCode;
(*count)++;
}
/**
* @brief 故障码服务函数
* @param Cycle 建议10ms调用 防止故障码数量过多 接收缓慢
*/
void FaultCode_Service(uint16_t Cycle)
{
uint32_t Dtc1 = 0XFFFF;
uint32_t Dtc2 = 0XFFFF;
uint32_t Dtc3 = 0XFFFF;
uint16_t FaultCodeSum = 0;
uint16_t i = 0;
uint32_t tempFaultCode = 0;
uint16_t Vaild = 0;
if (FaultCodeInit.callbacks[DTC1] != NULL)
{
Dtc1 = FaultCodeInit.callbacks[DTC1]();
}
if (FaultCodeInit.callbacks[DTC2] != NULL)
{
Dtc2 = FaultCodeInit.callbacks[DTC2]();
}
if (FaultCodeInit.callbacks[DTC3] != NULL)
{
Dtc3 = FaultCodeInit.callbacks[DTC3]();
}
if (FaultCodeInit.FaultCodeVaildCbk != NULL)
{
Vaild = FaultCodeInit.FaultCodeVaildCbk();
}
if (FaultCodeInit.FaultCodeNumCbk != NULL)
{
FaultCodeSum = FaultCodeInit.FaultCodeNumCbk();
}
if (FaultCodeSum > MaxFaultCode)
{
FaultCodeSum = MaxFaultCode;
}
if ((Vaild) && (FaultCodeSum > 0))
{
if (u16FaultCodeDtcCountBack < FaultCodeSum) /* 当前存储故障码是否小于实际故障码数量 */
{
/* 存储故障码并检查数组中是否存在 */
AddNewFaultCode(stFaultCodeBack, &u16FaultCodeDtcCountBack, Dtc1, FaultCodeSum);
AddNewFaultCode(stFaultCodeBack, &u16FaultCodeDtcCountBack, Dtc2, FaultCodeSum);
}
/* 接收故障码大于0后进行显示 */
if (u16FaultCodeDtcCountBack > 0)
{
/* 当前存储故障码等于实际故障码数量 用于实时更新故障码*/
if (u16FaultCodeDtcCountBack == FaultCodeSum)
{
u16FaultCodeDtcCountBack = 0;
}
/* 更新故障码显示 */
for (i = 0; i < FaultCodeSum; i++)
{
if (stFaultCodetemp[i].u16FaultCode != stFaultCodeBack[i].u16FaultCode)
{
stFaultCodetemp[i].u16FaultCode = stFaultCodeBack[i].u16FaultCode;
stFaultCode[i].u16FaultCode = stFaultCodetemp[i].u16FaultCode;
}
}
u8FaultCodeValid = 1;
/* 大于故障码数量的数组进行清0处理 */
for (i = FaultCodeSum; i < MaxFaultCode; i++)
{
stFaultCode[i].u16FaultCode = 0;
stFaultCodetemp[i].u16FaultCode = 0;
stFaultCodeBack[i].u16FaultCode = 0;
}
}
if (stFaultCode[0].u16FaultCode != 0XFFFF)
{
/* 故障码计时 */
if (stFaultCode[0].u16FaultCodeCount < FaultCodeCount)
{
stFaultCode[0].u16FaultCodeCount += Cycle;
}
else
{
/* 计时结束 更新位置 */
stFaultCode[0].u16FaultCodeCount = 0;
tempFaultCode = stFaultCode[0].u16FaultCode;
if (FaultCodeSum > 1)
{
for (i = 0; i < FaultCodeSum - 1; i++)
{
stFaultCode[i].u16FaultCode = stFaultCode[i + 1].u16FaultCode;
}
stFaultCode[FaultCodeSum - 1].u16FaultCode = tempFaultCode;
}
}
}
}
else
{
u8FaultCodeValid = 0;
for (i = 0; i < MaxFaultCode; i++)
{
stFaultCode[i].u16FaultCode = 0;
stFaultCode[i].u16FaultCodeCount = 0;
stFaultCodeBack[i].u16FaultCode = 0;
stFaultCodeBack[i].u16FaultCodeCount = 0;
stFaultCodetemp[i].u16FaultCode = 0;
stFaultCodetemp[i].u16FaultCodeCount = 0;
}
u16FaultCodeDtcCountBack = 0;
}
}
/**
* @brief 获取当前故障码
*/
uint32_t Get_Current_FaultCode(void)
{
return stFaultCode[0].u16FaultCode;
}
uint8_t Get_FaultCode_Valid(void)
{
return u8FaultCodeValid;
}
#ifndef CODE_H
#define CODE_H
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "Application.h"
/*故障码类型A can报文轮询发送方式*/
#define FaultCodeType_A 1
#define FaultCodeType FaultCodeType_A
#define MaxFaultCode 72
#define FaultCodeCount 5000
typedef enum
{
DTC1,
DTC2,
DTC3,
NUM_FAULT_TYPES,
} FaultCodeType_Num;
typedef uint32_t (*FaultCodeCallback)(void); /* 故障码回调函数 */
typedef uint16_t (*FaultCodeNumback)(void); /* 故障码个数回调函数 */
typedef uint16_t (*FaultCodeValidback)(void); /* 故障码有效回调函数 */
typedef struct
{
uint32_t u16FaultCode; /* 故障码 */
uint16_t u16FaultCodeCount; /* 故障码总数 */
} _st_FaultCode;
typedef struct
{
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);
#endif
\ No newline at end of file
......@@ -129,7 +129,7 @@ void Gauge_Service(void)
SEG_SET_CoolantDial(1, GET_DataCoolantTempSegDisp(), GET_DataCoolantTempValueDisp(), GET_DataCollantTempSegValid());
SEG_SET_Voltage_NUM(1, Get_Battery_Voltage());
#if(IC_Current == TY200_080000b_ty)
SEG_SET_TPMS_NUM(1, Get_Front_TPMS_Sig_Value(), Get_Rear_TPMS_Sig_Value(), Get_Dis_Tpms_Unit(),Get_Front_TPMS_Sig_Vaild(), Get_Rear_TPMS_Sig_Vaild());
SEG_SET_TPMS_DISPLAY(1, Get_Front_TPMS_Sig_Value(), Get_Rear_TPMS_Sig_Value(), Get_Dis_Tpms_Unit(),Get_Front_TPMS_Sig_Vaild(), Get_Rear_TPMS_Sig_Vaild());
#endif
SEG_SET_Navigation_STS(Get_Navigation_St_Dis(),Get_Navigation_Code_Dis(),Get_Navigation_Mileage_Dis());
......
......@@ -28,16 +28,73 @@ typedef enum
SEG_LED_MAX,
} SEG_LED_Idx_t;
#define NaviIconType_LEFT 0x02
#define NaviIconType_RIGHT 0x03
#define NaviIconType_LEFT_FRONT 0x04
#define NaviIconType_RIGHT_FRONT 0x05
#define NaviIconType_LEFT_BACK 0x06
#define NaviIconType_RIGHT_BACK 0x07
#define NaviIconType_STRAIGHT 0x09
#define NaviIconType_ARRIVED_SERVICE_AREA 0x0D
#define NaviIconType_ARRIVED_TOLLGATE 0x0E
#define NaviIconType_ARRIVED_TUNNEL 0x10
enum ECNaviIcon
{
EC_NAVI_ICON_NONE = 0,
EC_NAVI_ICON_DEFAULT = 1,
EC_NAVI_ICON_LEFT = 2,
EC_NAVI_ICON_RIGHT = 3,
EC_NAVI_ICON_LEFT_FRONT = 4,
EC_NAVI_ICON_RIGHT_FRONT = 5,
EC_NAVI_ICON_LEFT_BACK = 6,
EC_NAVI_ICON_RIGHT_BACK = 7,
EC_NAVI_ICON_LEFT_TURN_AROUND = 8,
EC_NAVI_ICON_STRAIGHT = 9,
EC_NAVI_ICON_ARRIVED_WAYPOINT = 10,
EC_NAVI_ICON_ENTER_ROUNDABOUT = 11,
EC_NAVI_ICON_OUT_ROUNDABOUT = 12,
EC_NAVI_ICON_ARRIVED_SERVICE_AREA = 13,
EC_NAVI_ICON_ARRIVED_TOLLGATE = 14,
EC_NAVI_ICON_ARRIVED_DESTINATION = 15,
EC_NAVI_ICON_ARRIVED_TUNNEL = 16,
EC_NAVI_ICON_CROSSWALK = 17,
EC_NAVI_ICON_OVERPASS = 18,
EC_NAVI_ICON_UNDERPASS = 19,
EC_NAVI_ICON_SQUARE = 20,
EC_NAVI_ICON_PARK = 21,
EC_NAVI_ICON_STAIRCASE = 22,
EC_NAVI_ICON_LIFT = 23,
EC_NAVI_ICON_CABLEWAY = 24,
EC_NAVI_ICON_SKY_CHANNEL = 25,
EC_NAVI_ICON_CHANNEL = 26,
EC_NAVI_ICON_WALK_ROAD = 27,
EC_NAVI_ICON_CRUISE_ROUTE = 28,
EC_NAVI_ICON_SIGHTSEEING_BUSLINE = 29,
EC_NAVI_ICON_SLIDEWAY = 30,
EC_NAVI_ICON_LADDER = 31,
EC_NAVI_ICON_MERGE_LEFT = 51,
EC_NAVI_ICON_MERGE_RIGHT = 52,
EC_NAVI_ICON_SLOW = 53,
EC_NAVI_ICON_ENTRY_RING_LEFT = 54,
EC_NAVI_ICON_ENTRY_RING_RIGHT = 55,
EC_NAVI_ICON_ENTRY_RING_CONTINUE = 56,
EC_NAVI_ICON_ENTRY_RING_UTURN = 57,
EC_NAVI_ICON_ENTRY_LEFT_RING = 58,
EC_NAVI_ICON_LEAVE_LEFT_RING = 59,
EC_NAVI_ICON_UTURN_RIGHT = 60,
EC_NAVI_ICON_SPECIAL_CONTINUE = 61,
EC_NAVI_ICON_ENTRY_LEFT_RING_LEFT = 62,
EC_NAVI_ICON_ENTRY_LEFT_RING_RIGHT = 63,
EC_NAVI_ICON_ENTRY_LEFT_RING_CONTINUE = 64,
EC_NAVI_ICON_ENTRY_LEFT_RING_UTURN = 65,
EC_NAVI_ICON_SLOPE = 66,
EC_NAVI_ICON_BRIDGE = 67,
EC_NAVI_ICON_FERRYBOAT = 68,
EC_NAVI_ICON_SUBWAY = 69,
EC_NAVI_ICON_ENTER_BUILDING = 70,
EC_NAVI_ICON_LEAVE_BUILDING = 71,
EC_NAVI_ICON_BY_ELEVATOR = 72,
EC_NAVI_ICON_BY_STAIR = 73,
EC_NAVI_ICON_ESCALATOR = 74,
EC_NAVI_ICON_LOW_TRAFFIC_CROSS = 75,
EC_NAVI_ICON_LOW_CROSS = 76,
EC_NAVI_ICON_ROTARY_SHARP_LEFT = 77,
EC_NAVI_ICON_ROTARY_SHARP_RIGHT = 78,
EC_NAVI_ICON_ROTARY_SLIGHT_LEFT = 79,
EC_NAVI_ICON_ROTARY_SLIGHT_RIGHT = 80,
EC_NAVI_ICON_MAX
};
......@@ -48,11 +105,13 @@ void SEG_SET_EspeedDial(uint8_t m_Flag, uint8_t m_SEG);
void SEG_SET_CoolantDial(uint8_t m_Flag, uint8_t m_SEG, uint16_t m_Num, uint8_t m_flash);
void SEG_SET_VSpeed_NUM(uint8_t m_Flag, uint16_t m_NUM, uint8_t m_Unit);
void SEG_SET_Voltage_NUM(uint8_t m_Flag, uint16_t m_NUM);
void SEG_SET_TPMS_NUM(uint8_t m_Flag, uint16_t m_NUM1, uint16_t m_NUM2, uint8_t m_Unit, uint8_t m_valid1, uint8_t m_valid2);
void SEG_SET_TPMS_DISPLAY(uint8_t m_Flag, uint16_t m_NUM1, uint16_t m_NUM2, uint8_t m_Unit, uint8_t m_valid1, uint8_t m_valid2);
void SEG_SET_ODO_TRIP_FAULTCODE_TCS_DIS(uint8_t m_Uint, uint32_t m_NUM_ODO, uint32_t m_NUM_TRIP);
void SEG_SET_Clock(uint8_t m_hour, uint8_t m_minute, uint8_t m_icon, uint8_t m_Flag1, uint8_t m_Flag2);
void SEG_SET_Navigation_STS(uint8_t m_Flag, uint8_t m_Code, uint32_t m_Mileage);
void Check_SEG_Display(void);
void SEG_SET_FRONT_TPMS_NUM(uint8_t learnflag, uint16_t m_NUM1,uint8_t m_valid1);
void SEG_SET_Rear_TPMS_NUM(uint8_t learnflag, uint16_t m_NUM2,uint8_t m_valid2);
extern uint8_t check_SEG_step;
extern uint8_t Espeed_check_SEG_step;
......
......@@ -310,11 +310,11 @@ void Key_Left_Short_Press(void)
}
else if(PageType == Page_Front_Tpms)
{
PageType == Page_Rear_Tpms;
PageType = Page_Rear_Tpms;
}
else if(PageType == Page_Rear_Tpms)
{
PageType == Page_Front_Tpms;
PageType = Page_Front_Tpms;
}
else
{
......@@ -390,7 +390,7 @@ void Key_Left_Long_Press(void)
}
else if(PageType == Page_Tpms_Unit)
{
PageType == Page_Front_Tpms;
PageType = Page_Front_Tpms;
}
else if((PageType == Page_Front_Tpms) || (PageType == Page_Rear_Tpms))
{
......
......@@ -20,8 +20,10 @@ typedef struct
uint8_t KM_Unit; // 0 km, 1 mile
uint8_t Tpms_Unit;// 0 bar, 1 psi
uint32_t Tcs_Val; // 0 off, 1 on
uint32_t TPMS_Front_Learn;
uint32_t TPMS_Rear_Learn;
uint8_t TPMS_Front_Learn;
uint8_t TPMS_Rear_Learn;
uint8_t TPMS_Front_FirstLearn_Flag;
uint8_t TPMS_Rear_FirstLearn_Flag;
}_Menu_Data;
typedef enum
......
......@@ -10,16 +10,18 @@ uint8_t odo_writeState;
uint8_t odo_readState;
extern uint32_t NVM_User_Settings_Service;
#define EEPROM_BLOCK_00 00
#define EEPROM_BLOCK_01 16
#define EEPROM_BLOCK_02 32
#define EEPROM_BLOCK_03 48
#define EEPROM_BLOCK_04 64
#define EEPROM_BLOCK_05 80
#define EEPROM_BLOCK_06 96
#define EEPROM_BLOCK_07 112
#define EEPROM_BLOCK_08 128
#define EEPROM_BLOCK_09 144
#define EEPROM_BLOCK_00 0x00
#define EEPROM_BLOCK_01 0x16
#define EEPROM_BLOCK_02 0x32
#define EEPROM_BLOCK_03 0x48
#define EEPROM_BLOCK_04 0x64
#define EEPROM_BLOCK_05 0x80
#define EEPROM_BLOCK_06 0x90
#define EEPROM_BLOCK_07 0xA0
#define EEPROM_BLOCK_08 0xB0
#define EEPROM_BLOCK_09 0xC0
uint32_t Milleage_InitFlag = 0U;
......@@ -39,7 +41,7 @@ void Data_User_Mileage_KL30Init(void)
ODO_Init_t ODOInit = {0};
uint32_t Maintenance_Firstflg[1u] = {0};
Trip_Init_t TripInit[4] = {0};
uint32_t TPMSLearn[2] = {0,0};
uint8_t TPMSLearn[2] = {0,0};
Milleage_InitFlag = 0U;
// �������ݴ�EEPROM�ж�ȡ
(void)Data_User_EEPROM_Read(EM_MILEAGE_BLOCK, TempBuf, 1);
......@@ -119,12 +121,14 @@ void Data_User_Mileage_KL30Init(void)
Data_User_EEPROM_Write(EM_MenuData_Tcs_Val, &MenuData.Tcs_Val, 1u);
}
Data_User_EEPROM_Read(EM_MenuData_TPMS_LEARN, TempBuf, 2u);
Data_User_EEPROM_Read(EM_MenuData_TPMS_LEARN, TempBuf, 1u);
if (TempBuf[0u] == 0xFFFFFFFF)
{
TPMSLearn[0] = MenuData.TPMS_Front_Learn;
TPMSLearn[1] = MenuData.TPMS_Rear_Learn;
Data_User_EEPROM_Write(EM_MenuData_TPMS_LEARN, TPMSLearn, 2u);
TPMSLearn[0] = 0;//MenuData.TPMS_Front_Learn;
TPMSLearn[1] = 0;//MenuData.TPMS_Rear_Learn;
//TPMSLearn[2] = 0;//MenuData.TPMS_Front_FirstLearn_Flag;
//TPMSLearn[3] = 0;//MenuData.TPMS_Rear_FirstLearn_Flag;
Data_User_EEPROM_Write(EM_MenuData_TPMS_LEARN, (uint32_t *)TPMSLearn, 1u);
}
Milleage_InitFlag = 0X5AA53AA3UL;
......@@ -183,8 +187,9 @@ uint32_t Get_MileageInit_Status(void)
eeprom_ReadRecord(EEPROM_BLOCK_08, (uint8_t *)u32Data, u16Len * 4);
break;
case EM_MenuData_TPMS_LEARN:
eeprom_ReadRecord(EEPROM_BLOCK_09, (uint8_t *)u32Data, u16Len * 4);
eeprom_ReadRecord(EEPROM_BLOCK_09, (uint8_t *)u32Data, u16Len * 2);
break;
default:
break;
......@@ -228,10 +233,10 @@ uint32_t Get_MileageInit_Status(void)
eeprom_WriteRecord(EEPROM_BLOCK_07, (uint8_t *)u32Data, u16Len * 4);
break;
case EM_MenuData_Tcs_Val:
eeprom_WriteRecord(EEPROM_BLOCK_08, (uint8_t *)u32Data, u16Len * 4);
eeprom_WriteRecord(EEPROM_BLOCK_08, (uint8_t *)u32Data, u16Len * 1);
break;
case EM_MenuData_TPMS_LEARN:
eeprom_WriteRecord(EEPROM_BLOCK_09, (uint8_t *)u32Data, u16Len * 4);
eeprom_WriteRecord(EEPROM_BLOCK_09, (uint8_t *)u32Data, u16Len * 2);
break;
default:
break;
......
......@@ -90,6 +90,7 @@ static void Power_KL30_Init(void)
g_stRTCInformation.u8RTCYear = 20;
RTE_RTC_Init(g_stRTCInformation);
RTE_DEEPSLEEP_GPIO_Interrupt_Enable(WAKEUP_KL15_In,Trigger_Rising);
FaultCode_Init();
}
extern uint32_t PowerIgnOffTimeLine;
......@@ -135,6 +136,7 @@ static void Power_Wakeup_Init(void)
Telltales_UserInit();
Data_TPMS_KL15_WAKE_UP_Init();
RTE_DEEPSLEEP_GPIO_Interrupt_Enable(WAKEUP_KL15_In,Trigger_Rising);
FaultCode_Init();
}
static void Power_LVP_Init(void)
......@@ -168,6 +170,7 @@ static void Power_IG_ON_Init(void)
CAN_TX_SetEnable(&CAN_CH0_CanMsgTxOp, CAN_N_TX_Enable);
DFlash_init();
Data_Read_DiagPara();
FaultCode_Init();
}
static void Power_Sleep_Init(void)
......@@ -293,6 +296,7 @@ static Power_Status_em Power_Stay_Protect(void)
}
BU98R10_Init( );
CAN_TX_SetEnable(&CAN_CH0_CanMsgTxOp, CAN_N_TX_Enable);
Common_DataInit();
return u8PowerSts;
}
}
......
......@@ -4,8 +4,9 @@
#include "cgc.h"
#include "gpio.h"
#include "isr.h"
#include "Analog\Analog_Signals.h"
uint8_t u8NewChNum[4] = {2, 3, 7, 5};
// uint8_t u8NewChNum[4] = {2, 3, 7, 5};
void RTC_ADC_Interrupt(void *msg)
{
......@@ -17,6 +18,7 @@ void RTE_ADC_Init(const uint8_t u8ChList[], uint8_t u8ChNum)
{
GPIO_InitTypeDef GPIO_InitStructure = {0};
ADC_InitTypeDef ADC_InitStructure = {0};
if(u8ChNum<=7)
{
......@@ -133,13 +135,13 @@ void RTE_ADC_Get_Conversion_Result(uint16_t *pu16Data, uint8_t u8ChNum)
uint8_t i;
if ((pu16Data != 0U) && (u8ChNum > 0U) && (u8ChNum <= 4U))
if ((pu16Data != 0U) && (u8ChNum > 0U) && (u8ChNum <= ADC_TOTAL_CH_NUMBER))
{
if (RTE_ADC_Get_Conversion_Status() == 0U)
{
for (i = 0U; i < u8ChNum; i++)
{
ADC_Converse(u8NewChNum[i], 1, pu16Data);
ADC_Converse((ADC_Channel_t)u8ADCChList[i], 1, pu16Data);
pu16Data++;
}
}
......
......@@ -4,6 +4,8 @@
#include <stdint.h>
extern const uint8_t u8ADCChList[];
#define ADC_RESOLUTION (4096U) /* 12bit ADC */
extern void RTE_ADC_Init(const uint8_t u8ChList[], uint8_t u8ChNum);
......
......@@ -38,10 +38,10 @@ void Sys_5ms_Tasks(void)
}
uint8_t ljs_buf[200] = {0};
//uint8_t ljs_buf[200] = {0};
void Sys_10ms_Tasks(void)
{
memset(ljs_buf, 0x55, 200);
//memset(ljs_buf, 0x55, 200);
Line_In_Debounce_Service(10u);
Key_Service();
Data_Mileage_Write_EEPROM();
......@@ -53,6 +53,7 @@ void Sys_10ms_Tasks(void)
Protocol_Service();
Protocol_Send_Service();
//Uart0_IntSend(ljs_buf, 200) ;
FaultCode_Service(10u);
}
void Sys_20ms_Tasks(void)
......@@ -62,6 +63,7 @@ void Sys_20ms_Tasks(void)
Data_Vehicle_Speed_Processing_Service();
Data_Engine_Speed_Processing_Service();
Data_Coolant_Temp_Processing_Service();
Data_Voltage_Processing_Service();
}
......@@ -88,7 +90,7 @@ void Sys_100ms_Tasks(void)
Fuel_Cal_Sevice(100u);
BackLight_Process();
Services_Mileage_Callback();
Data_Voltage_Processing_Service();
//Data_Voltage_Processing_Service();
S3_ServerCNTT();
//ECU_FaultCode_Processing_Service();
Send_UUID_To_Esp32();
......@@ -111,6 +113,7 @@ void Sys_100ms_Tasks(void)
* @brief 50us中断服务 尽可能的减少中断使用
*
*/
void Sys_Exact_50us_Tasks(void)
{
static uint32_t task_1ms = 0u;
......@@ -122,5 +125,5 @@ void Sys_Exact_50us_Tasks(void)
task_1ms =0U;
eeprom_1ms_timeCount( );
}
//u32YZHDCount++;
}
......@@ -314,10 +314,10 @@
#define SWV 0x100 // 0x100 = 1.00 software version 软件版本号
#define HWV 0x100 // 0x100 = 1.00 hardware version 硬件版本号
#define BTV 0x100 // 0x100 = 1.00 bootloader version boot程序版本号
#define INTLV 0x102 // 0x100 = 1.00 internal version 内部版本号
#define INTLV 0x103 // 0x100 = 1.00 internal version 内部版本号
#define PROG_Y 0x24 // 0x24 = 2024年, program year
#define PROG_M 0x05 // 0x03 = 3月, program month
#define PROG_D 0x27 // 0x19 = 19日, program day
#define PROG_M 0x06 // 0x03 = 3月, program month
#define PROG_D 0x19 // 0x19 = 19日, program day
/******************************************************************************
Bootloader Variable
......
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