mirror of
https://github.com/thelsing/knx.git
synced 2024-12-18 19:08:18 +01:00
Fix: Do NOT Send when Updating KO Failed on Value Conversion
This commit is contained in:
parent
483d868dac
commit
b8f914c358
@ -226,8 +226,11 @@ GroupObjectUpdatedHandler GroupObject::callback()
|
||||
|
||||
void GroupObject::value(const KNXValue& value, const Dpt& type)
|
||||
{
|
||||
valueNoSend(value, type);
|
||||
objectWritten();
|
||||
if (_valueNoSend(value, type))
|
||||
{
|
||||
// write on successful conversion/setting value only
|
||||
objectWritten();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -281,12 +284,20 @@ void GroupObject::valueNoSend(const KNXValue& value)
|
||||
#endif
|
||||
|
||||
void GroupObject::valueNoSend(const KNXValue& value, const Dpt& type)
|
||||
{
|
||||
// ignore actual updating TODO check replacing valueNoSend with _valueNoSend
|
||||
_valueNoSend(value, type);
|
||||
}
|
||||
|
||||
bool GroupObject::_valueNoSend(const KNXValue& value, const Dpt& type)
|
||||
{
|
||||
const bool encodingDone = KNX_Encode_Value(value, _data, _dataLength, type);
|
||||
|
||||
// initialize on succesful conversion only
|
||||
if (encodingDone && _commFlagEx.uninitialized)
|
||||
commFlag(Ok);
|
||||
|
||||
return encodingDone;
|
||||
}
|
||||
|
||||
bool GroupObject::valueNoSendCompare(const KNXValue& value, const Dpt& type)
|
||||
@ -294,8 +305,7 @@ bool GroupObject::valueNoSendCompare(const KNXValue& value, const Dpt& type)
|
||||
if (_commFlagEx.uninitialized)
|
||||
{
|
||||
// always set first value
|
||||
this->valueNoSend(value, type);
|
||||
return true;
|
||||
return _valueNoSend(value, type);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -284,4 +284,16 @@ class GroupObject
|
||||
GroupObjectUpdatedHandler _updateHandler;
|
||||
Dpt _datapointType;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* set the current value of the group object and show success.
|
||||
* @param value the value the group object is set to
|
||||
* @param type the datapoint type used for the conversion.
|
||||
*
|
||||
* The parameters must fit the group object. Otherwise it will stay unchanged.
|
||||
*
|
||||
* @returns true if the value of the group object was updated after successful conversion.
|
||||
*/
|
||||
bool _valueNoSend(const KNXValue& value, const Dpt& type);
|
||||
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user