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
b3b9007d
Commit
b3b9007d
authored
Mar 27, 2010
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into utf8
Conflicts: conf/libuniset.spec include/SandClock.h
parents
99070f67
b324364c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
28 deletions
+53
-28
libuniset.spec
conf/libuniset.spec
+12
-1
mtr-setup.cc
extensions/RTUExchange/mtr-setup.cc
+5
-0
SharedMemory.h
extensions/SharedMemory/SharedMemory.h
+5
-6
SandClock.h
include/SandClock.h
+21
-21
ModbusHelpers.cc
src/Communications/Modbus/ModbusHelpers.cc
+10
-0
No files found.
conf/libuniset.spec
View file @
b3b9007d
...
...
@@ -3,7 +3,7 @@
Name: libuniset
Version: 0.97
Release: eter
59
Release: eter
62
Summary: UniSet - library for building distributed industrial control systems
License: GPL
Group: Development/C++
...
...
@@ -184,6 +184,17 @@ rm -f %buildroot%_libdir/*.la
%exclude %_pkgconfigdir/libUniSet.pc
%changelog
* Sat Mar 27 2010 Pavel Vainerman <pv@altlinux.ru> 0.97-eter62
- minor fixes in SM (add virtual function)
* Thu Mar 18 2010 Pavel Vainerman <pv@etersoft.ru> 0.97-eter61
- fixed bug in SandClock interface
* Thu Mar 18 2010 Pavel Vainerman <pv@etersoft.ru> 0.97-eter60
- new build
* Thu Mar 18 2010 Pavel Vainerman <pv@etersoft.ru> 0.97-eter59
- fixed bug in ModbuRTU::autedetect slave adress function
* Sun Mar 14 2010 Pavel Vainerman <pv@altlinux.ru> 0.97-eter58
- minor fixes in MTR setup API
...
...
extensions/RTUExchange/mtr-setup.cc
View file @
b3b9007d
...
...
@@ -95,6 +95,11 @@ int main( int argc, char **argv )
ComPort
::
StopBits
sbits
=
ComPort
::
OneBit
;
ComPort
::
Parity
parity
=
ComPort
::
NoParity
;
// ModbusRTU::ModbusAddr b=255;
//
// cout << "b=" << (int)b << " b++=" << (int)(b++) << endl;
// return 0;
try
{
while
(
(
opt
=
getopt_long
(
argc
,
argv
,
"hvw:r:x:d:s:t:l:n:yb:e:x:z:"
,
longopts
,
&
optindex
))
!=
-
1
)
...
...
extensions/SharedMemory/SharedMemory.h
View file @
b3b9007d
...
...
@@ -262,12 +262,11 @@ class SharedMemory:
ReadSlotList
lstRSlot
;
virtual
void
processingMessage
(
UniSetTypes
::
VoidMessage
*
msg
);
void
sysCommand
(
UniSetTypes
::
SystemMessage
*
sm
);
void
sensorInfo
(
UniSetTypes
::
SensorMessage
*
sm
);
void
timerInfo
(
UniSetTypes
::
TimerMessage
*
tm
);
void
askSensors
(
UniversalIO
::
UIOCommand
cmd
);
void
sendEvent
(
UniSetTypes
::
SystemMessage
&
sm
);
virtual
void
sysCommand
(
UniSetTypes
::
SystemMessage
*
sm
);
virtual
void
sensorInfo
(
UniSetTypes
::
SensorMessage
*
sm
);
virtual
void
timerInfo
(
UniSetTypes
::
TimerMessage
*
tm
);
virtual
void
askSensors
(
UniversalIO
::
UIOCommand
cmd
);
virtual
void
sendEvent
(
UniSetTypes
::
SystemMessage
&
sm
);
virtual
void
localSaveValue
(
AIOStateList
::
iterator
&
it
,
const
IOController_i
::
SensorInfo
&
si
,
CORBA
::
Long
newvalue
,
UniSetTypes
::
ObjectId
sup_id
);
...
...
include/SandClock.h
View file @
b3b9007d
...
...
@@ -29,26 +29,26 @@
class
SandClock
{
public
:
SandClock
()
:
state
(
false
),
sand
(
0
),
size
(
0
){}
SandClock
()
:
_state
(
false
),
_sand
(
0
),
_
size
(
0
){}
~
SandClock
(){}
// запустить часы (заново)
inline
void
run
(
int
msec
)
{
t
.
setTiming
(
msec
);
state
=
true
;
sand
=
msec
;
size
=
msec
;
_
state
=
true
;
_
sand
=
msec
;
_
size
=
msec
;
}
inline
void
reset
()
{
run
(
size
);
run
(
_
size
);
}
inline
int
duration
()
{
return
size
;
return
_
size
;
}
// перевернуть часы
// true - засечь время
...
...
@@ -56,17 +56,17 @@ class SandClock
// возвращает аргумент (т.е. идёт ли отсчёт времени)
inline
bool
rotate
(
bool
st
)
{
if
(
st
==
state
)
if
(
st
==
_
state
)
return
st
;
state
=
st
;
if
(
!
state
)
_
state
=
st
;
if
(
!
_
state
)
{
int
cur
=
t
.
getCurrent
();
sand
-=
cur
;
_
sand
-=
cur
;
if
(
sand
<
0
)
sand
=
0
;
if
(
_
sand
<
0
)
_
sand
=
0
;
// std::cout << "перевернули: прошло " << cur
// << " осталось " << sand
...
...
@@ -76,15 +76,15 @@ class SandClock
}
else
{
sand
+=
t
.
getCurrent
();
if
(
sand
>
size
)
sand
=
size
;
_
sand
+=
t
.
getCurrent
();
if
(
_sand
>
_
size
)
_sand
=
_
size
;
// std::cout << "вернули: прошло " << t.getCurrent()
// << " осталось " << sand
// << " засекам " << sand << endl;
t
.
setTiming
(
sand
);
t
.
setTiming
(
_
sand
);
}
return
st
;
}
...
...
@@ -108,19 +108,19 @@ class SandClock
{
// пока часы не "стоят"
// всегда false
if
(
!
state
)
if
(
!
_
state
)
return
false
;
return
t
.
checkTime
();
}
inline
bool
state
(){
return
state
;
}
inline
bool
state
(){
return
_
state
;
}
protected
:
PassiveTimer
t
;
bool
state
;
int
sand
;
int
size
;
bool
_
state
;
int
_
sand
;
int
_
size
;
};
// --------------------------------------------------------------------------
#endif
...
...
src/Communications/Modbus/ModbusHelpers.cc
View file @
b3b9007d
...
...
@@ -25,6 +25,13 @@ ModbusAddr ModbusHelpers::autodetectSlave( ModbusRTUMaster* m,
ModbusData
reg
,
SlaveFunctionCode
fn
)
{
if
(
beg
>
end
)
{
ModbusAddr
tmp
=
beg
;
beg
=
end
;
end
=
tmp
;
}
for
(
ModbusAddr
a
=
beg
;
a
<=
end
;
a
++
)
{
try
...
...
@@ -56,6 +63,9 @@ ModbusAddr ModbusHelpers::autodetectSlave( ModbusRTUMaster* m,
return
a
;
// узел ответил ошибкой (но связь то есть)
}
catch
(...){}
if
(
(
beg
==
0xff
)
||
(
end
==
0xff
)
)
break
;
}
throw
TimeOut
();
...
...
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