Merge pull request #13322 from pcdiem/dgr1

Use key count for SO88 default group count, minimize at 1
This commit is contained in:
Theo Arends 2021-10-11 08:54:36 +02:00 committed by GitHub
commit 52620e2329
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 7 deletions

View File

@ -111,18 +111,18 @@ void DeviceGroupsInit(void)
if (!device_group_count) {
// If relays in separate device groups is enabled, set the device group count to highest numbered
// relay.
// button.
if (Settings->flag4.multiple_device_groups) { // SetOption88 - Enable relays in separate device groups
for (uint32_t relay_index = 0; relay_index < MAX_RELAYS; relay_index++) {
if (PinUsed(GPIO_REL1, relay_index)) device_group_count = relay_index + 1;
for (uint32_t index = 0; index < MAX_KEYS; index++) {
if (PinUsed(GPIO_KEY1, index)) device_group_count = 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.
else {
// Set up a minimum of one device group.
if (!device_group_count)
device_group_count = 1;
}
else if (device_group_count > MAX_DEV_GROUP_NAMES)
device_group_count = MAX_DEV_GROUP_NAMES;
}
// If there are more device group names set than the number of device groups needed by the