mirror of
https://github.com/thelsing/knx.git
synced 2024-12-18 19:08:18 +01:00
fix #50
This commit is contained in:
parent
d3788d3ee4
commit
5855f35eef
@ -416,11 +416,11 @@ int busValueToUnsigned8(const uint8_t* payload, size_t payload_length, const Dpt
|
|||||||
switch (datatype.subGroup)
|
switch (datatype.subGroup)
|
||||||
{
|
{
|
||||||
case 1:
|
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;
|
return true;
|
||||||
|
|
||||||
case 3:
|
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;
|
return true;
|
||||||
|
|
||||||
case 6:
|
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);
|
payload[index / 2] = (payload[index / 2] & 0xF0) | (value & 0x0F);
|
||||||
else
|
else
|
||||||
payload[index / 2] = (payload[index / 2] & 0x0F) | ((value << 4) & 0xF0);
|
payload[index / 2] = (payload[index / 2] & 0x0F) | ((value << 4) & 0xF0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user