Rename DevGroupDevice to DevGroupTie

This commit is contained in:
Paul C Diem 2021-02-09 21:22:43 -06:00
parent 133826c331
commit 83298b2a9e
6 changed files with 21 additions and 21 deletions

View File

@ -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"

View File

@ -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

View File

@ -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;

View File

@ -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)

View File

@ -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;

View File

@ -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) {