Commit 019a21ee authored by 李俭双's avatar 李俭双

🐞 fix:代码评审问题:can外发中使用局部变量接外来值进行计算

parent 75e823da
......@@ -14,6 +14,8 @@ void Can_Set_Buff_220(canlib_uint8_t CopyData[])
{
CANMsg220Union *p220;
uint8_t i = 0;
uint8_t u8TCSVal = 0;
u8TCSVal = Get_Dis_Tcs_Val();
p220 = (CANMsg220Union *)CopyData;
if ( p220 != ( void * )0 )
......@@ -23,9 +25,9 @@ void Can_Set_Buff_220(canlib_uint8_t CopyData[])
p220->Msg [ i ] = 0x0u;
}
p220 -> Sig.TCS_TX = Get_Dis_Tcs_Val();
p220 -> Sig.TCS_TX = u8TCSVal;
p220 -> Sig.AliveCounter = AliveCountTimer;
p220 -> Sig.CheckSum = (Get_Dis_Tcs_Val() == 1) ? 8 : 0;
p220 -> Sig.CheckSum = (u8TCSVal == 1) ? 8 : 0;
}
......@@ -36,8 +38,10 @@ void Can_Set_Buff_6EE(canlib_uint8_t CopyData[])
CANMsg6EEUnion *p6EE;
uint8_t i = 0;
uint16_t Vspeed_tx = 0;
uint16_t Fuel_tx = 0;
uint32_t ODO_tx = Data_ODO_Read();
Vspeed_tx = Get_DispVechileSpeed_TX()/10;
Fuel_tx = Get_Fuel_RES();
p6EE = (CANMsg6EEUnion *)CopyData;
if ( p6EE != ( void * )0 )
......@@ -49,13 +53,13 @@ void Can_Set_Buff_6EE(canlib_uint8_t CopyData[])
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(Get_Fuel_RES() > 255)
if(Fuel_tx > 255)
{
p6EE -> Sig.Fuel_Res_TX = 0xFF ;
}
else
{
p6EE -> Sig.Fuel_Res_TX = Get_Fuel_RES() ;
p6EE -> Sig.Fuel_Res_TX = Fuel_tx ;
}
}
......@@ -105,6 +109,9 @@ void Can_Set_Buff_450(canlib_uint8_t CopyData[])
uint16_t u16FrontTpms = 0;
uint16_t u16RearTpms = 0;
uint16_t u16FrontTpmsValue = Get_Front_TPMS_TX();
uint16_t u16RearTpmsValue = Get_Rear_TPMS_TX();
p450 = (CANMsg450Union *)CopyData;
if ( p450 != ( void * )0 )
{
......@@ -122,9 +129,9 @@ void Can_Set_Buff_450(canlib_uint8_t CopyData[])
}
else
{
if((Get_Front_TPMS_TX() + 146) <= 1000U)
if((u16FrontTpmsValue + 146) <= 1000U)
{
u16FrontTpms = (Get_Front_TPMS_TX() + 146);
u16FrontTpms = (u16FrontTpmsValue + 146);
}
else
{
......@@ -143,9 +150,9 @@ void Can_Set_Buff_450(canlib_uint8_t CopyData[])
}
else
{
if((Get_Rear_TPMS_TX() + 146) <= 1000U)
if((u16RearTpmsValue + 146) <= 1000U)
{
u16RearTpms = (Get_Rear_TPMS_TX() + 146);
u16RearTpms = (u16RearTpmsValue + 146);
}
else
{
......@@ -163,7 +170,7 @@ void Can_Set_Buff_580(canlib_uint8_t CopyData[])
{
CANMsg580Union *p580;
uint8_t i = 0;
uint8_t u8TpmsFlag = Get_Tpms_TX_Flag() ;
p580 = (CANMsg580Union *)CopyData;
if ( p580 != ( void * )0 )
{
......@@ -172,7 +179,7 @@ void Can_Set_Buff_580(canlib_uint8_t CopyData[])
p580->Msg [ i ] = 0x0u;
}
if(Get_Tpms_TX_Flag() == 1)
if(u8TpmsFlag == 1)
{
//Can_580Send_flag = 1;
//if(CAN_TX_Count++ > 2)
......@@ -192,7 +199,7 @@ void Can_Set_Buff_580(canlib_uint8_t CopyData[])
// CAN_TX_Count++;
//}
}
else if(Get_Tpms_TX_Flag() == 2)
else if(u8TpmsFlag == 2)
{
//Can_580Send_flag = 1;
//if(CAN_TX_Count++ > 2)
......
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