KNX Lib: Fix 32bits decode

This commit is contained in:
Adrian Scillato 2020-11-16 15:25:54 -03:00 committed by GitHub
parent 246c47d96e
commit 0648881cae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 2 deletions

View File

@ -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]);
}
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;
}