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