Commit 024bf516 authored by 李俭双's avatar 李俭双

Merge branch 'CHENJIALE' into 'dev'

Chenjiale

See merge request !42
parents 70ab7aec b10863a3
......@@ -2,7 +2,14 @@
#include "Components.h"
#include "Application.h"
uint16_t CAN_TX_Count = 0;
uint16_t AliveCountTimer = 0;
extern uint8_t Tpms_TX_Flag;
void CAN_TX_Count_Init(void)
{
CAN_TX_Count = 0;
AliveCountTimer = 0;
}
void Can_Set_Buff_220(canlib_uint8_t CopyData[])
{
CANMsg220Union *p220;
......@@ -17,6 +24,17 @@ void Can_Set_Buff_220(canlib_uint8_t CopyData[])
}
p220 -> Sig.TCS_TX = Get_Dis_Tcs_Val();
p220 -> Sig.AliveCounter = AliveCountTimer;
p220 -> Sig.CheckSum = (Get_Dis_Tcs_Val() == 1) ? 8 : 0;
}
if(AliveCountTimer < 7)
{
AliveCountTimer++;
}
else
{
AliveCountTimer = 0;
}
}
......@@ -25,7 +43,7 @@ void Can_Set_Buff_6EE(canlib_uint8_t CopyData[])
CANMsg6EEUnion *p6EE;
uint8_t i = 0;
uint16_t Vspeed_tx = 0;
uint32_t ODO_tx = Data_ODO_Read() / 10;
uint32_t ODO_tx = Data_ODO_Read();
Vspeed_tx = Get_DispVechileSpeed_TX()/10;
p6EE = (CANMsg6EEUnion *)CopyData;
......@@ -106,8 +124,8 @@ void Can_Set_Buff_450(canlib_uint8_t CopyData[])
}
else
{
p450 -> Sig.Front_Pressure_TX_H = (Get_Front_TPMS_TX() >> 8) & 0xFF;
p450 -> Sig.Front_Pressure_TX_L = Get_Front_TPMS_TX() & 0xFF;
p450 -> Sig.Front_Pressure_TX_H = ((Get_Front_TPMS_TX() + 146) >> 8) & 0xFF;
p450 -> Sig.Front_Pressure_TX_L = (Get_Front_TPMS_TX() + 146) & 0xFF;
}
if(MenuData.TPMS_Rear_Learn == 0)
{
......@@ -116,13 +134,14 @@ void Can_Set_Buff_450(canlib_uint8_t CopyData[])
}
else
{
p450 -> Sig.Rear_Pressure_TX_H = (Get_Rear_TPMS_TX() >> 8) & 0xFF;
p450 -> Sig.Rear_Pressure_TX_L = Get_Rear_TPMS_TX() & 0xFF;
p450 -> Sig.Rear_Pressure_TX_H = ((Get_Rear_TPMS_TX() + 146) >> 8) & 0xFF;
p450 -> Sig.Rear_Pressure_TX_L = (Get_Rear_TPMS_TX() + 146) & 0xFF;
}
}
}
void Can_Set_Buff_580(canlib_uint8_t CopyData[])
{
CANMsg580Union *p580;
......@@ -138,6 +157,11 @@ void Can_Set_Buff_580(canlib_uint8_t CopyData[])
if(Get_Tpms_TX_Flag() == 1)
{
if(++CAN_TX_Count >= 3)
{
Tpms_TX_Flag = 0;
CAN_TX_Count = 0;
}
p580 -> Sig.TPMS_LEARN_CND_BYTE0 = 0x31;
p580 -> Sig.TPMS_LEARN_CND_BYTE1 = 0x01;
p580 -> Sig.TPMS_LEARN_CND_BYTE2 = 0x59;
......@@ -146,6 +170,11 @@ void Can_Set_Buff_580(canlib_uint8_t CopyData[])
}
else if(Get_Tpms_TX_Flag() == 2)
{
if(++CAN_TX_Count >= 3)
{
Tpms_TX_Flag = 0;
CAN_TX_Count = 0;
}
p580 -> Sig.TPMS_LEARN_CND_BYTE0 = 0x31;
p580 -> Sig.TPMS_LEARN_CND_BYTE1 = 0x01;
p580 -> Sig.TPMS_LEARN_CND_BYTE2 = 0x59;
......@@ -154,6 +183,7 @@ void Can_Set_Buff_580(canlib_uint8_t CopyData[])
}
else
{
CAN_TX_Count = 0;
p580 -> Sig.TPMS_LEARN_CND_BYTE0 = 0x0;
p580 -> Sig.TPMS_LEARN_CND_BYTE1 = 0x0;
p580 -> Sig.TPMS_LEARN_CND_BYTE2 = 0x0;
......
......@@ -19,8 +19,9 @@ typedef union
uint32_t Res3: 16;
uint32_t Res4: 16;
uint32_t Res5: 8;
uint32_t AliveCounter: 3;
uint32_t CheckSum: 5;
uint32_t AliveCounter: 3;
} Sig;
} CANMsg220Union;
......
......@@ -260,7 +260,14 @@ void Data_TPMS_Processing_Service ( void )
{
MenuData.TPMS_Rear_Learn = TPMS.TPMS_Rear_Learn;
}
if((TPMS.TPMS_Front_Learn == 0x2) || (TPMS.TPMS_Front_Learn == 0x3) || (TPMS.TPMS_Rear_Learn == 0x2) || (TPMS.TPMS_Rear_Learn == 0x3))
if(((TPMS.TPMS_Front_Learn == 0x2) || (TPMS.TPMS_Front_Learn == 0x3)) && (TPMS.TPMS_Front_Learn != MenuData.TPMS_Front_Learn))
{
TPMS_L[0] = MenuData.TPMS_Front_Learn;
TPMS_L[1] = MenuData.TPMS_Rear_Learn;
Data_User_EEPROM_Write(EM_MenuData_TPMS_LEARN, (uint32_t*)TPMS_L, 1u);
}
if( ((TPMS.TPMS_Rear_Learn == 0x2) || (TPMS.TPMS_Rear_Learn == 0x3)) && (TPMS.TPMS_Rear_Learn != MenuData.TPMS_Rear_Learn))
{
TPMS_L[0] = MenuData.TPMS_Front_Learn;
TPMS_L[1] = MenuData.TPMS_Rear_Learn;
......
......@@ -2130,14 +2130,14 @@ void SEG_SET_TPMS_DISPLAY(uint8_t m_Flag, uint16_t m_NUM1, uint16_t m_NUM2, uint
IC2_SEG109 = IC_SEG_OFF;
IC2_SEG110 = IC_SEG_ON;
if(Get_TPMS_CAN_LOST() == 0)
if((Get_TPMS_CAN_LOST() == 0))
{
IC2_SEG138 = IC_SEG_ON;
IC2_SEG118 = IC_SEG_ON;
}
else
{
if ((Get_Current_PageType() == Page_Front_Tpms) || (Get_Front_FirstLearn_Flag() == 1) || (Get_Front_FirstLearn_Flag() == 3))
if ((Get_Current_PageType() == Page_Front_Tpms) || (Get_Front_FirstLearn_Flag() == 1) )
{
if (FLASH_SYNC_1Hz)
{
......@@ -2153,7 +2153,7 @@ void SEG_SET_TPMS_DISPLAY(uint8_t m_Flag, uint16_t m_NUM1, uint16_t m_NUM2, uint
IC2_SEG138 = IC_SEG_ON;
}
if ((Get_Current_PageType() == Page_Rear_Tpms) || (Get_Rear_FirstLearn_Flag() == 1) || (Get_Rear_FirstLearn_Flag() == 3))
if ((Get_Current_PageType() == Page_Rear_Tpms) || (Get_Rear_FirstLearn_Flag() == 1))
{
if (FLASH_SYNC_1Hz)
{
......@@ -2180,7 +2180,7 @@ void SEG_SET_TPMS_DISPLAY(uint8_t m_Flag, uint16_t m_NUM1, uint16_t m_NUM2, uint
IC2_SEG138 = IC_SEG_OFF;
}
}
if(Get_TPMS_CAN_LOST() == 0)
if(Get_TPMS_CAN_LOST() == 0 )
{
if (Get_Current_PageType() == Page_Front_Tpms)
{
......@@ -2706,30 +2706,14 @@ void SEG_SET_FRONT_TPMS_NUM(uint8_t learnflag, uint16_t m_NUM1, uint8_t m_valid1
}
else if (learnflag == 3)
{
if (FLASH_SYNC_1Hz)
{
//if (FLASH_SYNC_1Hz)
//{
IC2_SEG138 = IC_SEG_ON;
IC2_SEG140 = IC_SEG_ON;
IC2_SEG133 = IC_SEG_ON;
IC2_SEG143 = IC_SEG_ON;
IC2_SEG141 = IC_SEG_ON;
IC2_SEG139 = IC_SEG_ON;
IC2_SEG146 = IC_SEG_ON;
IC2_SEG145 = IC_SEG_OFF;
IC2_SEG144 = IC_SEG_ON;
IC2_SEG135 = IC_SEG_ON;
IC2_SEG134 = IC_SEG_ON;
IC2_SEG132 = IC_SEG_ON;
IC2_SEG131 = IC_SEG_ON;
IC2_SEG137 = IC_SEG_OFF;
IC2_SEG136 = IC_SEG_ON;
}
else
{
IC2_SEG140 = IC_SEG_OFF;
IC2_SEG133 = IC_SEG_OFF;
IC2_SEG143 = IC_SEG_OFF;
IC2_SEG141 = IC_SEG_OFF;
IC2_SEG139 = IC_SEG_OFF;
......@@ -2743,7 +2727,29 @@ void SEG_SET_FRONT_TPMS_NUM(uint8_t learnflag, uint16_t m_NUM1, uint8_t m_valid1
IC2_SEG131 = IC_SEG_OFF;
IC2_SEG137 = IC_SEG_OFF;
IC2_SEG136 = IC_SEG_OFF;
}
//}
//else
//{
// IC2_SEG138 = IC_SEG_OFF;
//
// IC2_SEG140 = IC_SEG_OFF;
// IC2_SEG133 = IC_SEG_OFF;
//
// IC2_SEG143 = IC_SEG_OFF;
// IC2_SEG141 = IC_SEG_OFF;
// IC2_SEG139 = IC_SEG_OFF;
// IC2_SEG146 = IC_SEG_OFF;
// IC2_SEG145 = IC_SEG_OFF;
// IC2_SEG144 = IC_SEG_OFF;
//
// IC2_SEG135 = IC_SEG_OFF;
// IC2_SEG134 = IC_SEG_OFF;
// IC2_SEG132 = IC_SEG_OFF;
// IC2_SEG131 = IC_SEG_OFF;
// IC2_SEG137 = IC_SEG_OFF;
// IC2_SEG136 = IC_SEG_OFF;
//}
}
else
{
......@@ -3156,29 +3162,17 @@ void SEG_SET_Rear_TPMS_NUM(uint8_t learnflag, uint16_t m_NUM2, uint8_t m_valid2)
}
else if (learnflag == 3)
{
if (FLASH_SYNC_1Hz)
{
//IC2_SEG118 = IC_SEG_ON;
//IC2_SEG120 = IC_SEG_ON;
//IC2_SEG113 = IC_SEG_ON;
//if (FLASH_SYNC_1Hz)
//{
IC2_SEG120 = IC_SEG_ON;
IC2_SEG113 = IC_SEG_ON;
IC2_SEG123 = IC_SEG_ON;
IC2_SEG121 = IC_SEG_ON;
IC2_SEG119 = IC_SEG_ON;
IC2_SEG126 = IC_SEG_ON;
IC2_SEG125 = IC_SEG_OFF;
IC2_SEG124 = IC_SEG_ON;
IC2_SEG118 = IC_SEG_ON;
IC2_SEG115 = IC_SEG_ON;
IC2_SEG114 = IC_SEG_ON;
IC2_SEG112 = IC_SEG_ON;
IC2_SEG111 = IC_SEG_ON;
IC2_SEG117 = IC_SEG_OFF;
IC2_SEG116 = IC_SEG_ON;
}
else
{
IC2_SEG120 = IC_SEG_OFF;
IC2_SEG113 = IC_SEG_OFF;
IC2_SEG123 = IC_SEG_OFF;
IC2_SEG121 = IC_SEG_OFF;
......@@ -3193,7 +3187,29 @@ void SEG_SET_Rear_TPMS_NUM(uint8_t learnflag, uint16_t m_NUM2, uint8_t m_valid2)
IC2_SEG111 = IC_SEG_OFF;
IC2_SEG117 = IC_SEG_OFF;
IC2_SEG116 = IC_SEG_OFF;
}
//}
//else
//{
// IC2_SEG120 = IC_SEG_OFF;
// IC2_SEG113 = IC_SEG_OFF;
//
// IC2_SEG118 = IC_SEG_OFF;
//
// IC2_SEG123 = IC_SEG_OFF;
// IC2_SEG121 = IC_SEG_OFF;
// IC2_SEG119 = IC_SEG_OFF;
// IC2_SEG126 = IC_SEG_OFF;
// IC2_SEG125 = IC_SEG_OFF;
// IC2_SEG124 = IC_SEG_OFF;
//
// IC2_SEG115 = IC_SEG_OFF;
// IC2_SEG114 = IC_SEG_OFF;
// IC2_SEG112 = IC_SEG_OFF;
// IC2_SEG111 = IC_SEG_OFF;
// IC2_SEG117 = IC_SEG_OFF;
// IC2_SEG116 = IC_SEG_OFF;
//}
}
else
{
......
......@@ -93,6 +93,8 @@ static void Power_KL30_Init(void)
RTE_DEEPSLEEP_GPIO_Interrupt_Enable(WAKEUP_KL15_In,Trigger_Rising);
FaultCode_Init();
CAN_TX_Count_Init();
}
extern uint32_t PowerIgnOffTimeLine;
static void Power_Wakeup_Init(void)
......@@ -138,6 +140,8 @@ static void Power_Wakeup_Init(void)
Data_TPMS_KL15_WAKE_UP_Init();
RTE_DEEPSLEEP_GPIO_Interrupt_Enable(WAKEUP_KL15_In,Trigger_Rising);
FaultCode_Init();
CAN_TX_Count_Init();
}
static void Power_LVP_Init(void)
......@@ -241,6 +245,7 @@ static Power_Status_em Power_Stay_OFF(void)
return u8PowerSts;
}
extern uint16_t AliveCountTimer;
static Power_Status_em Power_Stay_Protect(void)
{
Power_Status_em u8PowerSts;
......@@ -253,6 +258,7 @@ static Power_Status_em Power_Stay_Protect(void)
BU98R10_Shutdown( );
TimerM_PWM_set_duty(TIMERM_COUNTER1, TIMERM_CHB, 0);
CAN_TX_SetEnable(&CAN_CH0_CanMsgTxOp, CAN_N_TX_Disable);
AliveCountTimer = 0;
}
u8PowerSts = EM_IGN_OFF_Init;
/* 电溝模弝正常 */
......
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