Only set power for devices included in updates

This commit is contained in:
Paul C Diem 2020-03-13 16:53:27 -05:00
parent d26ce074d8
commit 50d63f8678
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);