From 90536d9939abe9160e7df82a3dce11133f958c81 Mon Sep 17 00:00:00 2001 From: Paul C Diem Date: Sun, 10 Oct 2021 17:16:35 -0500 Subject: [PATCH] Use key count for SO88 default group count, minimize at 1 --- tasmota/support_device_groups.ino | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tasmota/support_device_groups.ino b/tasmota/support_device_groups.ino index 6f82c71a9..4d7683ab3 100644 --- a/tasmota/support_device_groups.ino +++ b/tasmota/support_device_groups.ino @@ -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