Commit b238fb11 authored by Pavel Vainerman's avatar Pavel Vainerman

(IOControl): исправление ошибки конфигурирования пороговых датчиков

parent f2d57bfe
...@@ -331,7 +331,6 @@ void IOControl::execute() ...@@ -331,7 +331,6 @@ void IOControl::execute()
{ {
try try
{ {
if( !noCards ) if( !noCards )
{ {
check_testmode(); check_testmode();
...@@ -749,6 +748,37 @@ bool IOControl::initIOItem( UniXML_iterator& it ) ...@@ -749,6 +748,37 @@ bool IOControl::initIOItem( UniXML_iterator& it )
else else
inf.subdev = DefaultSubdev; inf.subdev = DefaultSubdev;
} }
if( !IOBase::initItem(&inf,it,shm,&unideb,myname,filtersize,filterT) )
return false;
// если вектор уже заполнен
// то увеличиваем его на 30 элементов (с запасом)
// после инициализации делается resize
// под реальное количество
if( maxItem >= iomap.size() )
iomap.resize(maxItem+30);
int prior = it.getIntProp("iopriority");
if( prior > 0 )
{
IOPriority p(prior,maxItem);
pmap.push_back(p);
if( dlog.debugging(Debug::LEVEL3) )
dlog[Debug::LEVEL3] << myname << "(readItem): add to priority list: " <<
it.getProp("name")
<< " priority=" << prior << endl;
}
// значит это пороговый датчик..
if( inf.t_ai != DefaultObjectId )
{
iomap[maxItem++] = inf;
if( dlog.debugging(Debug::LEVEL3) )
dlog[Debug::LEVEL3] << myname << "(readItem): add threshold '" << it.getProp("name")
<< " for '" << conf->oind->getNameById(inf.t_ai) << endl;
return true;
}
inf.channel = it.getIntProp("channel"); inf.channel = it.getIntProp("channel");
if( inf.channel < 0 || inf.channel > 32 ) if( inf.channel < 0 || inf.channel > 32 )
...@@ -758,9 +788,6 @@ bool IOControl::initIOItem( UniXML_iterator& it ) ...@@ -758,9 +788,6 @@ bool IOControl::initIOItem( UniXML_iterator& it )
return false; return false;
} }
if( !IOBase::initItem(&inf,it,shm,&unideb,myname,filtersize,filterT) )
return false;
inf.lamp = it.getIntProp("lamp"); inf.lamp = it.getIntProp("lamp");
inf.no_testlamp = it.getIntProp("no_iotestlamp"); inf.no_testlamp = it.getIntProp("no_iotestlamp");
inf.enable_testmode = it.getIntProp("enable_testmode"); inf.enable_testmode = it.getIntProp("enable_testmode");
...@@ -792,23 +819,6 @@ bool IOControl::initIOItem( UniXML_iterator& it ) ...@@ -792,23 +819,6 @@ bool IOControl::initIOItem( UniXML_iterator& it )
if( unideb.debugging(Debug::LEVEL3) ) if( unideb.debugging(Debug::LEVEL3) )
dlog[Debug::LEVEL3] << myname << "(readItem): add: " << inf.stype << " " << inf << endl; dlog[Debug::LEVEL3] << myname << "(readItem): add: " << inf.stype << " " << inf << endl;
// если вектор уже заполнен
// то увеличиваем его на 10 элементов (с запасом)
// после инициализации делается resize
// под реальное количество
if( maxItem >= iomap.size() )
iomap.resize(maxItem+10);
int prior = it.getIntProp("iopriority");
if( prior > 0 )
{
IOPriority p(prior,maxItem);
pmap.push_back(p);
dlog[Debug::LEVEL3] << myname << "(readItem): add to priority list: " <<
it.getProp("name")
<< " priority=" << prior << endl;
}
iomap[maxItem++] = inf; iomap[maxItem++] = inf;
return true; return true;
} }
......
...@@ -9,11 +9,8 @@ uniset-start.sh -f ./uniset-iocontrol --smemory-id SharedMemory \ ...@@ -9,11 +9,8 @@ uniset-start.sh -f ./uniset-iocontrol --smemory-id SharedMemory \
--io-polltime 100 \ --io-polltime 100 \
--io-s-filter-field io \ --io-s-filter-field io \
--io-s-filter-value 1 \ --io-s-filter-value 1 \
--io-numcards 2 \
--iodev1 /dev/null \
--iodev2 /dev/null \
--io-test-lamp Input1_S \ --io-test-lamp Input1_S \
--io-heartbeat-id AI_AS \ --io-heartbeat-id AI_AS \
--io-sm-ready-test-sid Input1_S \ --io-sm-ready-test-sid Input1_S \
--unideb-add-levels info,crit,warn,level9,system --unideb-add-levels any --dlog-add-levels any
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