Commit b69e187b authored by Pavel Vainerman's avatar Pavel Vainerman

(MBExchange): поменял механизм выставления датчиков связи..

parent ce3262ba
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
Name: libuniset2 Name: libuniset2
Version: 2.2 Version: 2.2
Release: alt2 Release: alt3
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
* Mon Sep 21 2015 Pavel Vainerman <pv@altlinux.ru> 2.2-alt3
- (ModbusMaster): modify check "not respond" mechanism
* Sun Sep 20 2015 Pavel Vainerman <pv@altlinux.ru> 2.2-alt2 * Sun Sep 20 2015 Pavel Vainerman <pv@altlinux.ru> 2.2-alt2
- minor fixes after 'cppcheck' - minor fixes after 'cppcheck'
......
...@@ -3029,6 +3029,9 @@ bool MBExchange::poll() ...@@ -3029,6 +3029,9 @@ bool MBExchange::poll()
if( !mb ) if( !mb )
return false; return false;
for( auto it1 = devices.begin(); it1 != devices.end(); ++it1 )
it1->second->resp_ptInit.reset();
} }
if( !allInitOK ) if( !allInitOK )
...@@ -3152,10 +3155,11 @@ bool MBExchange::RTUDevice::checkRespond( std::shared_ptr<DebugStream>& mblog ) ...@@ -3152,10 +3155,11 @@ bool MBExchange::RTUDevice::checkRespond( std::shared_ptr<DebugStream>& mblog )
<< " [ timeout=" << resp_Delay.getOnDelay() << " [ timeout=" << resp_Delay.getOnDelay()
<< " numreply=" << numreply << " numreply=" << numreply
<< " prev_numreply=" << prev_numreply << " prev_numreply=" << prev_numreply
<< " resp_ptInit=" << resp_ptInit.checkTime()
<< " ]" << " ]"
<< endl; << endl;
return (prev != resp_state || resp_force); return ((prev != resp_state || resp_force ) && resp_ptInit.checkTime());
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void MBExchange::updateRespondSensors() void MBExchange::updateRespondSensors()
...@@ -3164,7 +3168,7 @@ void MBExchange::updateRespondSensors() ...@@ -3164,7 +3168,7 @@ void MBExchange::updateRespondSensors()
{ {
auto d(it1.second); auto d(it1.second);
if( d->resp_id != DefaultObjectId && (d->checkRespond(mblog) || d->resp_force || d->resp_ptInit.checkTime()) ) if( d->resp_id != DefaultObjectId && d->checkRespond(mblog) )
{ {
try try
{ {
...@@ -3182,10 +3186,6 @@ void MBExchange::updateRespondSensors() ...@@ -3182,10 +3186,6 @@ void MBExchange::updateRespondSensors()
<< endl; << endl;
shm->localSetValue(d->resp_it, d->resp_id, ( set ? 1 : 0 ), getId()); shm->localSetValue(d->resp_it, d->resp_id, ( set ? 1 : 0 ), getId());
// если первый раз инициализация прошла.. отключаем таймер
if( d->resp_ptInit.checkTime() )
d->resp_ptInit.setTiming( PassiveTimer::WaitUpTime );
} }
catch( const Exception& ex ) catch( const Exception& ex )
{ {
......
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