Updated ValueHandling.

This commit is contained in:
Christoph Holzheuer
2026-01-07 17:13:35 +01:00
parent 7d43b0a694
commit 3bdc491830
17 changed files with 152 additions and 150 deletions

View File

@@ -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();
}