Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Thick-Common
Project
Project
Details
Activity
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
潘栩锋
Thick-Common
Commits
f88e593c
Commit
f88e593c
authored
Jun 22, 2020
by
潘栩锋
🚴
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复 ModbusMapper_Client 实际采样周期统计,第1次读取时时间太短。
parent
582acd98
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
ModbusMapper_Client.cs
...Mapper/FLY.ModbusMapper/WithThread/ModbusMapper_Client.cs
+11
-3
No files found.
Project.FLY.ModbusMapper/FLY.ModbusMapper/WithThread/ModbusMapper_Client.cs
View file @
f88e593c
...
@@ -104,6 +104,7 @@ namespace FLY.Modbus.WithThread
...
@@ -104,6 +104,7 @@ namespace FLY.Modbus.WithThread
void
OnPoll_update
()
void
OnPoll_update
()
{
{
Stopwatch
stopwatch
=
new
Stopwatch
();
Stopwatch
stopwatch
=
new
Stopwatch
();
Stopwatch
stopwatch_act
=
new
Stopwatch
();
bool
isTimeForRead
=
true
;
bool
isTimeForRead
=
true
;
_connect
:
_connect
:
while
(
true
)
while
(
true
)
...
@@ -152,10 +153,17 @@ namespace FLY.Modbus.WithThread
...
@@ -152,10 +153,17 @@ namespace FLY.Modbus.WithThread
if
(
isTimeForRead
)
if
(
isTimeForRead
)
{
{
isTimeForRead
=
false
;
isTimeForRead
=
false
;
TimeSpan
elapsed
=
stopwatch
.
Elapsed
;
ActUpdateInterval
=
elapsed
;
stopwatch
.
Restart
();
stopwatch
.
Restart
();
if
(!
stopwatch_act
.
IsRunning
)
{
stopwatch_act
.
Restart
();
}
else
{
ActUpdateInterval
=
stopwatch_act
.
Elapsed
;
stopwatch_act
.
Restart
();
}
if
(!
UpdateReadData
())
if
(!
UpdateReadData
())
{
{
if
(
cts
.
IsCancellationRequested
)
//可能是外部强制关闭
if
(
cts
.
IsCancellationRequested
)
//可能是外部强制关闭
...
...
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