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
b10cd8bf
Commit
b10cd8bf
authored
May 09, 2024
by
李俭双
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
✨
feat:增加故障码处理文件
parent
b9116cd3
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
174 additions
and
4 deletions
+174
-4
FaultCode.c
Firmware/Source/Application/FaultCode/FaultCode.c
+168
-0
FaultCode.h
Firmware/Source/Application/FaultCode/FaultCode.h
+2
-2
Sys_Task_List.c
Firmware/Source/System/Sys_Task_List.c
+4
-2
No files found.
Firmware/Source/Application/FaultCode/FaultCode.c
View file @
b10cd8bf
#include "FaultCode\FaultCode.h"
#include "Application.h"
uint8_t
DTC_Amnt_Number
=
0
;
//Diag402ReceiveDTCNumberTemp
uint8_t
DTC_Amnt_Number_Count
=
0
;
//Diag402ReceiveDTCCount
uint8_t
FaultCode_Number
=
0
;
//Diag402ReceiveDTCNumber
uint32_t
DTC_Data
[
254
]
=
{
0
};
//Diag402ReceiveDTC
uint32_t
DTC_Data_Count
[
254
]
=
{
0
};
//Diag402ReceiveDTCTemp
uint32_t
FaultCode_Data
[
254
]
=
{
0
};
//DtcCurFaultGrpup
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
++
)
{
if
(
FaultCode
==
CodeList
[
i
])
{
result
=
1
;
}
}
return
result
;
}
void
ECU_FaultCode_Processing_Service
(
void
)
{
uint8_t
DTCH1
=
0
;
uint8_t
DTCM1
=
0
;
uint8_t
DTCH2
=
0
;
uint8_t
DTCM2
=
0
;
uint32_t
DTC1
=
0
;
uint32_t
DTC2
=
0
;
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
)
{
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
();
DTC_Amnt_Number
=
Get_CAN_CH0_ID_402_Sig_ECU_DTCAmnt
();
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
(((
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
(
DTC_Amnt_Number
==
0
)
{
for
(
i
=
0
;
i
<
255
;
i
++
)
{
FaultCode_Data
[
i
]
=
0
;
}
}
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
++
;
}
}
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
++
;
}
}
if
(
DTC_Amnt_Number_Count
==
DTC_Amnt_Number
)
{
for
(
i
=
0
;
i
<
DTC_Amnt_Number_Count
;
i
++
)
{
DTC_Data
[
i
]
=
DTC_Data_Count
[
i
];
DTC_Data_Count
[
i
]
=
0
;
}
FaultCode_Number
=
DTC_Amnt_Number
;
DTC_Amnt_Number_Count
=
0
;
for
(
i
=
0
;
i
<
FaultCode_Number
;
i
++
)
{
FaultCode_Data
[
i
]
=
DTC_Data
[
i
];
}
}
}
}
else
{
memset
(
FaultCode_Data
,
0
,
FaultCode_Number
);
FaultCode_Number
=
0
;
}
}
Firmware/Source/Application/FaultCode/FaultCode.h
View file @
b10cd8bf
...
...
@@ -4,6 +4,6 @@
#include "Application.h"
#include "common.h"
uint8_t
FaultCode_Compare
(
uint32_t
FaultCode
,
uint32_t
*
CodeList
,
uint8_t
len
);
void
ECU_FaultCode_Processing_Service
(
void
);
#endif
\ No newline at end of file
Firmware/Source/System/Sys_Task_List.c
View file @
b10cd8bf
...
...
@@ -47,6 +47,7 @@ void Sys_10ms_Tasks(void)
Turn_Left_Right_Lamp
();
Fuel_R_Cal
(
10u
);
TYW_Check_Count
();
Data_TPMS_Processing_Service
();
}
void
Sys_20ms_Tasks
(
void
)
...
...
@@ -56,7 +57,7 @@ void Sys_20ms_Tasks(void)
Data_Vehicle_Speed_Processing_Service
();
Data_Engine_Speed_Processing_Service
();
Data_Coolant_Temp_Processing_Service
();
Data_TPMS_Processing_Service
();
}
void
Sys_50ms_Tasks
(
void
)
...
...
@@ -82,6 +83,7 @@ void Sys_100ms_Tasks(void)
Services_Mileage_Callback
();
Data_Voltage_Processing_Service
();
S3_ServerCNTT
();
ECU_FaultCode_Processing_Service
();
if
(
u8LEDDriverCheckCount
>=
10U
)
{
...
...
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