Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiancetai
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
陈家乐
jiancetai
Commits
6951756a
Commit
6951756a
authored
Dec 26, 2024
by
李冠华
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🐞
fix:优化检测台对比仪表发来的数据对比策略,改为每次上电后第一次为请求重发,之后在发正常写入的值。优化上下电策略
parent
e9f5f19a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
18 deletions
+36
-18
NVS_Test.c
YueJin_test_bench/source/Appliciation/NVS_Test.c
+18
-15
NVS_Test.h
YueJin_test_bench/source/Appliciation/NVS_Test.h
+4
-2
Power_Controls.c
YueJin_test_bench/source/Appliciation/Power_Controls.c
+6
-0
Power_Controls.h
YueJin_test_bench/source/Appliciation/Power_Controls.h
+1
-1
api_RS485.c
YueJin_test_bench/source/Appliciation/api_RS485.c
+7
-0
No files found.
YueJin_test_bench/source/Appliciation/NVS_Test.c
View file @
6951756a
...
...
@@ -3,8 +3,8 @@
uint32_t
BenCiXieRuNum
=
0U
;
uint32_t
TotalExecutionNum
=
0U
;
uint32_t
Last
Num
=
0U
;
uint32_t
BeforeLast
Num
=
0U
;
uint32_t
XieRuLookahead
Num
=
0U
;
uint32_t
XieRuLag
Num
=
0U
;
uint32_t
ReceivedValue
=
0U
;
uint8_t
RenWuDelay
=
0U
;
uint8_t
errNum
=
0U
;
...
...
@@ -17,6 +17,7 @@ uint32_t RS485TXBenCiXieRuNum = 0u;
uint32_t
RS485TXTotalExecutionNum
=
0u
;
uint8_t
RerequestCount
=
0U
;
uint8_t
UARTRxBufClean
=
0u
;
uint32_t
BenCiXieRuStoreArr
[
2
]
=
{
0U
,
0U
};
/*此值用于存储刚给表写入的值。当表回复后此值在变化*/
static
void
NVS_Test_BenCiXieRuNum
(
void
);
static
void
NVS_Test_Rerequest
(
void
);
...
...
@@ -25,8 +26,8 @@ void NVS_Test_Init(void)
{
BenCiXieRuNum
=
0U
;
TotalExecutionNum
=
0U
;
Last
Num
=
0xFFFFFFFFU
;
BeforeLast
Num
=
0xFFFFFFFFU
;
XieRuLookahead
Num
=
0xFFFFFFFFU
;
XieRuLag
Num
=
0xFFFFFFFFU
;
ReceivedValue
=
0U
;
RenWuDelay
=
0U
;
errNum
=
0U
;
...
...
@@ -39,6 +40,8 @@ void NVS_Test_Init(void)
RS485TXTotalExecutionNum
=
0u
;
RerequestCount
=
0U
;
UARTRxBufClean
=
0U
;
BenCiXieRuStoreArr
[
0
]
=
0U
;
BenCiXieRuStoreArr
[
1
]
=
0U
;
}
void
NVS_Test_Service
(
void
)
...
...
@@ -49,12 +52,12 @@ void NVS_Test_Service(void)
{
if
(
errNum
==
0U
)
{
BeforeLastNum
=
Last
Num
;
Last
Num
=
BenCiXieRuNum
;
NVS_Test_BenCiXieRuNum
();
// XieRuLagNum = XieRuLookahead
Num;
// XieRuLookahead
Num = BenCiXieRuNum;
//
NVS_Test_BenCiXieRuNum();
RS485_TX_finish
=
0U
;
/*上电后满足等待时间后,开始发第一帧信号*/
RS485TXBenCiXieRuNum
=
BenCiXieRuNum
;
RS485TXTotalExecutionNum
=
TotalExecutionNum
;
RS485TXBenCiXieRuNum
=
0xFFFFEEEEU
;
RS485TXTotalExecutionNum
=
0xFFFFEEEEU
;
huifudelayCount
=
0u
;
}
}
...
...
@@ -69,11 +72,11 @@ void NVS_Test_Service(void)
huifudelayCount
=
0u
;
UARTRxBufClean
=
0U
;
if
(
TotalExecutionNum
!=
0
U
)
if
(
TotalExecutionNum
>
1
U
)
{
if
(
JieShouDaoValue
!=
Last
Num
)
if
(
JieShouDaoValue
!=
XieRuLag
Num
)
{
if
((
JieShouDaoValue
==
BeforeLastNum
)
&&
(
BenCiShangDianZhiXingCount
==
0
U
))
if
((
JieShouDaoValue
==
XieRuLookaheadNum
)
&&
(
BenCiShangDianZhiXingCount
<=
1
U
))
{
;
}
...
...
@@ -89,18 +92,19 @@ void NVS_Test_Service(void)
StopFlag
=
0u
;
RerequestCount
=
0U
;
BenCiShangDianZhiXingCount
++
;
BeforeLastNum
=
LastNum
;
LastNum
=
BenCiXieRuNum
;
NVS_Test_BenCiXieRuNum
();
TotalExecutionNum
++
;
RS485TXBenCiXieRuNum
=
BenCiXieRuNum
;
RS485TXTotalExecutionNum
=
TotalExecutionNum
;
BenCiXieRuStoreArr
[
1
]
=
BenCiXieRuStoreArr
[
0
];
BenCiXieRuStoreArr
[
0
]
=
BenCiXieRuNum
;
RS485_TX_finish
=
0U
;
/*执行读的功能,对比完没问题再重新外发*/
}
else
{
if
(
RerequestCount
<
3U
)
{
StopFlag
=
1u
;
NVS_Test_Rerequest
();
errNum
=
0U
;
RerequestCount
++
;
...
...
@@ -158,7 +162,6 @@ static void NVS_Test_BenCiXieRuNum(void)
static
void
NVS_Test_Rerequest
(
void
)
{
StopFlag
=
1u
;
RS485TXBenCiXieRuNum
=
0xFFFFEEEEU
;
RS485TXTotalExecutionNum
=
0xFFFFEEEEU
;
RS485_TX_finish
=
0U
;
...
...
YueJin_test_bench/source/Appliciation/NVS_Test.h
View file @
6951756a
...
...
@@ -14,8 +14,8 @@
extern
uint32_t
BenCiXieRuNum
;
extern
uint32_t
TotalExecutionNum
;
extern
uint32_t
Last
Num
;
extern
uint32_t
BeforeLast
Num
;
extern
uint32_t
XieRuLookahead
Num
;
extern
uint32_t
XieRuLag
Num
;
extern
uint32_t
ReceivedValue
;
extern
uint8_t
RenWuDelay
;
extern
uint32_t
TurnOffPowerCount
;
...
...
@@ -27,6 +27,8 @@ extern uint16_t huifudelayCount;
extern
uint8_t
StopFlag
;
extern
uint32_t
RS485TXBenCiXieRuNum
;
extern
uint32_t
RS485TXTotalExecutionNum
;
extern
uint32_t
BenCiXieRuStoreArr
[
2
];
extern
void
NVS_Test_Init
(
void
);
...
...
YueJin_test_bench/source/Appliciation/Power_Controls.c
View file @
6951756a
...
...
@@ -42,6 +42,12 @@ void Power_Control_Count(void)
}
}
}
else
if
(
StopFlag
==
2U
)
{
/*为了进入断电状态*/
PowerCountNum
=
SHANG_DIAN_TIMES
+
ShangDianOffset
+
1
;
StopFlag
=
0U
;
}
else
{
KL1530ON
=
1U
;
...
...
YueJin_test_bench/source/Appliciation/Power_Controls.h
View file @
6951756a
...
...
@@ -10,7 +10,7 @@
#define DUAN_DIAN_STATE 1
/*0--只控制13.5V电,1--控制所有电*/
#define SHANG_DIAN_TIMES 250U
/*上电时间*/
#define DUAN_DIAN_TIMES
30U
/*断电时长,3
s*/
#define DUAN_DIAN_TIMES
40U
/*断电时长,4
s*/
extern
uint8_t
KL1530ON
;
...
...
YueJin_test_bench/source/Appliciation/api_RS485.c
View file @
6951756a
...
...
@@ -354,6 +354,13 @@ void RS485_User_Tx_Data(void)
// RS485_TX_finish = 0U;
if
(
sendfinishflag
==
0
)
{
if
((
RS485TXBenCiXieRuNum
!=
0xFFFFEEEEU
)
&&
(
RS485TXTotalExecutionNum
!=
0xFFFFEEEEU
)
&&
(
BenCiShangDianZhiXingCount
>
1U
)
)
{
/*当不是请求重发任务时,发出仪表要写入的数据后,XieRuLookaheadNum立刻置为刚刚要写入的值*/
XieRuLagNum
=
BenCiXieRuStoreArr
[
1
];
XieRuLookaheadNum
=
BenCiXieRuStoreArr
[
0
];
}
RS485_TX_finish
=
1U
;
}
}
...
...
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