mirror of https://github.com/arendst/Tasmota.git
Use key count for SO88 default group count, minimize at 1
This commit is contained in:
parent
416b3f8e05
commit
90536d9939
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue