Commit 81c46c59 authored by Pavel Vainerman's avatar Pavel Vainerman

(Calibration): исправил реализацию getRawValue()..

parent 29b752d6
...@@ -45,12 +45,12 @@ class Calibration ...@@ -45,12 +45,12 @@ class Calibration
/*! /*!
Получение сырого значения по калиброванному Получение сырого значения по калиброванному
\param crop - обрезать значение по крайним точкам, \param crop_cal - обрезать значение по крайним точкам,
если результат < minRaw или > maxRaw если оно < minVal или > maxVal (т.е. выходит за диапазон)
Если crop_result=false, то может быть возвращено значение outOfRange. Если crop_cal=false, то может быть возвращено значение outOfRange.
*/ */
long getRawValue( long cal, bool crop_result=false ); long getRawValue( long cal, bool crop_cal=false );
inline long getMinRaw(){ return minRaw; } inline long getMinRaw(){ return minRaw; }
inline long getMaxRaw(){ return maxRaw; } inline long getMaxRaw(){ return maxRaw; }
......
...@@ -238,6 +238,14 @@ long Calibration::getValue( long raw, bool crop_raw ) ...@@ -238,6 +238,14 @@ long Calibration::getValue( long raw, bool crop_raw )
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
long Calibration::getRawValue( long cal, bool crop_cal ) long Calibration::getRawValue( long cal, bool crop_cal )
{ {
if( crop_cal )
{
if( cal < minVal )
cal = minVal;
else if( cal > maxVal )
cal = maxVal;
}
for( PartsList::iterator it=plist.begin(); it!=plist.end(); ++it ) for( PartsList::iterator it=plist.begin(); it!=plist.end(); ++it )
{ {
TypeOfValue q(it->getX(cal)); TypeOfValue q(it->getX(cal));
...@@ -245,6 +253,7 @@ long Calibration::getRawValue( long cal, bool crop_cal ) ...@@ -245,6 +253,7 @@ long Calibration::getRawValue( long cal, bool crop_cal )
return tRound(q); return tRound(q);
} }
return outOfRange; return outOfRange;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
......
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