Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
TianYing_ty100
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
TY
TianYing_ty100
Commits
019a21ee
Commit
019a21ee
authored
Sep 10, 2024
by
李俭双
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🐞
fix:代码评审问题:can外发中使用局部变量接外来值进行计算
parent
75e823da
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
11 deletions
+18
-11
Can_App.c
Firmware/Source/Application/CAN_User/Can_App.c
+18
-11
No files found.
Firmware/Source/Application/CAN_User/Can_App.c
View file @
019a21ee
...
@@ -14,6 +14,8 @@ void Can_Set_Buff_220(canlib_uint8_t CopyData[])
...
@@ -14,6 +14,8 @@ void Can_Set_Buff_220(canlib_uint8_t CopyData[])
{
{
CANMsg220Union
*
p220
;
CANMsg220Union
*
p220
;
uint8_t
i
=
0
;
uint8_t
i
=
0
;
uint8_t
u8TCSVal
=
0
;
u8TCSVal
=
Get_Dis_Tcs_Val
();
p220
=
(
CANMsg220Union
*
)
CopyData
;
p220
=
(
CANMsg220Union
*
)
CopyData
;
if
(
p220
!=
(
void
*
)
0
)
if
(
p220
!=
(
void
*
)
0
)
...
@@ -23,9 +25,9 @@ void Can_Set_Buff_220(canlib_uint8_t CopyData[])
...
@@ -23,9 +25,9 @@ void Can_Set_Buff_220(canlib_uint8_t CopyData[])
p220
->
Msg
[
i
]
=
0x0u
;
p220
->
Msg
[
i
]
=
0x0u
;
}
}
p220
->
Sig
.
TCS_TX
=
Get_Dis_Tcs_Val
()
;
p220
->
Sig
.
TCS_TX
=
u8TCSVal
;
p220
->
Sig
.
AliveCounter
=
AliveCountTimer
;
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[])
...
@@ -36,8 +38,10 @@ void Can_Set_Buff_6EE(canlib_uint8_t CopyData[])
CANMsg6EEUnion
*
p6EE
;
CANMsg6EEUnion
*
p6EE
;
uint8_t
i
=
0
;
uint8_t
i
=
0
;
uint16_t
Vspeed_tx
=
0
;
uint16_t
Vspeed_tx
=
0
;
uint16_t
Fuel_tx
=
0
;
uint32_t
ODO_tx
=
Data_ODO_Read
();
uint32_t
ODO_tx
=
Data_ODO_Read
();
Vspeed_tx
=
Get_DispVechileSpeed_TX
()
/
10
;
Vspeed_tx
=
Get_DispVechileSpeed_TX
()
/
10
;
Fuel_tx
=
Get_Fuel_RES
();
p6EE
=
(
CANMsg6EEUnion
*
)
CopyData
;
p6EE
=
(
CANMsg6EEUnion
*
)
CopyData
;
if
(
p6EE
!=
(
void
*
)
0
)
if
(
p6EE
!=
(
void
*
)
0
)
...
@@ -49,13 +53,13 @@ void Can_Set_Buff_6EE(canlib_uint8_t CopyData[])
...
@@ -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_H
=
(
ODO_tx
>>
16
)
&
0xFF
;
p6EE
->
Sig
.
ODO_TX_M
=
(
ODO_tx
>>
8
)
&
0xFF
;
p6EE
->
Sig
.
ODO_TX_M
=
(
ODO_tx
>>
8
)
&
0xFF
;
p6EE
->
Sig
.
ODO_TX_L
=
ODO_tx
&
0xFF
;
p6EE
->
Sig
.
ODO_TX_L
=
ODO_tx
&
0xFF
;
if
(
Get_Fuel_RES
()
>
255
)
if
(
Fuel_tx
>
255
)
{
{
p6EE
->
Sig
.
Fuel_Res_TX
=
0xFF
;
p6EE
->
Sig
.
Fuel_Res_TX
=
0xFF
;
}
}
else
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[])
...
@@ -105,6 +109,9 @@ void Can_Set_Buff_450(canlib_uint8_t CopyData[])
uint16_t
u16FrontTpms
=
0
;
uint16_t
u16FrontTpms
=
0
;
uint16_t
u16RearTpms
=
0
;
uint16_t
u16RearTpms
=
0
;
uint16_t
u16FrontTpmsValue
=
Get_Front_TPMS_TX
();
uint16_t
u16RearTpmsValue
=
Get_Rear_TPMS_TX
();
p450
=
(
CANMsg450Union
*
)
CopyData
;
p450
=
(
CANMsg450Union
*
)
CopyData
;
if
(
p450
!=
(
void
*
)
0
)
if
(
p450
!=
(
void
*
)
0
)
{
{
...
@@ -122,9 +129,9 @@ void Can_Set_Buff_450(canlib_uint8_t CopyData[])
...
@@ -122,9 +129,9 @@ void Can_Set_Buff_450(canlib_uint8_t CopyData[])
}
}
else
else
{
{
if
((
Get_Front_TPMS_TX
()
+
146
)
<=
1000U
)
if
((
u16FrontTpmsValue
+
146
)
<=
1000U
)
{
{
u16FrontTpms
=
(
Get_Front_TPMS_TX
()
+
146
);
u16FrontTpms
=
(
u16FrontTpmsValue
+
146
);
}
}
else
else
{
{
...
@@ -143,9 +150,9 @@ void Can_Set_Buff_450(canlib_uint8_t CopyData[])
...
@@ -143,9 +150,9 @@ void Can_Set_Buff_450(canlib_uint8_t CopyData[])
}
}
else
else
{
{
if
((
Get_Rear_TPMS_TX
()
+
146
)
<=
1000U
)
if
((
u16RearTpmsValue
+
146
)
<=
1000U
)
{
{
u16RearTpms
=
(
Get_Rear_TPMS_TX
()
+
146
);
u16RearTpms
=
(
u16RearTpmsValue
+
146
);
}
}
else
else
{
{
...
@@ -163,7 +170,7 @@ void Can_Set_Buff_580(canlib_uint8_t CopyData[])
...
@@ -163,7 +170,7 @@ void Can_Set_Buff_580(canlib_uint8_t CopyData[])
{
{
CANMsg580Union
*
p580
;
CANMsg580Union
*
p580
;
uint8_t
i
=
0
;
uint8_t
i
=
0
;
uint8_t
u8TpmsFlag
=
Get_Tpms_TX_Flag
()
;
p580
=
(
CANMsg580Union
*
)
CopyData
;
p580
=
(
CANMsg580Union
*
)
CopyData
;
if
(
p580
!=
(
void
*
)
0
)
if
(
p580
!=
(
void
*
)
0
)
{
{
...
@@ -172,7 +179,7 @@ void Can_Set_Buff_580(canlib_uint8_t CopyData[])
...
@@ -172,7 +179,7 @@ void Can_Set_Buff_580(canlib_uint8_t CopyData[])
p580
->
Msg
[
i
]
=
0x0u
;
p580
->
Msg
[
i
]
=
0x0u
;
}
}
if
(
Get_Tpms_TX_Flag
()
==
1
)
if
(
u8TpmsFlag
==
1
)
{
{
//Can_580Send_flag = 1;
//Can_580Send_flag = 1;
//if(CAN_TX_Count++ > 2)
//if(CAN_TX_Count++ > 2)
...
@@ -192,7 +199,7 @@ void Can_Set_Buff_580(canlib_uint8_t CopyData[])
...
@@ -192,7 +199,7 @@ void Can_Set_Buff_580(canlib_uint8_t CopyData[])
// CAN_TX_Count++;
// CAN_TX_Count++;
//}
//}
}
}
else
if
(
Get_Tpms_TX_Flag
()
==
2
)
else
if
(
u8TpmsFlag
==
2
)
{
{
//Can_580Send_flag = 1;
//Can_580Send_flag = 1;
//if(CAN_TX_Count++ > 2)
//if(CAN_TX_Count++ > 2)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment