From 0648881cae78b24345948577e4c3dc114116ed72 Mon Sep 17 00:00:00 2001 From: Adrian Scillato <35405447+ascillato@users.noreply.github.com> Date: Mon, 16 Nov 2020 15:25:54 -0300 Subject: [PATCH] KNX Lib: Fix 32bits decode --- lib/lib_div/esp-knx-ip-0.5.2/src/esp-knx-ip-conversion.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/lib_div/esp-knx-ip-0.5.2/src/esp-knx-ip-conversion.cpp b/lib/lib_div/esp-knx-ip-0.5.2/src/esp-knx-ip-conversion.cpp index 9dc2fd563..06c5127a2 100644 --- a/lib/lib_div/esp-knx-ip-0.5.2/src/esp-knx-ip-conversion.cpp +++ b/lib/lib_div/esp-knx-ip-0.5.2/src/esp-knx-ip-conversion.cpp @@ -83,5 +83,7 @@ uint32_t ESPKNXIP::data_to_4byte_uint(uint8_t *data) float ESPKNXIP::data_to_4byte_float(uint8_t *data) { - return (float)((data[1] << 24) | (data[2] << 16) | (data[3] << 8) |data[4]); -} \ No newline at end of file + union { float f; uint32_t i; } num; + num.i = (uint32_t)((data[1] << 24) | (data[2] << 16) | (data[3] << 8) | (data[4] << 0)); + return num.f; +}