From a5ba7bcd5ea88a29d355ed512e46b0c7fef2511b Mon Sep 17 00:00:00 2001 From: John Doe Date: Mon, 26 Jun 2023 10:15:51 +0200 Subject: [PATCH] fixed wrong answers to property read: with start = 0 (read the number of current elements) and current elements = 0 (empty property) 0 was returned which results in an error message when reading this property. --- src/knx/data_property.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/knx/data_property.cpp b/src/knx/data_property.cpp index 1bf0223..8cd9237 100644 --- a/src/knx/data_property.cpp +++ b/src/knx/data_property.cpp @@ -5,15 +5,16 @@ uint8_t DataProperty::read(uint16_t start, uint8_t count, uint8_t* data) const { - if (count == 0 || _currentElements == 0 || start > _currentElements || count > _currentElements - start + 1) - return 0; - if (start == 0) { pushWord(_currentElements, data); return 1; } + if (count == 0 || _currentElements == 0 || start > _currentElements || count > _currentElements - start + 1) + return 0; + + // we start counting with zero start -= 1;