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
9b993cfb
Commit
9b993cfb
authored
Jun 18, 2024
by
李俭双
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🐞
fix:修改胎压逻辑
parent
2a5f4dfa
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
229 additions
and
43 deletions
+229
-43
Data_TPMS.c
Firmware/Source/Application/Data_TPMS/Data_TPMS.c
+223
-41
Data_TPMS.h
Firmware/Source/Application/Data_TPMS/Data_TPMS.h
+6
-2
No files found.
Firmware/Source/Application/Data_TPMS/Data_TPMS.c
View file @
9b993cfb
...
...
@@ -2,47 +2,214 @@
#include "Data_TPMS\Data_TPMS.h"
_TPMS_Display
TPMS
;
uint32_t
LearnTime_Count
=
0
;
uint32_t
LearnTime_Count1
=
0
;
void
Data_TPMS_KL30_Init
(
void
)
{
uint
32
_t
TPMS_L
[
2
]
=
{
0
,
0
};
Data_User_EEPROM_Read
(
EM_MenuData_TPMS_LEARN
,
TPMS_L
,
2
u
);
uint
8
_t
TPMS_L
[
2
]
=
{
0
,
0
};
Data_User_EEPROM_Read
(
EM_MenuData_TPMS_LEARN
,
(
uint32_t
*
)
TPMS_L
,
1
u
);
MenuData
.
TPMS_Front_Learn
=
TPMS_L
[
0
];
MenuData
.
TPMS_Rear_Learn
=
TPMS_L
[
1
];
//MenuData.TPMS_Front_FirstLearn_Flag = TPMS_L[2];
//MenuData.TPMS_Rear_FirstLearn_Flag = TPMS_L[3];
TPMS
.
Front_Press_Value
=
0
;
TPMS
.
Rear_Press_Value
=
0
;
TPMS
.
Front_TPMS_Valid
=
0
;
TPMS
.
Rear_TPMS_Valid
=
0
;
TPMS
.
TPMS_Warning
=
0
;
TPMS
.
TPMS_Unit
=
Get_Dis_Tpms_Unit
();
TPMS
.
TPMS_Front_Learn
=
MenuData
.
TPMS_Front_Learn
;
TPMS
.
TPMS_Rear_Learn
=
MenuData
.
TPMS_Rear_Learn
;
TPMS
.
TPMS_Front_FirstLearn_Flag
=
MenuData
.
TPMS_Front_FirstLearn_Flag
;
TPMS
.
TPMS_Rear_FirstLearn_Flag
=
MenuData
.
TPMS_Rear_FirstLearn_Flag
;
}
void
Data_TPMS_KL15_WAKE_UP_Init
(
void
)
{
uint
32
_t
TPMS_L
[
2
]
=
{
0
,
0
};
Data_User_EEPROM_Read
(
EM_MenuData_TPMS_LEARN
,
TPMS_L
,
2u
);
uint
8
_t
TPMS_L
[
2
]
=
{
0
,
0
};
Data_User_EEPROM_Read
(
EM_MenuData_TPMS_LEARN
,
(
uint32_t
*
)
TPMS_L
,
1
);
MenuData
.
TPMS_Front_Learn
=
TPMS_L
[
0
];
MenuData
.
TPMS_Rear_Learn
=
TPMS_L
[
1
];
//MenuData.TPMS_Front_FirstLearn_Flag = TPMS_L[2];
//MenuData.TPMS_Rear_FirstLearn_Flag = TPMS_L[3];
TPMS
.
TPMS_Front_Learn
=
MenuData
.
TPMS_Front_Learn
;
TPMS
.
TPMS_Rear_Learn
=
MenuData
.
TPMS_Rear_Learn
;
TPMS
.
TPMS_Front_FirstLearn_Flag
=
MenuData
.
TPMS_Front_FirstLearn_Flag
;
TPMS
.
TPMS_Rear_FirstLearn_Flag
=
MenuData
.
TPMS_Rear_FirstLearn_Flag
;
}
void
Data_TPMS_Processing_Service
(
void
)
{
uint16_t
Front_TPMS
=
0
;
uint16_t
Rear_TPMS
=
0
;
uint32_t
TPMS_L
[
2
]
=
{
0
,
0
};
uint8_t
TPMS_L
[
2
]
=
{
0
,
0
};
if
(
CAN_MSG_Status
(
&
CAN_CH0_CanMsgOp
,
CAN_CH0_ID_CAN_0x341_Msg_Count
)
!=
CAN_SIG_LOST
)
{
TPMS
.
TPMS_Front_Learn
=
Get_CAN_CH0_ID_341_Sig_Front_LearningStatus
();
TPMS
.
TPMS_Rear_Learn
=
Get_CAN_CH0_ID_341_Sig_Rear_LearningStatus
();
}
else
{
TPMS
.
TPMS_Front_Learn
=
MenuData
.
TPMS_Front_Learn
;
TPMS
.
TPMS_Rear_Learn
=
MenuData
.
TPMS_Rear_Learn
;
}
if
(
TPMS
.
TPMS_Front_Learn
==
0x0
)
{
if
(
LearnTime_Count
<=
6000
)
{
LearnTime_Count
++
;
TPMS
.
TPMS_Front_Learn
=
Unstudied
;
}
else
{
if
((
MenuData
.
TPMS_Front_Learn
!=
0x2
)
&&
(
MenuData
.
TPMS_Front_Learn
!=
0x3
)
)
{
TPMS
.
TPMS_Front_Learn
=
LearningFailure
;
}
else
{
TPMS
.
TPMS_Front_Learn
=
MenuData
.
TPMS_Front_Learn
;
}
}
}
else
if
(
TPMS
.
TPMS_Front_Learn
==
0x1
)
{
if
(
LearnTime_Count
<=
6000
)
{
LearnTime_Count
++
;
TPMS
.
TPMS_Front_Learn
=
Learning
;
}
else
{
if
((
MenuData
.
TPMS_Front_Learn
!=
0x2
)
&&
(
MenuData
.
TPMS_Front_Learn
!=
0x3
)
)
{
TPMS
.
TPMS_Front_Learn
=
LearningFailure
;
}
else
{
TPMS
.
TPMS_Front_Learn
=
MenuData
.
TPMS_Front_Learn
;
}
}
}
else
if
(
TPMS
.
TPMS_Front_Learn
==
0x2
)
{
LearnTime_Count
=
0
;
if
((
Get_CAN_CH0_ID_373_Sig_Front_id
()
!=
0
)
&&
(
Get_CAN_CH0_ID_373_Sig_Front_id
()
!=
0xFFFFFFFF
))
{
TPMS
.
TPMS_Front_Learn
=
LearningCompletion
;
}
else
{
;
}
}
else
if
(
TPMS
.
TPMS_Front_Learn
==
0x3
)
{
LearnTime_Count
=
0
;
TPMS
.
TPMS_Front_Learn
=
LearningFailure
;
}
else
{
LearnTime_Count
=
0
;
TPMS
.
TPMS_Front_Learn
=
MenuData
.
TPMS_Front_Learn
;
}
if
(
TPMS
.
TPMS_Rear_Learn
==
0x0
)
{
if
(
LearnTime_Count1
<=
6000
)
{
LearnTime_Count1
++
;
TPMS
.
TPMS_Rear_Learn
=
Unstudied
;
}
else
{
if
((
MenuData
.
TPMS_Rear_Learn
!=
0x2
)
&&
(
MenuData
.
TPMS_Rear_Learn
!=
0x3
)
)
{
TPMS
.
TPMS_Rear_Learn
=
LearningFailure
;
}
else
{
TPMS
.
TPMS_Rear_Learn
=
MenuData
.
TPMS_Rear_Learn
;
}
}
}
else
if
(
TPMS
.
TPMS_Rear_Learn
==
0x1
)
{
if
(
LearnTime_Count1
<=
6000
)
{
LearnTime_Count1
++
;
TPMS
.
TPMS_Rear_Learn
=
Learning
;
}
else
{
if
((
MenuData
.
TPMS_Rear_Learn
!=
0x2
)
&&
(
MenuData
.
TPMS_Rear_Learn
!=
0x3
)
)
{
TPMS
.
TPMS_Rear_Learn
=
LearningFailure
;
}
else
{
TPMS
.
TPMS_Rear_Learn
=
MenuData
.
TPMS_Front_Learn
;
}
}
}
else
if
(
TPMS
.
TPMS_Rear_Learn
==
0x2
)
{
LearnTime_Count1
=
0
;
if
((
Get_CAN_CH0_ID_373_Sig_Rear_id
()
!=
0
)
&&
(
Get_CAN_CH0_ID_373_Sig_Rear_id
()
!=
0xFFFFFFFF
))
{
TPMS
.
TPMS_Rear_Learn
=
LearningCompletion
;
}
else
{
;
}
}
else
if
(
TPMS
.
TPMS_Rear_Learn
==
0x3
)
{
LearnTime_Count1
=
0
;
TPMS
.
TPMS_Rear_Learn
=
LearningFailure
;
}
else
{
LearnTime_Count1
=
0
;
TPMS
.
TPMS_Rear_Learn
=
MenuData
.
TPMS_Front_Learn
;
}
if
((
TPMS
.
TPMS_Front_Learn
!=
MenuData
.
TPMS_Front_Learn
)
||
(
TPMS
.
TPMS_Rear_Learn
!=
MenuData
.
TPMS_Rear_Learn
))
{
TPMS_L
[
0
]
=
TPMS
.
TPMS_Front_Learn
;
TPMS_L
[
1
]
=
TPMS
.
TPMS_Rear_Learn
;
Data_User_EEPROM_Write
(
EM_MenuData_TPMS_LEARN
,
TPMS_L
,
2u
);
if
(
TPMS
.
TPMS_Front_Learn
!=
MenuData
.
TPMS_Front_Learn
)
{
TPMS
.
TPMS_Front_FirstLearn_Flag
=
1
;
}
if
(
TPMS
.
TPMS_Rear_Learn
!=
MenuData
.
TPMS_Rear_Learn
)
{
TPMS
.
TPMS_Rear_FirstLearn_Flag
=
1
;
}
if
((
TPMS
.
TPMS_Front_Learn
==
0x2
)
||
(
TPMS
.
TPMS_Front_Learn
==
0x3
))
{
MenuData
.
TPMS_Front_Learn
=
TPMS
.
TPMS_Front_Learn
;
}
if
((
TPMS
.
TPMS_Rear_Learn
==
0x2
)
||
(
TPMS
.
TPMS_Rear_Learn
==
0x3
))
{
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
))
{
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
);
}
}
TPMS
.
TPMS_Unit
=
Get_Dis_Tpms_Unit
();
Front_TPMS
=
Get_CAN_CH0_ID_341_Sig_Front_Pressure
();
Rear_TPMS
=
Get_CAN_CH0_ID_341_Sig_Rear_Pressure
();
...
...
@@ -61,10 +228,11 @@ void Data_TPMS_Processing_Service ( void )
{
if
((
Front_TPMS
==
0xFF
)
||
(
Rear_TPMS
==
0xFF
))
{
if
((
Front_TPMS
==
0xFF
)
&&
(
Rear_TPMS
!=
0xFF
))
{
TPMS
.
Front_TPMS_Valid
=
0
;
TPMS
.
Rear_TPMS_Valid
=
2
;
TPMS
.
Rear_TPMS_Valid
=
1
;
TPMS
.
Front_Press_Value
=
990
;
TPMS
.
Rear_Press_Value
=
Rear_TPMS
*
275
;
TPMS
.
Rear_Press_Value
/=
102
;
...
...
@@ -83,7 +251,7 @@ void Data_TPMS_Processing_Service ( void )
}
else
if
((
Front_TPMS
!=
0xFF
)
&&
(
Rear_TPMS
==
0xFF
))
{
TPMS
.
Front_TPMS_Valid
=
2
;
TPMS
.
Front_TPMS_Valid
=
1
;
TPMS
.
Rear_TPMS_Valid
=
0
;
TPMS
.
Rear_Press_Value
=
990
;
TPMS
.
Front_Press_Value
=
Front_TPMS
*
275
;
...
...
@@ -105,15 +273,15 @@ void Data_TPMS_Processing_Service ( void )
{
TPMS
.
Front_Press_Value
=
990
;
TPMS
.
Rear_Press_Value
=
990
;
TPMS
.
TPMS_Warning
=
0
;
//
TPMS.TPMS_Warning = 0;
TPMS
.
Front_TPMS_Valid
=
0
;
TPMS
.
Rear_TPMS_Valid
=
0
;
}
}
else
{
TPMS
.
Front_TPMS_Valid
=
2
;
TPMS
.
Rear_TPMS_Valid
=
2
;
TPMS
.
Front_TPMS_Valid
=
1
;
TPMS
.
Rear_TPMS_Valid
=
1
;
TPMS
.
Front_Press_Value
=
Front_TPMS
*
275
;
TPMS
.
Front_Press_Value
/=
102
;
if
(
TPMS
.
Front_Press_Value
>
990
)
...
...
@@ -138,54 +306,56 @@ void Data_TPMS_Processing_Service ( void )
}
}
if
(
MenuData
.
TPMS_Front_Learn
==
Unstudied
)
if
(
TPMS
.
TPMS_Front_Learn
==
Unstudied
)
{
TPMS
.
Front_TPMS_Valid
=
Unstudied
;
TPMS
.
TPMS_Front_FirstLearn_Flag
=
Unstudied
;
}
else
if
(
MenuData
.
TPMS_Front_Learn
==
Learning
)
else
if
(
TPMS
.
TPMS_Front_Learn
==
Learning
)
{
TPMS
.
Front_TPMS_Valid
=
Learning
;
TPMS
.
TPMS_Front_FirstLearn_Flag
=
Learning
;
}
else
if
(
MenuData
.
TPMS_Front_Learn
==
LearningCompletion
)
else
if
(
TPMS
.
TPMS_Front_Learn
==
LearningCompletion
)
{
TPMS
.
Front_TPMS_Valid
=
LearningCompletion
;
TPMS
.
Rear_Press_Value
=
990
;
TPMS
.
TPMS_Front_FirstLearn_Flag
=
LearningCompletion
;
}
else
if
(
MenuData
.
TPMS_Front_Learn
==
LearningFailure
)
else
if
(
TPMS
.
TPMS_Front_Learn
==
LearningFailure
)
{
TPMS
.
Front_TPMS_Valid
=
LearningFailure
;
TPMS
.
TPMS_Front_FirstLearn_Flag
=
LearningFailure
;
TPMS
.
Front_Press_Value
=
990
;
}
else
{
;
}
if
(
MenuData
.
TPMS_Rear_Learn
==
Unstudied
)
if
(
TPMS
.
TPMS_Rear_Learn
==
Unstudied
)
{
TPMS
.
Rear_TPMS_Valid
=
Unstudied
;
TPMS
.
TPMS_Rear_FirstLearn_Flag
=
Unstudied
;
}
else
if
(
MenuData
.
TPMS_Rear_Learn
==
Learning
)
else
if
(
TPMS
.
TPMS_Rear_Learn
==
Learning
)
{
TPMS
.
Rear_TPMS_Valid
=
Learning
;
TPMS
.
TPMS_Rear_FirstLearn_Flag
=
Learning
;
}
else
if
(
MenuData
.
TPMS_Rear_Learn
==
LearningCompletion
)
else
if
(
TPMS
.
TPMS_Rear_Learn
==
LearningCompletion
)
{
TPMS
.
Rear_TPMS_Valid
=
LearningCompletion
;
TPMS
.
Front_Press_Value
=
990
;
TPMS
.
TPMS_Rear_FirstLearn_Flag
=
LearningCompletion
;
}
else
if
(
MenuData
.
TPMS_Rear_Learn
==
LearningFailure
)
else
if
(
TPMS
.
TPMS_Rear_Learn
==
LearningFailure
)
{
TPMS
.
Rear_TPMS_Valid
=
LearningFailure
;
TPMS
.
TPMS_Rear_FirstLearn_Flag
=
LearningFailure
;
TPMS
.
Rear_Press_Value
=
990
;
}
else
{
;
}
if
((
MenuData
.
TPMS_Rear_Learn
!=
LearningCompletion
)
&&
(
MenuData
.
TPMS_Front_Learn
!=
LearningCompletion
))
{
TPMS
.
TPMS_Warning
=
0
;
}
//
if ((MenuData.TPMS_Rear_Learn != LearningCompletion) && (MenuData.TPMS_Front_Learn != LearningCompletion))
//
{
//
TPMS.TPMS_Warning = 0;
//
}
}
else
...
...
@@ -215,7 +385,7 @@ uint8_t Get_Led_TPMS_Waring (void)
return
TPMS
.
TPMS_Warning
;
}
/*0:
未学习,无效,常显-- 1:学习中,无效,闪烁-- 2:学习完成,有效,按实际胎压数值显示 3:学习失败,无效,最大值闪烁显示
*/
/*0:
无效,常显-- 1:有效,按实际胎压数值显示
*/
uint8_t
Get_Front_TPMS_Sig_Vaild
(
void
)
{
return
TPMS
.
Front_TPMS_Valid
;
...
...
@@ -282,3 +452,15 @@ uint16_t Get_Front_TPMS_TX (void)
}
return
value
;
}
/*前轮胎压学习结果 0-未学习“--”常显 1-学习中“--”闪烁 2-学习成功,正常显示数值 3-学习失败,闪烁显示最大值99*/
uint8_t
Get_Front_FirstLearn_Flag
(
void
)
{
return
TPMS
.
TPMS_Front_FirstLearn_Flag
;
}
/*后轮胎压学习结果 0-未学习“--”常显 1-学习中“--”闪烁 2-学习成功,正常显示数值 3-学习失败,闪烁显示最大值99*/
uint8_t
Get_Rear_FirstLearn_Flag
(
void
)
{
return
TPMS
.
TPMS_Rear_FirstLearn_Flag
;
}
Firmware/Source/Application/Data_TPMS/Data_TPMS.h
View file @
9b993cfb
...
...
@@ -10,8 +10,10 @@ typedef struct __attribute__((aligned(4)))
uint8_t
Rear_TPMS_Valid
;
uint8_t
TPMS_Warning
;
uint8_t
TPMS_Unit
;
uint32_t
TPMS_Front_Learn
;
uint32_t
TPMS_Rear_Learn
;
uint8_t
TPMS_Front_Learn
;
uint8_t
TPMS_Rear_Learn
;
uint8_t
TPMS_Front_FirstLearn_Flag
;
uint8_t
TPMS_Rear_FirstLearn_Flag
;
}
_TPMS_Display
;
typedef
enum
...
...
@@ -32,4 +34,6 @@ uint16_t Get_Rear_TPMS_Sig_Value (void);
uint16_t
Get_Rear_TPMS_TX
(
void
);
uint16_t
Get_Front_TPMS_TX
(
void
);
void
Data_TPMS_KL15_WAKE_UP_Init
(
void
);
uint8_t
Get_Front_FirstLearn_Flag
(
void
);
uint8_t
Get_Rear_FirstLearn_Flag
(
void
);
#endif
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