From 5855f35eef51b4c41d7655e5b9aae7dfb85f182b Mon Sep 17 00:00:00 2001 From: thelsing Date: Tue, 23 Jun 2020 00:21:00 +0200 Subject: [PATCH] fix #50 --- src/knx/dptconvert.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/knx/dptconvert.cpp b/src/knx/dptconvert.cpp index 1c5a734..9ed1154 100644 --- a/src/knx/dptconvert.cpp +++ b/src/knx/dptconvert.cpp @@ -416,11 +416,11 @@ int busValueToUnsigned8(const uint8_t* payload, size_t payload_length, const Dpt switch (datatype.subGroup) { case 1: - value = (uint8_t)(unsigned8FromPayload(payload, 0) * 100.0 / 255.0); + value = (uint8_t)round(unsigned8FromPayload(payload, 0) * 100.0 / 255.0); return true; case 3: - value = (uint8_t)unsigned8FromPayload(payload, 0) * 360.0 / 255.0; + value = (uint8_t)round(unsigned8FromPayload(payload, 0) * 360.0 / 255.0); return true; case 6: @@ -1839,4 +1839,4 @@ void bcdToPayload(uint8_t* payload, size_t payload_length, int index, uint8_t va payload[index / 2] = (payload[index / 2] & 0xF0) | (value & 0x0F); else payload[index / 2] = (payload[index / 2] & 0x0F) | ((value << 4) & 0xF0); -} \ No newline at end of file +}