Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
94a6c0de
Commit
94a6c0de
authored
May 20, 2015
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(ModbusMaster): небольшие стилистические правки
parent
90fd936d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
11 deletions
+10
-11
MBExchange.cc
extensions/ModbusMaster/MBExchange.cc
+5
-7
RTUExchange.cc
extensions/ModbusMaster/RTUExchange.cc
+5
-4
No files found.
extensions/ModbusMaster/MBExchange.cc
View file @
94a6c0de
...
@@ -2965,7 +2965,7 @@ bool MBExchange::poll()
...
@@ -2965,7 +2965,7 @@ bool MBExchange::poll()
dlog3
<<
myname
<<
"(poll): ask addr="
<<
ModbusRTU
::
addr2str
(
d
->
mbaddr
)
dlog3
<<
myname
<<
"(poll): ask addr="
<<
ModbusRTU
::
addr2str
(
d
->
mbaddr
)
<<
" regs="
<<
d
->
regmap
.
size
()
<<
endl
;
<<
" regs="
<<
d
->
regmap
.
size
()
<<
endl
;
unsigned
int
prev_numreply
=
d
->
numreply
.
load
(
);
d
->
prev_numreply
.
store
(
d
->
numreply
);
for
(
auto
it
=
d
->
regmap
.
begin
();
it
!=
d
->
regmap
.
end
();
++
it
)
for
(
auto
it
=
d
->
regmap
.
begin
();
it
!=
d
->
regmap
.
end
();
++
it
)
{
{
...
@@ -2980,7 +2980,10 @@ bool MBExchange::poll()
...
@@ -2980,7 +2980,10 @@ bool MBExchange::poll()
if
(
d
->
dtype
==
MBExchange
::
dtRTU
||
d
->
dtype
==
MBExchange
::
dtMTR
)
if
(
d
->
dtype
==
MBExchange
::
dtRTU
||
d
->
dtype
==
MBExchange
::
dtMTR
)
{
{
if
(
pollRTU
(
d
,
it
)
)
if
(
pollRTU
(
d
,
it
)
)
{
d
->
numreply
++
;
d
->
numreply
++
;
allNotRespond
=
false
;
}
}
}
}
}
catch
(
ModbusRTU
::
mbException
&
ex
)
catch
(
ModbusRTU
::
mbException
&
ex
)
...
@@ -2995,9 +2998,6 @@ bool MBExchange::poll()
...
@@ -2995,9 +2998,6 @@ bool MBExchange::poll()
break
;
break
;
}
}
if
(
d
->
numreply
!=
prev_numreply
)
allNotRespond
=
false
;
if
(
it
==
d
->
regmap
.
end
()
)
if
(
it
==
d
->
regmap
.
end
()
)
break
;
break
;
...
@@ -3050,11 +3050,8 @@ bool MBExchange::poll()
...
@@ -3050,11 +3050,8 @@ bool MBExchange::poll()
bool
MBExchange
::
RTUDevice
::
checkRespond
()
bool
MBExchange
::
RTUDevice
::
checkRespond
()
{
{
bool
prev
=
resp_state
;
bool
prev
=
resp_state
;
resp_state
=
!
resp_Delay
.
check
(
prev_numreply
==
numreply
);
resp_state
=
!
resp_Delay
.
check
(
prev_numreply
==
numreply
);
prev_numreply
.
store
(
numreply
);
dlog4
<<
"(checkRespond): addr="
<<
ModbusRTU
::
addr2str
(
mbaddr
)
dlog4
<<
"(checkRespond): addr="
<<
ModbusRTU
::
addr2str
(
mbaddr
)
<<
" respond_id="
<<
resp_id
<<
" respond_id="
<<
resp_id
<<
" state="
<<
resp_state
<<
" state="
<<
resp_state
...
@@ -3064,6 +3061,7 @@ bool MBExchange::RTUDevice::checkRespond()
...
@@ -3064,6 +3061,7 @@ bool MBExchange::RTUDevice::checkRespond()
<<
" prev_numreply="
<<
prev_numreply
<<
" prev_numreply="
<<
prev_numreply
<<
" ]"
<<
" ]"
<<
endl
;
<<
endl
;
return
(
prev
!=
resp_state
);
return
(
prev
!=
resp_state
);
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
...
...
extensions/ModbusMaster/RTUExchange.cc
View file @
94a6c0de
...
@@ -212,7 +212,7 @@ bool RTUExchange::poll()
...
@@ -212,7 +212,7 @@ bool RTUExchange::poll()
mbrtu
->
setSpeed
(
d
->
speed
);
mbrtu
->
setSpeed
(
d
->
speed
);
}
}
unsigned
int
prev_numreply
=
d
->
numreply
;
d
->
prev_numreply
.
store
(
d
->
numreply
)
;
if
(
d
->
dtype
==
MBExchange
::
dtRTU188
)
if
(
d
->
dtype
==
MBExchange
::
dtRTU188
)
{
{
...
@@ -230,6 +230,7 @@ bool RTUExchange::poll()
...
@@ -230,6 +230,7 @@ bool RTUExchange::poll()
d
->
rtu
->
poll
(
mbrtu
);
d
->
rtu
->
poll
(
mbrtu
);
d
->
numreply
++
;
d
->
numreply
++
;
allNotRespond
=
false
;
}
}
catch
(
ModbusRTU
::
mbException
&
ex
)
catch
(
ModbusRTU
::
mbException
&
ex
)
{
{
...
@@ -255,7 +256,10 @@ bool RTUExchange::poll()
...
@@ -255,7 +256,10 @@ bool RTUExchange::poll()
mb
->
cleanupChannel
();
mb
->
cleanupChannel
();
if
(
pollRTU
(
d
,
it
)
)
if
(
pollRTU
(
d
,
it
)
)
{
d
->
numreply
++
;
d
->
numreply
++
;
allNotRespond
=
false
;
}
}
}
}
}
catch
(
ModbusRTU
::
mbException
&
ex
)
catch
(
ModbusRTU
::
mbException
&
ex
)
...
@@ -274,9 +278,6 @@ bool RTUExchange::poll()
...
@@ -274,9 +278,6 @@ bool RTUExchange::poll()
return
false
;
return
false
;
}
}
}
}
if
(
d
->
numreply
!=
prev_numreply
)
allNotRespond
=
false
;
}
}
// update SharedMemory...
// update SharedMemory...
...
...
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