Commit 64eb9e5f authored by Pavel Vainerman's avatar Pavel Vainerman

(MBExchange): исправлена ошибка в реализации обмена с RTU188 (не сохранялись данные в SM)

parent 7a760111
...@@ -969,6 +969,8 @@ void MBExchange::updateSM() ...@@ -969,6 +969,8 @@ void MBExchange::updateSM()
updateRTU(it); updateRTU(it);
else if( d->dtype == dtMTR ) else if( d->dtype == dtMTR )
updateMTR(it); updateMTR(it);
else if( d->dtype == dtRTU188 )
updateRTU188(it);
} }
catch(IOController_i::NameNotFound &ex) catch(IOController_i::NameNotFound &ex)
{ {
...@@ -1580,22 +1582,48 @@ void MBExchange::updateMTR( RegMap::iterator& rit ) ...@@ -1580,22 +1582,48 @@ void MBExchange::updateMTR( RegMap::iterator& rit )
} }
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
void MBExchange::updateRTU188( RegMap::iterator& it ) void MBExchange::updateRTU188( RegMap::iterator& rit )
{ {
RegInfo* r(it->second); RegInfo* r(rit->second);
if( !r->dev->rtu ) if( !r || !r->dev || !r->dev->rtu )
return; return;
using namespace ModbusRTU; using namespace ModbusRTU;
// bool save = false; bool save = isWriteFunction( r->mbfunc );
// пока-что функции записи в обмене с RTU188
// не реализованы
if( isWriteFunction(r->mbfunc) ) if( isWriteFunction(r->mbfunc) )
{ {
// save = true;
cerr << myname << "(updateRTU188): write reg(" << dat2str(r->mbreg) << ") to RTU188 NOT YET!!!" << endl; cerr << myname << "(updateRTU188): write reg(" << dat2str(r->mbreg) << ") to RTU188 NOT YET!!!" << endl;
return; return;
} }
if( save && exchangeMode == emReadOnly )
{
if( dlog.debugging(Debug::LEVEL3) )
dlog[Debug::LEVEL3] << myname << "(updateRTU188):"
<< " skip... mode=emReadOnly " << endl;
return;
}
if( !save && exchangeMode == emWriteOnly )
{
if( dlog.debugging(Debug::LEVEL3) )
dlog[Debug::LEVEL3] << myname << "(updateRTU188):"
<< " skip... mode=emWriteOnly " << endl;
return;
}
if( save && exchangeMode == emSkipSaveToSM )
{
if( dlog.debugging(Debug::LEVEL3) )
dlog[Debug::LEVEL3] << myname << "(updateRT188):"
<< " skip... mode=emSkipSaveToSM " << endl;
return;
}
for( PList::iterator it=r->slst.begin(); it!=r->slst.end(); ++it ) for( PList::iterator it=r->slst.begin(); it!=r->slst.end(); ++it )
{ {
try try
...@@ -1604,14 +1632,11 @@ void MBExchange::updateRTU188( RegMap::iterator& it ) ...@@ -1604,14 +1632,11 @@ void MBExchange::updateRTU188( RegMap::iterator& it )
{ {
bool set = r->dev->rtu->getState(r->rtuJack,r->rtuChan,it->stype); bool set = r->dev->rtu->getState(r->rtuJack,r->rtuChan,it->stype);
IOBase::processingAsDI( &(*it), set, shm, force ); IOBase::processingAsDI( &(*it), set, shm, force );
continue;
} }
else if( it->stype == UniversalIO::AnalogInput )
if( it->stype == UniversalIO::AnalogInput )
{ {
long val = r->dev->rtu->getInt(r->rtuJack,r->rtuChan,it->stype); long val = r->dev->rtu->getInt(r->rtuJack,r->rtuChan,it->stype);
IOBase::processingAsAI( &(*it),val, shm, force ); IOBase::processingAsAI( &(*it), val, shm, force );
continue;
} }
} }
catch(IOController_i::NameNotFound &ex) catch(IOController_i::NameNotFound &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