From 483d868dac7e0998a39edd606ef351ff987f8c6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cornelius=20K=C3=B6pp?= Date: Fri, 1 Nov 2024 20:22:16 +0100 Subject: [PATCH] Fix `valueNoSend`: Do NOT End KO Uninitialized when Value Conversion Failed --- src/knx/group_object.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/knx/group_object.cpp b/src/knx/group_object.cpp index 21dce73..e1e069b 100644 --- a/src/knx/group_object.cpp +++ b/src/knx/group_object.cpp @@ -282,10 +282,11 @@ void GroupObject::valueNoSend(const KNXValue& value) void GroupObject::valueNoSend(const KNXValue& value, const Dpt& type) { - if (_commFlagEx.uninitialized) - commFlag(Ok); + const bool encodingDone = KNX_Encode_Value(value, _data, _dataLength, type); - KNX_Encode_Value(value, _data, _dataLength, type); + // initialize on succesful conversion only + if (encodingDone && _commFlagEx.uninitialized) + commFlag(Ok); } bool GroupObject::valueNoSendCompare(const KNXValue& value, const Dpt& type)