Commit 4dfebd4a authored by 高士达's avatar 高士达

Merge branch 'CHENJIALE' into 'dev'

Chenjiale

See merge request !62
parents dbc36701 54e556c4
...@@ -136,7 +136,7 @@ const uint8_t user_opt_data[4] __attribute__((used)) __attribute__((section(".AR ...@@ -136,7 +136,7 @@ const uint8_t user_opt_data[4] __attribute__((used)) __attribute__((section(".AR
// <0x72=> VLVDH = 4.06V/3.98V, VLVDL = 2.75V ( interrupt & reset mode ) // <0x72=> VLVDH = 4.06V/3.98V, VLVDL = 2.75V ( interrupt & reset mode )
// <i> Please setting the item for interrupt & reset mode // <i> Please setting the item for interrupt & reset mode
// </h> // </h>
0x3F, 0x72,
/** /**
* @brief HOCO Control BYTE (FRQSEL) * @brief HOCO Control BYTE (FRQSEL)
......
...@@ -275,7 +275,7 @@ ...@@ -275,7 +275,7 @@
</OCR_RVCT3> </OCR_RVCT3>
<OCR_RVCT4> <OCR_RVCT4>
<Type>1</Type> <Type>1</Type>
<StartAddress>0x8000</StartAddress> <StartAddress>0x0</StartAddress>
<Size>0x40000</Size> <Size>0x40000</Size>
</OCR_RVCT4> </OCR_RVCT4>
<OCR_RVCT5> <OCR_RVCT5>
...@@ -361,8 +361,8 @@ ...@@ -361,8 +361,8 @@
</VariousControls> </VariousControls>
</Aads> </Aads>
<LDads> <LDads>
<umfTarg>1</umfTarg> <umfTarg>0</umfTarg>
<Ropi>0</Ropi> <Ropi>1</Ropi>
<Rwpi>0</Rwpi> <Rwpi>0</Rwpi>
<noStLib>0</noStLib> <noStLib>0</noStLib>
<RepFail>1</RepFail> <RepFail>1</RepFail>
...@@ -370,7 +370,7 @@ ...@@ -370,7 +370,7 @@
<TextAddressRange>0x00000000</TextAddressRange> <TextAddressRange>0x00000000</TextAddressRange>
<DataAddressRange>0x20000000</DataAddressRange> <DataAddressRange>0x20000000</DataAddressRange>
<pXoBase></pXoBase> <pXoBase></pXoBase>
<ScatterFile></ScatterFile> <ScatterFile>.\Objects\TianYing.sct</ScatterFile>
<IncludeLibs></IncludeLibs> <IncludeLibs></IncludeLibs>
<IncludeLibsPath></IncludeLibsPath> <IncludeLibsPath></IncludeLibsPath>
<Misc></Misc> <Misc></Misc>
......
...@@ -8,10 +8,10 @@ st_CanMsgTxOp CAN_CH0_CanMsgTxOp; ...@@ -8,10 +8,10 @@ st_CanMsgTxOp CAN_CH0_CanMsgTxOp;
const st_CAN_SendAttribute CAN_CH0_CANSendAttr[CAN_CH0_ID_SEND_TOTAL] = const st_CAN_SendAttribute CAN_CH0_CANSendAttr[CAN_CH0_ID_SEND_TOTAL] =
{ {
{0x220ul, 50ul * 1000ul, 7ul * 1000ul, 0u, MSG_STD, 1u, 8u, CAN_MSG_TX_CYCLE, Can_Set_Buff_220, (void *)0}, {0x220ul, 50ul * 1000ul, 49ul * 1000ul, 0u, MSG_STD, 1u, 8u, CAN_MSG_TX_CYCLE, Can_Set_Buff_220, (void *)0},
{0x6EEul, 100ul * 1000ul, 8ul * 1000ul, 0u, MSG_STD, 2u, 8u, CAN_MSG_TX_CYCLE, Can_Set_Buff_6EE, (void *)0}, {0x6EEul, 100ul * 1000ul, 98ul * 1000ul, 0u, MSG_STD, 2u, 8u, CAN_MSG_TX_CYCLE, Can_Set_Buff_6EE, (void *)0},
{0x6EFul, 100ul * 1000ul, 9ul * 1000ul, 0u, MSG_STD, 3u, 8u, CAN_MSG_TX_CYCLE, Can_Set_Buff_6EF, (void *)0}, {0x6EFul, 100ul * 1000ul, 97ul * 1000ul, 0u, MSG_STD, 3u, 8u, CAN_MSG_TX_CYCLE, Can_Set_Buff_6EF, (void *)0},
{0x450ul, 100ul * 1000ul, 10ul * 1000ul, 0u, MSG_STD, 4u, 8u, CAN_MSG_TX_CYCLE, Can_Set_Buff_450, (void *)0}, {0x450ul, 100ul * 1000ul, 96ul * 1000ul, 0u, MSG_STD, 4u, 8u, CAN_MSG_TX_CYCLE, Can_Set_Buff_450, (void *)0},
#if (IC_Current == TY200_080000b_ty) #if (IC_Current == TY200_080000b_ty)
{0x580ul, 8ul * 1000ul, 0ul * 1000ul, 0u, MSG_STD, 1u, 8u, CAN_MSG_TX_CYCLE, Can_Set_Buff_580, (void *)0}, {0x580ul, 8ul * 1000ul, 0ul * 1000ul, 0u, MSG_STD, 1u, 8u, CAN_MSG_TX_CYCLE, Can_Set_Buff_580, (void *)0},
#endif #endif
......
...@@ -102,6 +102,8 @@ void Can_Set_Buff_450(canlib_uint8_t CopyData[]) ...@@ -102,6 +102,8 @@ void Can_Set_Buff_450(canlib_uint8_t CopyData[])
{ {
CANMsg450Union *p450; CANMsg450Union *p450;
uint8_t i = 0; uint8_t i = 0;
uint16_t u16FrontTpms = 0;
uint16_t u16RearTpms = 0;
p450 = (CANMsg450Union *)CopyData; p450 = (CANMsg450Union *)CopyData;
if ( p450 != ( void * )0 ) if ( p450 != ( void * )0 )
...@@ -110,25 +112,47 @@ void Can_Set_Buff_450(canlib_uint8_t CopyData[]) ...@@ -110,25 +112,47 @@ void Can_Set_Buff_450(canlib_uint8_t CopyData[])
{ {
p450->Msg [ i ] = 0x0u; p450->Msg [ i ] = 0x0u;
} }
if(MenuData.TPMS_Front_Learn != 2) 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_H = 0;
p450 -> Sig.Front_Pressure_TX_L = 0; p450 -> Sig.Front_Pressure_TX_L = 0;
} }
else else
{ {
p450 -> Sig.Front_Pressure_TX_H = ((Get_Front_TPMS_TX() + 146) >> 8) & 0xFF; if((Get_Front_TPMS_TX() + 146) <= 1000U)
p450 -> Sig.Front_Pressure_TX_L = (Get_Front_TPMS_TX() + 146) & 0xFF; {
u16FrontTpms = (Get_Front_TPMS_TX() + 146);
}
else
{
u16FrontTpms = 1000U;
}
p450 -> Sig.Front_Pressure_TX_H = ( u16FrontTpms >> 8) & 0xFF;
p450 -> Sig.Front_Pressure_TX_L = ( u16FrontTpms) & 0xFF;
} }
if(MenuData.TPMS_Rear_Learn != 2) 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_H = 0;
p450 -> Sig.Rear_Pressure_TX_L = 0; p450 -> Sig.Rear_Pressure_TX_L = 0;
} }
else else
{ {
p450 -> Sig.Rear_Pressure_TX_H = ((Get_Rear_TPMS_TX() + 146) >> 8) & 0xFF; if((Get_Rear_TPMS_TX() + 146) <= 1000U)
p450 -> Sig.Rear_Pressure_TX_L = (Get_Rear_TPMS_TX() + 146) & 0xFF; {
u16RearTpms = (Get_Rear_TPMS_TX() + 146);
}
else
{
u16RearTpms = 1000U;
}
p450 -> Sig.Rear_Pressure_TX_H = (u16RearTpms >> 8) & 0xFF;
p450 -> Sig.Rear_Pressure_TX_L = (u16RearTpms) & 0xFF;
} }
} }
......
...@@ -12,17 +12,19 @@ typedef union ...@@ -12,17 +12,19 @@ typedef union
uint8_t Msg [ 8 ]; uint8_t Msg [ 8 ];
struct struct
{ {
uint32_t Res0 : 3; uint8_t Res0 : 3;
uint32_t TCS_TX : 1; uint8_t TCS_TX : 1;
uint32_t Res1: 4; uint8_t Res1: 4;
uint32_t Res2: 8; uint8_t Res2: 8;
uint32_t Res3: 16; uint8_t Res3: 8;
uint32_t Res4: 16; uint8_t Res6 : 8;
uint32_t Res5: 8; uint8_t Res4: 8;
uint8_t Res7 : 8;
uint8_t Res5: 8;
uint32_t CheckSum: 5; uint8_t CheckSum: 5;
uint32_t AliveCounter: 3; uint8_t AliveCounter: 3;
} Sig; } Sig;
} CANMsg220Union; } CANMsg220Union;
...@@ -31,24 +33,24 @@ typedef union ...@@ -31,24 +33,24 @@ typedef union
uint8_t Msg [ 8 ]; uint8_t Msg [ 8 ];
struct struct
{ {
uint32_t Coolant_Seg_TX : 4; uint8_t Coolant_Seg_TX : 4;
uint32_t Fuel_Seg_TX : 4; uint8_t Fuel_Seg_TX : 4;
uint32_t Res0 : 8; uint8_t Res0 : 8;
uint32_t Fuel_Res_TX : 8; uint8_t Fuel_Res_TX : 8;
uint32_t Vsppe_H3_TX : 3; uint8_t Vsppe_H3_TX : 3;
uint32_t Res1 : 1; uint8_t Res1 : 1;
uint32_t Coolant_Warn_TX : 1; uint8_t Coolant_Warn_TX : 1;
uint32_t Res2 : 2; uint8_t Res2 : 2;
uint32_t Uint_TX : 1; uint8_t Uint_TX : 1;
uint32_t Vsppe_L8_TX : 8; uint8_t Vsppe_L8_TX : 8;
uint32_t ODO_TX_H : 8; uint8_t ODO_TX_H : 8;
uint32_t ODO_TX_M : 8; uint8_t ODO_TX_M : 8;
uint32_t ODO_TX_L : 8; uint8_t ODO_TX_L : 8;
} Sig; } Sig;
} CANMsg6EEUnion; } CANMsg6EEUnion;
...@@ -58,16 +60,17 @@ typedef union ...@@ -58,16 +60,17 @@ typedef union
uint8_t Msg [ 8 ]; uint8_t Msg [ 8 ];
struct struct
{ {
uint32_t Espeed_TX : 8; uint8_t Espeed_TX : 8;
uint32_t Coolant_TX : 8; uint8_t Coolant_TX : 8;
uint32_t TripA_H : 8; uint8_t TripA_H : 8;
uint32_t TripA_L : 8; uint8_t TripA_L : 8;
uint32_t TripB : 16; uint8_t TripB : 8;
uint8_t Res2 : 8;
uint32_t Res1 : 16; uint8_t Res1 : 8;
uint8_t Res3 : 8;
} Sig; } Sig;
} CANMsg6EFUnion; } CANMsg6EFUnion;
...@@ -77,10 +80,10 @@ typedef union ...@@ -77,10 +80,10 @@ typedef union
uint8_t Msg [ 8 ]; uint8_t Msg [ 8 ];
struct struct
{ {
uint16_t Front_Pressure_TX_H : 8; uint8_t Front_Pressure_TX_H : 8;
uint16_t Front_Pressure_TX_L : 8; uint8_t Front_Pressure_TX_L : 8;
uint16_t Rear_Pressure_TX_H : 8; uint8_t Rear_Pressure_TX_H : 8;
uint16_t Rear_Pressure_TX_L : 8; uint8_t Rear_Pressure_TX_L : 8;
//uint32_t Front_Air_Leakage_TX : 1; //uint32_t Front_Air_Leakage_TX : 1;
//uint32_t Rear_Air_Leakage_TX : 1; //uint32_t Rear_Air_Leakage_TX : 1;
//uint32_t Front_Low_Voltage_TX : 1; //uint32_t Front_Low_Voltage_TX : 1;
...@@ -89,7 +92,10 @@ typedef union ...@@ -89,7 +92,10 @@ typedef union
//uint32_t Rear_High_Temp_TX : 1; //uint32_t Rear_High_Temp_TX : 1;
//uint32_t Res0 : 2; //uint32_t Res0 : 2;
uint32_t Res1 : 32; uint8_t Res1 : 8;
uint8_t Res2 : 8;
uint8_t Res3 : 8;
uint8_t Res4 : 8;
} Sig; } Sig;
} CANMsg450Union; } CANMsg450Union;
...@@ -104,8 +110,9 @@ typedef union ...@@ -104,8 +110,9 @@ typedef union
uint8_t TPMS_LEARN_CND_BYTE2 : 8; uint8_t TPMS_LEARN_CND_BYTE2 : 8;
uint8_t TPMS_LEARN_CND_BYTE3 : 8; uint8_t TPMS_LEARN_CND_BYTE3 : 8;
uint8_t TPMS_LEARN_CND_BYTE4 : 8; uint8_t TPMS_LEARN_CND_BYTE4 : 8;
uint32_t Res1 : 24; uint8_t Res1 : 8;
uint8_t Res2 : 8;
uint8_t Res13 : 8;
} Sig; } Sig;
} CANMsg580Union; } CANMsg580Union;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include "RTE.h" #include "RTE.h"
__align(4) __align(4)
uint32_t pRXBuff[CAN_RX_MSG_Block * CAN_CH0_ID_TOTAL_MAX]; uint32_t pRXBuff[CAN_RX_MSG_Block * CAN_CH0_ID_TOTAL_MAX];
uint32_t pTXBuff[CAN_TX_MSG_Block * CAN_CH0_ID_SEND_TOTAL]; uint32_t pTXBuff[CAN_TX_MSG_Block * CAN_CH0_ID_SEND_TOTAL];
static RSCAN0BusoffMonitorStruct RSCAN0Busoff; static RSCAN0BusoffMonitorStruct RSCAN0Busoff;
...@@ -26,8 +26,7 @@ void Can_Init(void) ...@@ -26,8 +26,7 @@ void Can_Init(void)
Can_Tx_Apply_Buff(); Can_Tx_Apply_Buff();
Can_RX_Apply_Buff(); Can_RX_Apply_Buff();
RTE_GPIO_Set_Level(RTE_GPIO_PORT05_PIN02,RTE_GPIO_LEVEL_LOW); RTE_GPIO_Set_Level(RTE_GPIO_PORT05_PIN02, RTE_GPIO_LEVEL_LOW);
} }
/** /**
...@@ -196,8 +195,6 @@ void Can_Tx_Apply_Buff(void) ...@@ -196,8 +195,6 @@ void Can_Tx_Apply_Buff(void)
CAN_MessageCache_DeInit(CAN0MSG14); CAN_MessageCache_DeInit(CAN0MSG14);
CAN_MessageCache_Init(CAN0MSG14, &CAN_SendMsg); CAN_MessageCache_Init(CAN0MSG14, &CAN_SendMsg);
CAN_SendMsg_Diag_Tx.Id = DIAG_ID_Tx; CAN_SendMsg_Diag_Tx.Id = DIAG_ID_Tx;
CAN_SendMsg_Diag_Tx.IDE = CAN_Id_Standard; CAN_SendMsg_Diag_Tx.IDE = CAN_Id_Standard;
CAN_SendMsg_Diag_Tx.CacheType = CAN_CacheType_Tx; CAN_SendMsg_Diag_Tx.CacheType = CAN_CacheType_Tx;
...@@ -244,7 +241,14 @@ void COM_CAN_Init(void) ...@@ -244,7 +241,14 @@ void COM_CAN_Init(void)
Can_TX_BuffInit(&CAN_CH0_CanMsgTxOp, CAN_CH0_CANSendAttr, CAN_CH0_ID_SEND_TOTAL, COM_APP_Process); 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_Disable);
} }
void Can_QuickTimer_Init(void)
{
uint32_t i = 0u;
for (i = 0u; i < CAN_CH0_ID_SEND_TOTAL; i++)
{
Can_Msg_TX_FastInitCycle(&CAN_CH0_CanMsgTxOp, i, CAN_CH0_CANSendAttr[i].u32MsgCycleOffset);
}
}
/** /**
* @brief Buff恢复函数 * @brief Buff恢复函数
...@@ -254,6 +258,7 @@ void Can_BusOff_Recover(uint8_t deltaTime) ...@@ -254,6 +258,7 @@ void Can_BusOff_Recover(uint8_t deltaTime)
{ {
if (get_can_busoff(CAN_CH_0) == 2) if (get_can_busoff(CAN_CH_0) == 2)
{ {
CAN_TX_Count_Init();
if (RSCAN0Busoff.Status == RSCAN0_BUS_STABLE) if (RSCAN0Busoff.Status == RSCAN0_BUS_STABLE)
{ {
RSCAN0Busoff.Status = RSCAN0_BUS_OFF_LV1; RSCAN0Busoff.Status = RSCAN0_BUS_OFF_LV1;
...@@ -262,18 +267,21 @@ void Can_BusOff_Recover(uint8_t deltaTime) ...@@ -262,18 +267,21 @@ void Can_BusOff_Recover(uint8_t deltaTime)
if (RSCAN0Busoff.Status == RSCAN0_BUS_OFF_LV1) if (RSCAN0Busoff.Status == RSCAN0_BUS_OFF_LV1)
{ {
RSCAN0Busoff.Timer++; RSCAN0Busoff.Timer++;
if (RSCAN0Busoff.Timer >= RSCAN0_BUS_OFF_LV1_RECOVERY_TIME / deltaTime) if (RSCAN0Busoff.Timer >= RSCAN0_BUS_OFF_LV1_RECOVERY_TIME / deltaTime)/**/
{ {
RSCAN0Busoff.Timer = 0U; RSCAN0Busoff.Timer = 0U;
RSCAN0Busoff.Cnt++; RSCAN0Busoff.Cnt++;
if (RSCAN0Busoff.Cnt >= 10U) if (RSCAN0Busoff.Cnt >= 10U)/**/
{ {
RSCAN0Busoff.Cnt = 0U; RSCAN0Busoff.Cnt = 0U;
RSCAN0Busoff.Status = RSCAN0_BUS_OFF_LV2; RSCAN0Busoff.Status = RSCAN0_BUS_OFF_LV2;
} }
//需调用CAN中止函数,中止所有硬件buf内要发送的数据
CAN_TX_Count_Init();
Can_QuickTimer_Init();
reset_busoff(CAN_CH_0); reset_busoff(CAN_CH_0);
} }
} }
...@@ -281,9 +289,12 @@ void Can_BusOff_Recover(uint8_t deltaTime) ...@@ -281,9 +289,12 @@ void Can_BusOff_Recover(uint8_t deltaTime)
{ {
RSCAN0Busoff.Timer++; RSCAN0Busoff.Timer++;
if (RSCAN0Busoff.Timer >= RSCAN0_BUS_OFF_LV2_RECOVERY_TIME / deltaTime) if (RSCAN0Busoff.Timer >= RSCAN0_BUS_OFF_LV2_RECOVERY_TIME / deltaTime)/**/
{ {
RSCAN0Busoff.Timer = 0U; RSCAN0Busoff.Timer = 0U;
//需调用CAN中止函数,中止所有硬件buf内要发送的数据
CAN_TX_Count_Init();
Can_QuickTimer_Init();
reset_busoff(CAN_CH_0); reset_busoff(CAN_CH_0);
} }
} }
...@@ -293,7 +304,15 @@ void Can_BusOff_Recover(uint8_t deltaTime) ...@@ -293,7 +304,15 @@ void Can_BusOff_Recover(uint8_t deltaTime)
} }
else /* 总线正常,没有Bus-off发生*/ else /* 总线正常,没有Bus-off发生*/
{ {
RSCAN0Busoff.RecoverTimer++;
if (RSCAN0Busoff.RecoverTimer >= 4)
{
RSCAN0Busoff.RecoverTimer = 0;
RSCAN0Busoff.Status = RSCAN0_BUS_STABLE;
RSCAN0Busoff.Timer = 0;
RSCAN0Busoff.Cnt = 0;
}
} }
} }
...@@ -310,12 +329,12 @@ uint8_t Get_Busoff_Status(void) ...@@ -310,12 +329,12 @@ uint8_t Get_Busoff_Status(void)
extern uint8_t Can_341_Flg; extern uint8_t Can_341_Flg;
uint8_t COM_APP_Process(st_CAN_Msg *Msg) uint8_t COM_APP_Process(st_CAN_Msg *Msg)
{ {
// Can_Write((st_CAN_Msg *)Msg); // Can_Write((st_CAN_Msg *)Msg);
// return 0; // return 0;
// } // }
// void Can_Write(st_CAN_Msg *Msg) // void Can_Write(st_CAN_Msg *Msg)
// { // {
uint32_t i = 0; uint32_t i = 0;
CanTxRxMsg CAN_SendMsg; CanTxRxMsg CAN_SendMsg;
uint8_t CAN_result = 0; uint8_t CAN_result = 0;
...@@ -341,7 +360,7 @@ uint8_t COM_APP_Process(st_CAN_Msg *Msg) ...@@ -341,7 +360,7 @@ uint8_t COM_APP_Process(st_CAN_Msg *Msg)
break; break;
case 0x450: case 0x450:
//if(Can_341_Flg == 1 || Common_GetIgnOnTime() > 2000) // if(Can_341_Flg == 1 || Common_GetIgnOnTime() > 2000)
{ {
CAN_result = CAN_Transmit(CAN0MSG13, &CAN_SendMsg); CAN_result = CAN_Transmit(CAN0MSG13, &CAN_SendMsg);
} }
...@@ -349,7 +368,7 @@ uint8_t COM_APP_Process(st_CAN_Msg *Msg) ...@@ -349,7 +368,7 @@ uint8_t COM_APP_Process(st_CAN_Msg *Msg)
break; break;
case 0x220: case 0x220:
CAN_result = CAN_Transmit(CAN0MSG10, &CAN_SendMsg); CAN_result = CAN_Transmit(CAN0MSG10, &CAN_SendMsg);
if(AliveCountTimer < 7) if (AliveCountTimer < 7)
{ {
AliveCountTimer++; AliveCountTimer++;
} }
...@@ -360,7 +379,7 @@ uint8_t COM_APP_Process(st_CAN_Msg *Msg) ...@@ -360,7 +379,7 @@ uint8_t COM_APP_Process(st_CAN_Msg *Msg)
break; break;
#if (IC_Current == TY200_080000b_ty) #if (IC_Current == TY200_080000b_ty)
case 0x580: case 0x580:
if(Get_Tpms_TX_Flag() != 0 ) if (Get_Tpms_TX_Flag() != 0)
{ {
CAN_result = CAN_Transmit(CAN0MSG14, &CAN_SendMsg); CAN_result = CAN_Transmit(CAN0MSG14, &CAN_SendMsg);
} }
......
...@@ -27,7 +27,7 @@ typedef struct ...@@ -27,7 +27,7 @@ typedef struct
uint8_t Status; uint8_t Status;
uint8_t Timer; uint8_t Timer;
uint8_t Cnt; uint8_t Cnt;
uint8_t ReportDTCCnt; uint8_t RecoverTimer;
} RSCAN0BusoffMonitorStruct; } RSCAN0BusoffMonitorStruct;
......
...@@ -224,7 +224,7 @@ void Data_Coolant_Temp_Display ( void ) ...@@ -224,7 +224,7 @@ void Data_Coolant_Temp_Display ( void )
void Get_Coolant_Temp_Seg(uint16_t Temp_Value) void Get_Coolant_Temp_Seg(uint16_t Temp_Value)
{ {
uint8_t TempSeg; //uint8_t TempSeg;
//uint8_t CurTempSeg; //uint8_t CurTempSeg;
if(Temp_Value < 50) if(Temp_Value < 50)
......
...@@ -2,8 +2,10 @@ ...@@ -2,8 +2,10 @@
#include "Data_TPMS\Data_TPMS.h" #include "Data_TPMS\Data_TPMS.h"
_TPMS_Display TPMS; _TPMS_Display TPMS;
uint32_t LearnTime_Count = 0; uint32_t Front_LearnTime_Count0 = 0;
uint32_t LearnTime_Count1 = 0; uint32_t Front_LearnTime_Count1 = 0;
uint32_t Rear_LearnTime_Count0 = 0;
uint32_t Rear_LearnTime_Count1 = 0;
uint8_t Can_341_Flg = 0; uint8_t Can_341_Flg = 0;
void Data_TPMS_KL30_Init ( void ) void Data_TPMS_KL30_Init ( void )
{ {
...@@ -26,8 +28,10 @@ void Data_TPMS_KL30_Init ( void ) ...@@ -26,8 +28,10 @@ void Data_TPMS_KL30_Init ( void )
TPMS.TPMS_Rear_FirstLearn_Flag = MenuData.TPMS_Rear_FirstLearn_Flag; TPMS.TPMS_Rear_FirstLearn_Flag = MenuData.TPMS_Rear_FirstLearn_Flag;
TPMS.TPMS_LOST = 0; TPMS.TPMS_LOST = 0;
LearnTime_Count = 0;//6001; Front_LearnTime_Count0 = 0;
LearnTime_Count1 = 0;//6001; Front_LearnTime_Count1 = 0;
Rear_LearnTime_Count0 = 0;
Rear_LearnTime_Count1 = 0;
Can_341_Flg = 0; Can_341_Flg = 0;
} }
...@@ -45,8 +49,11 @@ void Data_TPMS_KL15_WAKE_UP_Init ( void ) ...@@ -45,8 +49,11 @@ void Data_TPMS_KL15_WAKE_UP_Init ( void )
TPMS.TPMS_Rear_FirstLearn_Flag = MenuData.TPMS_Rear_FirstLearn_Flag; TPMS.TPMS_Rear_FirstLearn_Flag = MenuData.TPMS_Rear_FirstLearn_Flag;
TPMS.TPMS_LOST = 0; TPMS.TPMS_LOST = 0;
LearnTime_Count = 0;//6001;
LearnTime_Count1 = 0;//6001; Front_LearnTime_Count0 = 0;
Front_LearnTime_Count1 = 0;
Rear_LearnTime_Count0 = 0;
Rear_LearnTime_Count1 = 0;
Can_341_Flg = 0; Can_341_Flg = 0;
} }
...@@ -88,15 +95,25 @@ void Data_TPMS_Processing_Service ( void ) ...@@ -88,15 +95,25 @@ void Data_TPMS_Processing_Service ( void )
TPMS.TPMS_Rear_ID_Value = 0; TPMS.TPMS_Rear_ID_Value = 0;
} }
if((Get_CAN_CH0_ID_373_Sig_Front_id() != 0) && (Get_CAN_CH0_ID_373_Sig_Front_id() != 0xFFFFFFFF)) if((Get_CAN_CH0_ID_373_Sig_Front_id() != 0) && (Get_CAN_CH0_ID_373_Sig_Front_id() != 0xFFFFFFFF))
{ {
TPMS.TPMS_Front_ID_Value = 1; TPMS.TPMS_Front_ID_Value = 1;
//TPMS.TPMS_Front_Learn = LearningCompletion;
} }
else else
{ {
TPMS.TPMS_Front_ID_Value = 0; TPMS.TPMS_Front_ID_Value = 0;
} }
if((Get_CAN_CH0_ID_373_Sig_Rear_id() != 0) && (Get_CAN_CH0_ID_373_Sig_Rear_id() != 0xFFFFFFFF))
{
TPMS.TPMS_Rear_ID_Value = 1;
}
else
{
TPMS.TPMS_Rear_ID_Value = 0;
}
} }
else else
{ {
...@@ -107,20 +124,22 @@ void Data_TPMS_Processing_Service ( void ) ...@@ -107,20 +124,22 @@ void Data_TPMS_Processing_Service ( void )
if(TPMS.TPMS_Front_Learn == 0x0) if(TPMS.TPMS_Front_Learn == 0x0)
{ {
if(LearnTime_Count <= 6000)
{
LearnTime_Count++;
//if(TPMS.TPMS_Front_Timeclean == 0)
//{
// LearnTime_Count = 0;
//}
//TPMS.TPMS_Front_Timeclean = 1;
Front_LearnTime_Count1 = 0;
if(Front_LearnTime_Count0 <= 6000)
{
Front_LearnTime_Count0++;
TPMS.TPMS_Front_Learn = Unstudied; TPMS.TPMS_Front_Learn = Unstudied;
//LearnTime_Count = 0; //LearnTime_Count = 0;
} }
else else
{ {
if(TPMS.TPMS_Front_Timeclean == 1)
{
LearnTime_Count = 0;
}
TPMS.TPMS_Front_Timeclean = 0;
if ((MenuData.TPMS_Front_Learn != 0x2) && (MenuData.TPMS_Front_Learn != 0x3) ) if ((MenuData.TPMS_Front_Learn != 0x2) && (MenuData.TPMS_Front_Learn != 0x3) )
{ {
if(CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CAN_0x341_Msg_Count) != CAN_SIG_LOST) if(CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CAN_0x341_Msg_Count) != CAN_SIG_LOST)
...@@ -151,14 +170,15 @@ void Data_TPMS_Processing_Service ( void ) ...@@ -151,14 +170,15 @@ void Data_TPMS_Processing_Service ( void )
// TPMS.TPMS_Front_ID_Value = 0; // TPMS.TPMS_Front_ID_Value = 0;
//} //}
if(TPMS.TPMS_Front_Timeclean == 0) //if(TPMS.TPMS_Front_Timeclean == 0)
{ //{
LearnTime_Count = 0; // LearnTime_Count = 0;
} //}
TPMS.TPMS_Front_Timeclean = 1; //TPMS.TPMS_Front_Timeclean = 1;
if(LearnTime_Count <= 6000) Front_LearnTime_Count0 = 0;
if(Front_LearnTime_Count1 <= 6000)
{ {
LearnTime_Count++; Front_LearnTime_Count1++;
TPMS.TPMS_Front_Learn = Learning; TPMS.TPMS_Front_Learn = Learning;
} }
else else
...@@ -182,7 +202,8 @@ void Data_TPMS_Processing_Service ( void ) ...@@ -182,7 +202,8 @@ void Data_TPMS_Processing_Service ( void )
} }
else if (TPMS.TPMS_Front_Learn == 0x2) else if (TPMS.TPMS_Front_Learn == 0x2)
{ {
LearnTime_Count = 0; Front_LearnTime_Count0 = 0;
Front_LearnTime_Count1 = 0;
//if((Get_CAN_CH0_ID_373_Sig_Front_id() != 0) && (Get_CAN_CH0_ID_373_Sig_Front_id() != 0xFFFFFFFF)) //if((Get_CAN_CH0_ID_373_Sig_Front_id() != 0) && (Get_CAN_CH0_ID_373_Sig_Front_id() != 0xFFFFFFFF))
//{ //{
// TPMS.TPMS_Front_ID_Value = 1; // TPMS.TPMS_Front_ID_Value = 1;
...@@ -196,29 +217,34 @@ void Data_TPMS_Processing_Service ( void ) ...@@ -196,29 +217,34 @@ void Data_TPMS_Processing_Service ( void )
} }
else if (TPMS.TPMS_Front_Learn == 0x3) else if (TPMS.TPMS_Front_Learn == 0x3)
{ {
LearnTime_Count = 0; Front_LearnTime_Count0 = 0;
Front_LearnTime_Count1 = 0;
TPMS.TPMS_Front_Learn = LearningFailure; TPMS.TPMS_Front_Learn = LearningFailure;
} }
else else
{ {
LearnTime_Count = 0; Front_LearnTime_Count0 = 0;
Front_LearnTime_Count1 = 0;
TPMS.TPMS_Front_Learn = MenuData.TPMS_Front_Learn; TPMS.TPMS_Front_Learn = MenuData.TPMS_Front_Learn;
} }
if(TPMS.TPMS_Rear_Learn == 0x0) if(TPMS.TPMS_Rear_Learn == 0x0)
{ {
if(LearnTime_Count1 <= 6000)
//if(TPMS.TPMS_Rear_Timeclean == 0)
//{
// LearnTime_Count1 = 0;
//}
//TPMS.TPMS_Rear_Timeclean = 1;
Rear_LearnTime_Count1 = 0;
if(Rear_LearnTime_Count0 <= 6000)
{ {
LearnTime_Count1++;// = 0; Rear_LearnTime_Count0++;// = 0;
TPMS.TPMS_Rear_Learn = Unstudied; TPMS.TPMS_Rear_Learn = Unstudied;
} }
else else
{ {
if(TPMS.TPMS_Rear_Timeclean == 1)
{
LearnTime_Count1 = 0;
}
TPMS.TPMS_Rear_Timeclean = 0;
if ((MenuData.TPMS_Rear_Learn != 0x2) && (MenuData.TPMS_Rear_Learn != 0x3) ) if ((MenuData.TPMS_Rear_Learn != 0x2) && (MenuData.TPMS_Rear_Learn != 0x3) )
{ {
if(CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CAN_0x341_Msg_Count) != CAN_SIG_LOST) if(CAN_MSG_Status(&CAN_CH0_CanMsgOp, CAN_CH0_ID_CAN_0x341_Msg_Count) != CAN_SIG_LOST)
...@@ -238,15 +264,15 @@ void Data_TPMS_Processing_Service ( void ) ...@@ -238,15 +264,15 @@ void Data_TPMS_Processing_Service ( void )
} }
else if(TPMS.TPMS_Rear_Learn == 0x1) else if(TPMS.TPMS_Rear_Learn == 0x1)
{ {
if(TPMS.TPMS_Rear_Timeclean == 0) //if(TPMS.TPMS_Rear_Timeclean == 0)
{ //{
LearnTime_Count1 = 0; // LearnTime_Count1 = 0;
} //}
TPMS.TPMS_Rear_Timeclean = 1; //TPMS.TPMS_Rear_Timeclean = 1;
Rear_LearnTime_Count0 = 0;
if(LearnTime_Count1 <= 6000) if(Rear_LearnTime_Count1 <= 6000)
{ {
LearnTime_Count1++; Rear_LearnTime_Count1++;
TPMS.TPMS_Rear_Learn = Learning; TPMS.TPMS_Rear_Learn = Learning;
} }
else else
...@@ -271,26 +297,19 @@ void Data_TPMS_Processing_Service ( void ) ...@@ -271,26 +297,19 @@ void Data_TPMS_Processing_Service ( void )
} }
else if (TPMS.TPMS_Rear_Learn == 0x2) else if (TPMS.TPMS_Rear_Learn == 0x2)
{ {
LearnTime_Count1 = 0; Rear_LearnTime_Count0 = 0;
if((Get_CAN_CH0_ID_373_Sig_Rear_id() != 0) && (Get_CAN_CH0_ID_373_Sig_Rear_id() != 0xFFFFFFFF)) Rear_LearnTime_Count1 = 0;
{
TPMS.TPMS_Rear_ID_Value = 1;
//TPMS.TPMS_Rear_Learn = LearningCompletion;
}
else
{
TPMS.TPMS_Rear_ID_Value = 0;
}
} }
else if (TPMS.TPMS_Rear_Learn == 0x3) else if (TPMS.TPMS_Rear_Learn == 0x3)
{ {
LearnTime_Count1 = 0; Rear_LearnTime_Count0 = 0;
Rear_LearnTime_Count1 = 0;
TPMS.TPMS_Rear_Learn = LearningFailure; TPMS.TPMS_Rear_Learn = LearningFailure;
} }
else else
{ {
LearnTime_Count1 = 0; Rear_LearnTime_Count0 = 0;
Rear_LearnTime_Count1 = 0;
TPMS.TPMS_Rear_Learn = MenuData.TPMS_Front_Learn; TPMS.TPMS_Rear_Learn = MenuData.TPMS_Front_Learn;
} }
...@@ -600,6 +619,16 @@ uint8_t Get_Rear_FirstLearn_Flag (void) ...@@ -600,6 +619,16 @@ uint8_t Get_Rear_FirstLearn_Flag (void)
return TPMS.TPMS_Rear_FirstLearn_Flag; return TPMS.TPMS_Rear_FirstLearn_Flag;
} }
uint8_t Get_TPMS_Front_Learn(void)
{
return TPMS.TPMS_Front_Learn;
}
uint8_t Get_TPMS_Rear_Learn(void)
{
return TPMS.TPMS_Rear_Learn;
}
/*获取0x341是否掉线 0-掉线 “--”闪烁 1-在线 获取学习结果进行显示*/ /*获取0x341是否掉线 0-掉线 “--”闪烁 1-在线 获取学习结果进行显示*/
uint8_t Get_TPMS_CAN_LOST (void) uint8_t Get_TPMS_CAN_LOST (void)
{ {
......
...@@ -46,6 +46,8 @@ void Data_TPMS_KL15_WAKE_UP_Init ( void ); ...@@ -46,6 +46,8 @@ void Data_TPMS_KL15_WAKE_UP_Init ( void );
uint8_t Get_Front_FirstLearn_Flag (void); uint8_t Get_Front_FirstLearn_Flag (void);
uint8_t Get_Rear_FirstLearn_Flag (void); uint8_t Get_Rear_FirstLearn_Flag (void);
uint8_t Get_TPMS_CAN_LOST (void); uint8_t Get_TPMS_CAN_LOST (void);
uint8_t Get_TPMS_Front_Learn(void);
uint8_t Get_TPMS_Rear_Learn(void);
void Can_341_Receive(void); void Can_341_Receive(void);
#endif #endif
...@@ -123,12 +123,16 @@ void Gauge_Service(void) ...@@ -123,12 +123,16 @@ void Gauge_Service(void)
SEG_SET_Voltage_NUM(1, Get_Battery_Voltage()); SEG_SET_Voltage_NUM(1, Get_Battery_Voltage());
#if(IC_Current == TY200_080000b_ty) #if(IC_Current == TY200_080000b_ty)
SEG_SET_TPMS_DISPLAY(1, Get_Front_TPMS_Sig_Value(), Get_Rear_TPMS_Sig_Value(), 0 ,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(), 0 ,Get_Front_TPMS_Sig_Vaild(), Get_Rear_TPMS_Sig_Vaild());
LED_Driver_Channel_Set(LampChannel_0, LampCh0_03, LED_ON);
LED_Driver_Channel_Set(LampChannel_0, LampCh0_04, LED_ON);
#endif #endif
SEG_SET_Navigation_STS(Get_Navigation_St_Dis(),Get_Navigation_Code_Dis(),Get_Navigation_Mileage_Dis()); SEG_SET_Navigation_STS(Get_Navigation_St_Dis(),Get_Navigation_Code_Dis(),Get_Navigation_Mileage_Dis());
} }
else else
{ {
LED_Driver_Channel_Set(LampChannel_0, LampCh0_03, LED_ON);
LED_Driver_Channel_Set(LampChannel_0, LampCh0_04, LED_ON);
Checkself_SEG_Display(); Checkself_SEG_Display();
} }
} }
...@@ -136,6 +140,9 @@ void Gauge_Service(void) ...@@ -136,6 +140,9 @@ void Gauge_Service(void)
{ {
Clear_Bu98(); Clear_Bu98();
LED_Driver_Channel_Set(LampChannel_0, LampCh0_03, LED_OFF);
LED_Driver_Channel_Set(LampChannel_0, LampCh0_04, LED_OFF);
LED_Driver_Channel_Set(LampChannel_0, LampCh0_35_ODO, LED_OFF); LED_Driver_Channel_Set(LampChannel_0, LampCh0_35_ODO, LED_OFF);
LED_Driver_Channel_Set(LampChannel_0, LampCh0_34_TRIP, LED_OFF); LED_Driver_Channel_Set(LampChannel_0, LampCh0_34_TRIP, LED_OFF);
LED_Driver_Channel_Set(LampChannel_0, LampCh0_07_Screen_Time, LED_OFF); LED_Driver_Channel_Set(LampChannel_0, LampCh0_07_Screen_Time, LED_OFF);
......
...@@ -149,6 +149,8 @@ void BU98R10_Init(void) ...@@ -149,6 +149,8 @@ void BU98R10_Init(void)
BU98R10_All_Command_Write(BU98R10_CMD_SWRST); BU98R10_All_Command_Write(BU98R10_CMD_SWRST);
Gen_TimeDelay(20*1000, 50U);
BU98R10_All_Command_Write(BU98R10_CMD_ICSET | BU98R10_PAR_ICSET_RGB); BU98R10_All_Command_Write(BU98R10_CMD_ICSET | BU98R10_PAR_ICSET_RGB);
BU98R10_All_Command_Write(BU98R10_CMD_DRVCTRL | BU98R10_PAR_DRVCTRL_NORMAL); BU98R10_All_Command_Write(BU98R10_CMD_DRVCTRL | BU98R10_PAR_DRVCTRL_NORMAL);
......
...@@ -13,7 +13,7 @@ const Line_In_Attribute_st g_stLineInAttribute[LINE_IN_MAX] = ...@@ -13,7 +13,7 @@ const Line_In_Attribute_st g_stLineInAttribute[LINE_IN_MAX] =
{LEVEL_HIGH, LEVEL_LOW, LINE_IN_IG_ON, 170U, 20U, Get_LINE_IN_Fault_ABS, }, {LEVEL_HIGH, LEVEL_LOW, LINE_IN_IG_ON, 170U, 20U, Get_LINE_IN_Fault_ABS, },
{LEVEL_HIGH, LEVEL_LOW, LINE_IN_IG_ON, 500U, 20U, Get_LINE_IN_Oil_Pressure, }, {LEVEL_HIGH, LEVEL_LOW, LINE_IN_IG_ON, 500U, 20U, Get_LINE_IN_Oil_Pressure, },
{LEVEL_HIGH, LEVEL_LOW, LINE_IN_IG_ON, 150U, 20U, Get_LINE_IN_Auto_Start_Stop, }, {LEVEL_HIGH, LEVEL_LOW, LINE_IN_IG_ON, 150U, 20U, Get_LINE_IN_Auto_Start_Stop, },
{LEVEL_LOW, LEVEL_HIGH, LINE_IN_IG_ON, 100U, 20U, Get_LINE_IN_Little_Lamp, }, {LEVEL_LOW, LEVEL_HIGH, LINE_IN_IG_ON, 500U, 500U, Get_LINE_IN_Little_Lamp, },
}; };
Linelib_uint8_t Get_LINE_IN_Little_Lamp(void) Linelib_uint8_t Get_LINE_IN_Little_Lamp(void)
......
...@@ -246,7 +246,7 @@ void CGC_LSEConfig(OSC_Pin_Mode_t sub, OSC_Power_Mode_t amphs) ...@@ -246,7 +246,7 @@ void CGC_LSEConfig(OSC_Pin_Mode_t sub, OSC_Power_Mode_t amphs)
/** /**
* @brief Configures the External High Speed oscillator (HSE). * @brief Configures the External High Speed oscillator (HSE).
* @note External High Speed oscillator clock source can be choose from PORT * @note External High Speed oscillator clock source can be choose from PORT��
* OSC_OSCILLATOR or external input clock. * OSC_OSCILLATOR or external input clock.
* at same time, OSC_OSCILLATOR can be 1MHz < fx < 10MHz or 10MHz < fx < 20MHz * at same time, OSC_OSCILLATOR can be 1MHz < fx < 10MHz or 10MHz < fx < 20MHz
* @param pinMode * @param pinMode
...@@ -438,7 +438,7 @@ void CGC_PLL_Setting(PLL_Src_t src, PLL_Div_t div, PLL_Mul_t mul) ...@@ -438,7 +438,7 @@ void CGC_PLL_Setting(PLL_Src_t src, PLL_Div_t div, PLL_Mul_t mul)
* @note * @note
* @retval None * @retval None
*/ */
void CGC_PLL_CFG_AS_FCLK(void) __attribute__((section("RW_FUNC_PLL"))) void CGC_PLL_CFG_AS_FCLK(void)
{ {
CGC->MCKC = 0x01; CGC->MCKC = 0x01;
while((CGC->MCKC & CGC_MCKC_CKSTR_Msk) == 0); while((CGC->MCKC & CGC_MCKC_CKSTR_Msk) == 0);
......
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