Commit ffbaa93f authored by Pavel Vainerman's avatar Pavel Vainerman

(ModbusTCPMultiMaster): немного поменял работу с флагом use

parent 392b948b
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
Name: libuniset2 Name: libuniset2
Version: 2.1 Version: 2.1
Release: alt12 Release: alt13
Summary: UniSet - library for building distributed industrial control systems Summary: UniSet - library for building distributed industrial control systems
...@@ -456,6 +456,9 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname ...@@ -456,6 +456,9 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
# .. # ..
%changelog %changelog
* Sat Aug 08 2015 Pavel Vainerman <pv@altlinux.ru> 2.1-alt13
- (ModbusMultiMaster): minor fixes (add "force" for <GateList>)
* Sat Aug 08 2015 Pavel Vainerman <pv@altlinux.ru> 2.1-alt12 * Sat Aug 08 2015 Pavel Vainerman <pv@altlinux.ru> 2.1-alt12
- (Modbus): minor fixes in ModbusMultiMaster - (Modbus): minor fixes in ModbusMultiMaster
......
...@@ -95,6 +95,7 @@ MBTCPMultiMaster::MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::Ob ...@@ -95,6 +95,7 @@ MBTCPMultiMaster::MBTCPMultiMaster( UniSetTypes::ObjectId objId, UniSetTypes::Ob
sinf.aftersend_pause = it1.getPIntProp("aftersend_pause", aftersend_pause); sinf.aftersend_pause = it1.getPIntProp("aftersend_pause", aftersend_pause);
sinf.sleepPause_usec = it1.getPIntProp("sleepPause_usec", sleepPause_usec); sinf.sleepPause_usec = it1.getPIntProp("sleepPause_usec", sleepPause_usec);
sinf.respond_invert = it1.getPIntProp("invert", 0); sinf.respond_invert = it1.getPIntProp("invert", 0);
sinf.respond_force = it1.getPIntProp("force", 0);
sinf.force_disconnect = it.getPIntProp("persistent_connection", !force_disconnect) ? false : true; sinf.force_disconnect = it.getPIntProp("persistent_connection", !force_disconnect) ? false : true;
...@@ -264,9 +265,6 @@ void MBTCPMultiMaster::final_thread() ...@@ -264,9 +265,6 @@ void MBTCPMultiMaster::final_thread()
bool MBTCPMultiMaster::MBSlaveInfo::check() bool MBTCPMultiMaster::MBSlaveInfo::check()
{ {
if( use )
return true;
return mbtcp->checkConnection(ip, port, recv_timeout); return mbtcp->checkConnection(ip, port, recv_timeout);
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
...@@ -365,13 +363,16 @@ void MBTCPMultiMaster::check_thread() ...@@ -365,13 +363,16 @@ void MBTCPMultiMaster::check_thread()
{ {
try try
{ {
if( it->use ) // игнорируем текущий mbtcp
continue;
bool r = it->check(); bool r = it->check();
mbinfo << myname << "(check): " << it->myname << " " << ( r ? "OK" : "FAIL" ) << endl; mbinfo << myname << "(check): " << it->myname << " " << ( r ? "OK" : "FAIL" ) << endl;
cerr << "respond_init=" << it->respond_init << endl; cerr << "respond_init=" << it->respond_init << endl;
try try
{ {
if( it->respond_id != DefaultObjectId && (force_out || !it->respond_init || r != it->respond) ) if( it->respond_id != DefaultObjectId && (it->respond_force || !it->respond_init || r != it->respond) )
{ {
bool set = it->respond_invert ? !it->respond : it->respond; bool set = it->respond_invert ? !it->respond : it->respond;
shm->localSetValue(it->respond_it, it->respond_id, (set ? 1 : 0), getId()); shm->localSetValue(it->respond_it, it->respond_id, (set ? 1 : 0), getId());
......
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
<item addr="0x02" respondSensor="RTU2_Respond_FS" timeout="2000" invert="0"/> <item addr="0x02" respondSensor="RTU2_Respond_FS" timeout="2000" invert="0"/>
</DeviceList> </DeviceList>
<GateList> <GateList>
<item ip="" port="" respond_id="" priority=""/> <item ip="" port="" respond_id="" priority="" force=""/>
<item ip="" port="" respond_id="" priority="" respond_invert="1"/> <item ip="" port="" respond_id="" priority="" respond_invert="1"/>
<GateList> <GateList>
</MBMaster1> </MBMaster1>
...@@ -65,6 +65,7 @@ ...@@ -65,6 +65,7 @@
- \b respond - датчик связи по данному каналу (помимо обобщённого) - \b respond - датчик связи по данному каналу (помимо обобщённого)
- \b priority - приоритет канала (чем больше число, тем выше приоритет) - \b priority - приоритет канала (чем больше число, тем выше приоритет)
- \b respond_invert - инвертировать датчик связи (DI) - \b respond_invert - инвертировать датчик связи (DI)
- \b force [1,0] - "1" - обновлять значение датчика связи в SM принудительно на каждом цикле проверки ("0" - только по изменению).
\par Параметры запуска \par Параметры запуска
...@@ -265,6 +266,7 @@ class MBTCPMultiMaster: ...@@ -265,6 +266,7 @@ class MBTCPMultiMaster:
IOController::IOStateList::iterator respond_it; IOController::IOStateList::iterator respond_it;
bool respond_invert; bool respond_invert;
bool respond_init = { false }; bool respond_init = { false };
bool respond_force = { false }; // флаг означающий принудительно обновлять значение датчика связи на каждом цикле проверки
inline bool operator < ( const MBSlaveInfo& mbs ) const inline bool operator < ( const MBSlaveInfo& mbs ) const
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment