Fix comment and add missing size adjustment in other method

This commit is contained in:
Nanosonde 2020-07-03 12:52:43 +02:00
parent cac333fbd2
commit 46fa13df04

View File

@ -230,7 +230,7 @@ void BauSystemB::propertyValueReadIndication(Priority priority, HopCountType hop
if (startIndex > 0) if (startIndex > 0)
size = elementSize * numberOfElements; size = elementSize * numberOfElements;
else else
size = sizeof(uint16_t); // size of propert array entry 0 which is the size size = sizeof(uint16_t); // size of property array entry 0 which contains the current number of elements
} }
else else
elementCount = 0; elementCount = 0;
@ -442,7 +442,10 @@ void BauSystemB::propertyValueRead(ObjectType objectType, uint8_t objectInstance
if (obj) if (obj)
{ {
uint8_t elementSize = obj->propertySize((PropertyID)propertyId); uint8_t elementSize = obj->propertySize((PropertyID)propertyId);
size = elementSize * numberOfElements; if (startIndex > 0)
size = elementSize * numberOfElements;
else
size = sizeof(uint16_t); // size of property array entry 0 which contains the current number of elements
*data = new uint8_t [size]; *data = new uint8_t [size];
obj->readProperty((PropertyID)propertyId, startIndex, elementCount, *data); obj->readProperty((PropertyID)propertyId, startIndex, elementCount, *data);
} }