Changed setRaw Value

This commit is contained in:
2026-01-18 22:47:26 +01:00
parent 093b90fab6
commit 4309d2231e
4 changed files with 26 additions and 6 deletions

View File

@@ -166,8 +166,7 @@ void BCTransmitter::onUpdateValue( BCValuePtrConst valuePtr)
if( result.has_value() )
{
newState = BCValue::Flag::InSync;
newValue = result.value();
//qDebug() << " ---- " << BCTimeStamp << " DevID: " << devID << " RegID: " << regID << " Value: " << newValue;
newValue = result.value();
}
}

View File

@@ -90,9 +90,29 @@ uint32_t BCValue::getRawValue() const noexcept
return _rawValue;
}
/**
* @brief Speichert einen via CAN-Bus gelesenen Wert in
* der BCValue Struktur.
*/
void BCValue::setRawValue(uint32_t newRawValue) const
{
_rawValue = newRawValue;
// die per Zufallsgenerator erzeugten Werte des Dummy-Treibers
// können beliebigen Unsinn enthalten, also müssen wir sie
// auch skalieren.
double value = newRawValue * _factor;
if( _optMin.has_value() && _optMax.has_value() )
{
double min = _optMin.value();
double max = _optMax.value();
value = (int) qBound( min,value, max);
}
_rawValue = value / _factor;
}

View File

@@ -60,10 +60,9 @@ QWidget* BCValueDelegate::createEditor(QWidget *parent, const QStyleOptionViewIt
Q_UNUSED(option)
Q_UNUSED(index)
const BCValue& bcValue = *(_valueList[ index.row()].get());
const BCValue& bcValue = *(_valueList[ index.row()].get());
qDebug() << " --- upsy: " << bcValue.getLabel() << " ratio: " << bcValue.calcMinMaxRatio() << " raw: " << bcValue.getRawValue() << " scaled: " << bcValue.getScaledValue();
qDebug() << " --- Create Editor: " << bcValue.getLabel() << " ratio: " << bcValue.calcMinMaxRatio() << " raw: " << bcValue.getRawValue() << " scaled: " << bcValue.getScaledValue();
auto* valueEditor = new BCValueEditor(bcValue.getScaledValue(), parent);

View File

@@ -59,6 +59,8 @@ public:
void clearAllHighlights();
signals:
public slots:
void onHighlightRow(int row);