Merge pull request #7911 from pcdiem/device-groups2

Only set power for devices included in updates
This commit is contained in:
Theo Arends 2020-03-14 09:50:52 +01:00 committed by GitHub
commit 74fddccd28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -333,7 +333,7 @@ void _SendDeviceGroupMessage(uint8_t device_group_index, DeviceGroupMessageType
if (item > DGR_ITEM_MAX_16BIT) {
value >>= 8;
*message_ptr++ = value & 0xff;
*message_ptr++ = value >> 8;
*message_ptr++ = (item == DGR_ITEM_POWER ? devices_present : value >> 8);
}
}
}
@ -590,6 +590,8 @@ void ProcessDeviceGroupMessage(char * packet, int packet_length)
if (DeviceGroupItemShared(true, item)) {
if (item == DGR_ITEM_POWER) {
uint8_t mask_devices = value >> 24;
if (mask_devices > devices_present) mask_devices = devices_present;
for (uint32_t i = 0; i < devices_present; i++) {
uint32_t mask = 1 << i;
bool on = (value & mask);