mirror of
https://github.com/arendst/Tasmota.git
synced 2025-04-27 00:07:17 +00:00
Merge pull request #9463 from pcdiem/dgr1
Add device group count/index checks
This commit is contained in:
commit
d689b74b24
@ -119,6 +119,7 @@ void DeviceGroupsInit(void)
|
|||||||
for (uint32_t relay_index = 0; relay_index < MAX_RELAYS; relay_index++) {
|
for (uint32_t relay_index = 0; relay_index < MAX_RELAYS; relay_index++) {
|
||||||
if (PinUsed(GPIO_REL1, relay_index)) device_group_count = relay_index + 1;
|
if (PinUsed(GPIO_REL1, relay_index)) device_group_count = relay_index + 1;
|
||||||
}
|
}
|
||||||
|
if (device_group_count > MAX_DEV_GROUP_NAMES) device_group_count = MAX_DEV_GROUP_NAMES;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise, set the device group count to 1.
|
// Otherwise, set the device group count to 1.
|
||||||
@ -464,6 +465,9 @@ bool _SendDeviceGroupMessage(uint8_t device_group_index, DevGroupMessageType mes
|
|||||||
// If device groups is not up, ignore this request.
|
// If device groups is not up, ignore this request.
|
||||||
if (!device_groups_up) return 1;
|
if (!device_groups_up) return 1;
|
||||||
|
|
||||||
|
// If the device group index is higher then the number of device groups, ignore this request.
|
||||||
|
if (device_group_index >= device_group_count) return 0;
|
||||||
|
|
||||||
// If we're currently processing a remote device message, ignore this request.
|
// If we're currently processing a remote device message, ignore this request.
|
||||||
if (ignore_dgr_sends && message_type != DGR_MSGTYPE_UPDATE_COMMAND) return 0;
|
if (ignore_dgr_sends && message_type != DGR_MSGTYPE_UPDATE_COMMAND) return 0;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user