Commit e77363e6 authored by Ilya Shpigor's avatar Ilya Shpigor

implementation of the inverse logic

parent 1e9c8d73
......@@ -291,6 +291,7 @@ interface IONotifyController_i : IOController_i
ThresholdState state;
long tv_sec; /*!< , (gettimeofday) */
long tv_usec; /*!< , (gettimeofday) */
boolean inverse; /*!< */
};
typedef sequence<ThresholdInfo> ThresholdInfoSeq;
......
......@@ -369,10 +369,20 @@ void IOBase::processingThreshold( IOBase* it, SMInterface* shm, bool force )
// cout << "val=" << val << " set=" << set << endl;
//
// lowLimit-
if( val <= (it->ti.lowlimit-it->ti.sensibility) )
set = false;
else if( val >= (it->ti.hilimit+it->ti.sensibility) )
set = true;
if (it->ti.inverse)
{
if( val <= (it->ti.lowlimit-it->ti.sensibility) )
set = true;
else if( val >= (it->ti.hilimit+it->ti.sensibility) )
set = false;
}
else
{
if( val <= (it->ti.lowlimit-it->ti.sensibility) )
set = false;
else if( val >= (it->ti.hilimit+it->ti.sensibility) )
set = true;
}
// cout << "thresh: set=" << set << endl;
processingAsDI(it,set,shm,force);
......@@ -527,6 +537,7 @@ bool IOBase::initItem( IOBase* b, UniXML_iterator& it, SMInterface* shm,
b->ti.lowlimit = it.getIntProp("lowlimit");
b->ti.hilimit = it.getIntProp("hilimit");
b->ti.sensibility = it.getIntProp("sensibility");
b->ti.inverse = it.getIntProp("inverse");
}
}
// else
......
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