mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-27 20:56:35 +00:00
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 (!device_group_count) {
|
||||||
|
|
||||||
// If relays in separate device groups is enabled, set the device group count to highest numbered
|
// 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
|
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++) {
|
for (uint32_t index = 0; index < MAX_KEYS; index++) {
|
||||||
if (PinUsed(GPIO_REL1, relay_index)) device_group_count = relay_index + 1;
|
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.
|
// Set up a minimum of one device group.
|
||||||
else {
|
if (!device_group_count)
|
||||||
device_group_count = 1;
|
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
|
// If there are more device group names set than the number of device groups needed by the
|
||||||
|
Loading…
x
Reference in New Issue
Block a user