From 83298b2a9ebd46c30f277ab5a8fba61ba02c32f9 Mon Sep 17 00:00:00 2001 From: Paul C Diem Date: Tue, 9 Feb 2021 21:22:43 -0600 Subject: [PATCH] Rename DevGroupDevice to DevGroupTie --- tasmota/i18n.h | 2 +- tasmota/settings.h | 2 +- tasmota/settings.ino | 2 +- tasmota/support_command.ino | 28 ++++++++++++++-------------- tasmota/support_device_groups.ino | 6 +++--- tasmota/xdrv_04_light.ino | 2 +- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/tasmota/i18n.h b/tasmota/i18n.h index 8976c769f..27cd842ca 100644 --- a/tasmota/i18n.h +++ b/tasmota/i18n.h @@ -324,11 +324,11 @@ #define D_CMND_SPEEDUNIT "SpeedUnit" #define D_CMND_I2CSCAN "I2CScan" #define D_CMND_I2CDRIVER "I2CDriver" -#define D_CMND_DEVGROUP_DEVICE "DevGroupDevice" #define D_CMND_DEVGROUP_NAME "DevGroupName" #define D_CMND_DEVGROUP_SEND "DevGroupSend" #define D_CMND_DEVGROUP_SHARE "DevGroupShare" #define D_CMND_DEVGROUPSTATUS "DevGroupStatus" +#define D_CMND_DEVGROUP_DEVICE "DevGroupTie" #define D_CMND_SERIALSEND "SerialSend" #define D_CMND_SERIALDELIMITER "SerialDelimiter" #define D_CMND_BAUDRATE "Baudrate" diff --git a/tasmota/settings.h b/tasmota/settings.h index 4ddcb90b0..5f8484ea0 100644 --- a/tasmota/settings.h +++ b/tasmota/settings.h @@ -631,7 +631,7 @@ struct { // Only 32 bit boundary variables below uint64_t rf_protocol_mask; // FA8 - uint8_t device_group_device[4]; // FB0 + uint8_t device_group_tie[4]; // FB0 SysBitfield5 flag5; // FB4 uint16_t pulse_counter_debounce_low; // FB8 uint16_t pulse_counter_debounce_high; // FBA diff --git a/tasmota/settings.ino b/tasmota/settings.ino index a9c7500b5..9a9d9dcb6 100644 --- a/tasmota/settings.ino +++ b/tasmota/settings.ino @@ -1233,7 +1233,7 @@ void SettingsDelta(void) { } } if (Settings.version < 0x09020007) { - *(uint32_t *)&Settings.device_group_device = 0x04030201; + *(uint32_t *)&Settings.device_group_tie = 0x04030201; } Settings.version = VERSION; diff --git a/tasmota/support_command.ino b/tasmota/support_command.ino index 5d3e20559..139631e74 100644 --- a/tasmota/support_command.ino +++ b/tasmota/support_command.ino @@ -32,11 +32,11 @@ const char kTasmotaCommands[] PROGMEM = "|" // No prefix D_CMND_I2CSCAN "|" D_CMND_I2CDRIVER "|" #endif #ifdef USE_DEVICE_GROUPS - D_CMND_DEVGROUP_DEVICE "|" D_CMND_DEVGROUP_NAME "|" + D_CMND_DEVGROUP_NAME "|" #ifdef USE_DEVICE_GROUPS_SEND D_CMND_DEVGROUP_SEND "|" #endif // USE_DEVICE_GROUPS_SEND - D_CMND_DEVGROUP_SHARE "|" D_CMND_DEVGROUPSTATUS "|" + D_CMND_DEVGROUP_SHARE "|" D_CMND_DEVGROUPSTATUS "|" D_CMND_DEVGROUP_DEVICE "|" #endif // USE_DEVICE_GROUPS D_CMND_SENSOR "|" D_CMND_DRIVER #ifdef ESP32 @@ -59,11 +59,11 @@ void (* const TasmotaCommand[])(void) PROGMEM = { &CmndI2cScan, CmndI2cDriver, #endif #ifdef USE_DEVICE_GROUPS - &CmndDevGroupDevice, &CmndDevGroupName, + &CmndDevGroupName, #ifdef USE_DEVICE_GROUPS_SEND &CmndDevGroupSend, #endif // USE_DEVICE_GROUPS_SEND - &CmndDevGroupShare, &CmndDevGroupStatus, + &CmndDevGroupShare, &CmndDevGroupStatus, &CmndDevGroupTie, #endif // USE_DEVICE_GROUPS &CmndSensor, &CmndDriver #ifdef ESP32 @@ -2052,16 +2052,6 @@ void CmndI2cDriver(void) #endif // USE_I2C #ifdef USE_DEVICE_GROUPS -void CmndDevGroupDevice(void) -{ - if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= MAX_DEV_GROUP_NAMES)) { - if (XdrvMailbox.data_len > 0) { - Settings.device_group_device[XdrvMailbox.index - 1] = XdrvMailbox.payload; - } - ResponseCmndIdxNumber(Settings.device_group_device[XdrvMailbox.index - 1]); - } -} - void CmndDevGroupName(void) { if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= MAX_DEV_GROUP_NAMES)) { @@ -2102,6 +2092,16 @@ void CmndDevGroupStatus(void) { DeviceGroupStatus((XdrvMailbox.usridx ? XdrvMailbox.index - 1 : 0)); } + +void CmndDevGroupTie(void) +{ + if ((XdrvMailbox.index > 0) && (XdrvMailbox.index <= MAX_DEV_GROUP_NAMES)) { + if (XdrvMailbox.data_len > 0) { + Settings.device_group_tie[XdrvMailbox.index - 1] = XdrvMailbox.payload; + } + ResponseCmndIdxNumber(Settings.device_group_tie[XdrvMailbox.index - 1]); + } +} #endif // USE_DEVICE_GROUPS void CmndSensor(void) diff --git a/tasmota/support_device_groups.ino b/tasmota/support_device_groups.ino index 36ad56db5..b651443bb 100644 --- a/tasmota/support_device_groups.ino +++ b/tasmota/support_device_groups.ino @@ -401,7 +401,7 @@ void SendReceiveDeviceGroupMessage(struct device_group * device_group, struct de switch (item) { case DGR_ITEM_POWER: if (Settings.flag4.multiple_device_groups) { // SetOption88 - Enable relays in separate device groups - uint32_t device = Settings.device_group_device[device_group_index]; + uint32_t device = Settings.device_group_tie[device_group_index]; if (device) { bool on = (value & 1); if (on != ((TasmotaGlobal.power >> (device - 1)) & 1)) ExecuteCommandPower(device, (on ? POWER_ON : POWER_OFF), SRC_REMOTE); @@ -499,7 +499,7 @@ bool _SendDeviceGroupMessage(uint32_t device, DevGroupMessageType message_type, device_group_index = 0; if (Settings.flag4.multiple_device_groups) { // SetOption88 - Enable relays in separate device groups for (; device_group_index < device_group_count; device_group_index++) { - if (Settings.device_group_device[device_group_index] == device) break; + if (Settings.device_group_tie[device_group_index] == device) break; } } } @@ -537,7 +537,7 @@ bool _SendDeviceGroupMessage(uint32_t device, DevGroupMessageType message_type, // Call the drivers to build the status update. power_t power = TasmotaGlobal.power; if (Settings.flag4.multiple_device_groups) { // SetOption88 - Enable relays in separate device groups - power = (power >> (Settings.device_group_device[device_group_index] - 1)) & 1; + power = (power >> (Settings.device_group_tie[device_group_index] - 1)) & 1; } SendDeviceGroupMessage(-device_group_index, DGR_MSGTYP_PARTIAL_UPDATE, DGR_ITEM_NO_STATUS_SHARE, device_group->no_status_share, DGR_ITEM_POWER, power); XdrvMailbox.index = 0; diff --git a/tasmota/xdrv_04_light.ino b/tasmota/xdrv_04_light.ino index 48ba6cfce..2d8c2ec5b 100644 --- a/tasmota/xdrv_04_light.ino +++ b/tasmota/xdrv_04_light.ino @@ -2195,7 +2195,7 @@ void LightHandleDevGroupItem(void) static bool send_state = false; static bool restore_power = false; - if (Settings.device_group_device[*XdrvMailbox.topic] != Light.device) return; + if (Settings.device_group_tie[*XdrvMailbox.topic] != Light.device) return; bool more_to_come; uint32_t value = XdrvMailbox.payload; switch (XdrvMailbox.command_code) {