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
2535d24f
Commit
2535d24f
authored
Feb 22, 2012
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(modbus): Исправлена инициализация регистров для RTU188
parent
639a4f7e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
12 deletions
+35
-12
libuniset.spec
conf/libuniset.spec
+4
-1
MBExchange.cc
extensions/ModbusMaster/MBExchange.cc
+31
-11
No files found.
conf/libuniset.spec
View file @
2535d24f
...
...
@@ -3,7 +3,7 @@
Name: libuniset
Version: 1.3
Release: alt
8
Release: alt
9
Summary: UniSet - library for building distributed industrial control systems
License: GPL
Group: Development/C++
...
...
@@ -213,6 +213,9 @@ rm -f %buildroot%_libdir/*.la
%changelog
* Wed Feb 22 2012 Pavel Vainerman <pv@altlinux.ru> 1.3-alt9
- (modbus): fixed bug in modbus exchange for RTU188 (initialization)
* Tue Feb 21 2012 Pavel Vainerman <pv@altlinux.ru> 1.3-alt8
- (modbus): fixed bug in modbus exchange for RTU188
...
...
extensions/ModbusMaster/MBExchange.cc
View file @
2535d24f
...
...
@@ -409,6 +409,11 @@ std::ostream& operator<<( std::ostream& os, MBExchange::RTUDevice& d )
return
os
;
}
// -----------------------------------------------------------------------------
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
MBExchange
::
RegInfo
*
r
)
{
return
os
<<
(
*
r
);
}
// -----------------------------------------------------------------------------
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
MBExchange
::
RegInfo
&
r
)
{
os
<<
" id="
<<
r
.
id
...
...
@@ -1945,22 +1950,36 @@ bool MBExchange::initItem( UniXML_iterator& it )
return
false
;
}
ModbusRTU
::
ModbusData
mbreg
;
ModbusRTU
::
ModbusData
mbreg
=
0
;
int
fn
=
it
.
getIntProp
(
prop_prefix
+
"mbfunc"
);
if
(
mbregFromID
)
mbreg
=
p
.
si
.
id
;
// conf->getSensorID(it.getProp("name"));
else
if
(
dev
->
dtype
==
dtRTU188
)
{
string
reg
=
it
.
getProp
(
prop_prefix
+
"mbreg"
)
;
if
(
reg
.
empty
(
)
)
RegInfo
r_tmp
;
if
(
!
initRTU188item
(
it
,
&
r_tmp
)
)
{
dlog
[
Debug
::
CRIT
]
<<
myname
<<
"(initItem):
unknown mbreg("
<<
prop_prefix
<<
")
for "
<<
it
.
getProp
(
"name"
)
<<
endl
;
dlog
[
Debug
::
CRIT
]
<<
myname
<<
"(initItem):
init RTU188 failed
for "
<<
it
.
getProp
(
"name"
)
<<
endl
;
return
false
;
}
mbreg
=
ModbusRTU
::
str2mbData
(
reg
);
}
int
fn
=
it
.
getIntProp
(
prop_prefix
+
"mbfunc"
);
mbreg
=
RTUStorage
::
getRegister
(
r_tmp
.
rtuJack
,
r_tmp
.
rtuChan
,
p
.
stype
);
fn
=
RTUStorage
::
getFunction
(
r_tmp
.
rtuJack
,
r_tmp
.
rtuChan
,
p
.
stype
);
}
else
{
if
(
mbregFromID
)
mbreg
=
p
.
si
.
id
;
// conf->getSensorID(it.getProp("name"));
else
{
string
reg
=
it
.
getProp
(
prop_prefix
+
"mbreg"
);
if
(
reg
.
empty
()
)
{
dlog
[
Debug
::
CRIT
]
<<
myname
<<
"(initItem): unknown mbreg("
<<
prop_prefix
<<
") for "
<<
it
.
getProp
(
"name"
)
<<
endl
;
return
false
;
}
mbreg
=
ModbusRTU
::
str2mbData
(
reg
);
}
}
// формула для вычисления ID
// требования:
...
...
@@ -2177,7 +2196,8 @@ bool MBExchange::initRTU188item( UniXML_iterator& it, RegInfo* p )
p
->
rtuChan
=
UniSetTypes
::
uni_atoi
(
chan
);
if
(
dlog
.
debugging
(
Debug
::
LEVEL2
)
)
dlog
[
Debug
::
LEVEL2
]
<<
myname
<<
"(readRTU188Item): "
<<
p
<<
endl
;
dlog
[
Debug
::
LEVEL2
]
<<
myname
<<
"(readRTU188Item): add jack='"
<<
jack
<<
"'"
<<
" channel='"
<<
p
->
rtuChan
<<
"'"
<<
endl
;
return
true
;
}
...
...
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