From c2773955c6da0ef8b745b03f000b70d853b8bbce Mon Sep 17 00:00:00 2001 From: Waldemar Porscha Date: Tue, 3 Mar 2026 20:18:05 +0100 Subject: [PATCH 1/3] HOTFIX: DPT16 was not correctly handled for uninitialized KOs --- src/knx/dpt.cpp | 2 +- src/knx/group_object.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/knx/dpt.cpp b/src/knx/dpt.cpp index 1a0dec05..644b81cb 100644 --- a/src/knx/dpt.cpp +++ b/src/knx/dpt.cpp @@ -72,7 +72,7 @@ unsigned char Dpt::sizeInMemory() const case 275: return 8; case 16: - return 15; // terminating with 0x00 char + return 14; case 285: return 16; default: diff --git a/src/knx/group_object.cpp b/src/knx/group_object.cpp index 1c7d2916..e280d6a5 100644 --- a/src/knx/group_object.cpp +++ b/src/knx/group_object.cpp @@ -293,8 +293,9 @@ void GroupObject::recalculateDataLength(const Dpt& type) _dataLength = sizeInMemory; if (_data) delete[] _data; - _data = new uint8_t[_dataLength]; - memset(_data, 0, _dataLength); + if (type.mainGroup == 16) sizeInMemory++; + _data = new uint8_t[sizeInMemory]; + memset(_data, 0, sizeInMemory); } } From 8f553845cfe432701b167aa62810ec31e970ae55 Mon Sep 17 00:00:00 2001 From: Waldemar Porscha Date: Tue, 3 Mar 2026 22:16:09 +0100 Subject: [PATCH 2/3] FIX: rename sizeInMemory to dataLength for better semantics - no functional change --- src/knx/dpt.cpp | 2 +- src/knx/dpt.h | 2 +- src/knx/group_object.cpp | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/knx/dpt.cpp b/src/knx/dpt.cpp index 644b81cb..56a959aa 100644 --- a/src/knx/dpt.cpp +++ b/src/knx/dpt.cpp @@ -22,7 +22,7 @@ bool Dpt::operator!=(const Dpt& other) const return !(other == *this); } -unsigned char Dpt::sizeInMemory() const +unsigned char Dpt::dataLength() const { switch (mainGroup) { diff --git a/src/knx/dpt.h b/src/knx/dpt.h index 97fdc797..327ef127 100644 --- a/src/knx/dpt.h +++ b/src/knx/dpt.h @@ -370,5 +370,5 @@ class Dpt unsigned short index; bool operator==(const Dpt& other) const; bool operator!=(const Dpt& other) const; - unsigned char sizeInMemory() const; + unsigned char dataLength() const; }; diff --git a/src/knx/group_object.cpp b/src/knx/group_object.cpp index e280d6a5..7f5247df 100644 --- a/src/knx/group_object.cpp +++ b/src/knx/group_object.cpp @@ -287,13 +287,13 @@ bool GroupObject::valueNoSend(const KNXValue& value) void GroupObject::recalculateDataLength(const Dpt& type) { - uint8_t sizeInMemory = type.sizeInMemory(); - if (_commFlagEx.uninitialized && sizeInMemory > _dataLength) + uint8_t dataLength = type.dataLength(); + if (_commFlagEx.uninitialized && dataLength > _dataLength) { - _dataLength = sizeInMemory; + _dataLength = dataLength; if (_data) delete[] _data; - if (type.mainGroup == 16) sizeInMemory++; + uint8_t sizeInMemory = (type.mainGroup == 16) ? dataLength + 1 : dataLength; _data = new uint8_t[sizeInMemory]; memset(_data, 0, sizeInMemory); } From f680162de203b7c7f17a3ecb8e617b7601dc9dd6 Mon Sep 17 00:00:00 2001 From: Waldemar Porscha Date: Wed, 4 Mar 2026 10:37:18 +0100 Subject: [PATCH 3/3] - uptdate changelog and version --- README.md | 4 ++++ library.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index e537c5c0..6ab446db 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,10 @@ See the examples for basic usage options ## Changelog +### v2.3.1 - 2026-03-04 + +- Hotfix: DPT16 was not correctly handled for uninitialized KOs + ### v2.3.0 - 2026-01-28 - Fix Define for 'DPT_FlowRate_m3/h' - Enhance multicast initialization logging diff --git a/library.json b/library.json index 9aa1f542..de6f5c3b 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "knx", - "version": "2.2.2", + "version": "2.3.1", "description": "knx stack", "homepage": "https://openknx.de", "authors": [