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