Changed color byte order from WRGB to RGBW (R MSB). (#168)

This commit is contained in:
mptei 2022-01-19 14:51:00 +01:00 committed by GitHub
parent 36e0a00e80
commit 6720f86e5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -813,8 +813,7 @@ int busValueToRGBW(const uint8_t* payload, size_t payload_length, const Dpt& dat
switch (datatype.index) { switch (datatype.index) {
case 0: // The RGBW value case 0: // The RGBW value
{ {
uint32_t rgbw = (unsigned32FromPayload(payload, 0) >> 8) uint32_t rgbw = unsigned32FromPayload(payload, 0);
+ (unsigned8FromPayload(payload, 3) << 24);
value = rgbw; value = rgbw;
} }
return true; return true;
@ -1548,13 +1547,11 @@ int valueToBusValueRGBW(const KNXValue& value, uint8_t* payload, size_t payload_
case 0: // RGBW case 0: // RGBW
{ {
uint32_t rgbw = (uint32_t)value; uint32_t rgbw = (uint32_t)value;
unsigned16ToPayload(payload, payload_length, 0, rgbw >> 8, 0xffff); // RG unsigned32ToPayload(payload, payload_length, 0, rgbw, 0xffffffff); // RGBW
unsigned8ToPayload(payload, payload_length, 2, rgbw, 0xff); // B
unsigned8ToPayload(payload, payload_length, 3, rgbw >> 24, 0xff); // W
} }
break; break;
case 1: // Mask bits case 1: // Mask bits
unsigned8ToPayload(payload, payload_length, 5, (uint8_t)value, 0xff); unsigned8ToPayload(payload, payload_length, 5, (uint8_t)value, 0x0f);
break; break;
} }