Updated ValueHandling.
This commit is contained in:
18
bcvalue.cpp
18
bcvalue.cpp
@@ -41,18 +41,22 @@
|
||||
BCValue::BCValue( BCDevice::ID deviceID_, BC::ID registerID_)
|
||||
: deviceID{deviceID_}, registerID{registerID_}
|
||||
{
|
||||
visibleValue = "--";
|
||||
|
||||
}
|
||||
|
||||
QString BCValue::formatValues( uint32_t value ) const
|
||||
QString BCValue::formatValue() const
|
||||
{
|
||||
if( factor == 1 )
|
||||
return QString::number( value );
|
||||
return QString::number( rawUIntValue );
|
||||
|
||||
double result = value * factor;
|
||||
double result = rawUIntValue * factor;
|
||||
return QString::number(result, 'f', 2);
|
||||
}
|
||||
|
||||
bool BCValue::isWord() const
|
||||
{
|
||||
return flags.testFlag(BCValue::Flag::IsWord);
|
||||
}
|
||||
|
||||
double BCValue::calcRatio() const
|
||||
{
|
||||
@@ -73,7 +77,7 @@ double BCValue::calcRatio() const
|
||||
return ratio;
|
||||
|
||||
// Die eigentliche Formel
|
||||
ratio = ((rawValue - min) / range);
|
||||
ratio = ((rawDoubleValue - min) / range);
|
||||
//ratio = (int) qBound( min,ratio, max);
|
||||
}
|
||||
return ratio;
|
||||
@@ -83,8 +87,8 @@ void BCValue::dumpValue() const
|
||||
{
|
||||
|
||||
qDebug() << "DeviceID: " << deviceID << " Register: " << registerID << " state:" " << state << " << " label: " << label;
|
||||
qDebug() << "visibleValue: " << visibleValue << " min: " << optMin << " max: " << optMax << " factor: " << factor << " ValueType: " << (char)valueType << " ";
|
||||
qDebug() << "indexRow: " << indexRow << " isWord: " << isWord;
|
||||
qDebug() << "formattedValue: " << formatValue() << " min: " << optMin << " max: " << optMax << " factor: " << factor << " ValueType: " << (char)valueType << " ";
|
||||
qDebug() << "indexRow: " << indexRow << " isWord: " << isWord();
|
||||
qDebug();
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user