mirror of https://github.com/arendst/Tasmota.git
Update xdrv_10_KNX.ino
This commit is contained in:
parent
68924af190
commit
e8e7948eb3
|
@ -401,15 +401,31 @@ void KNXStart()
|
||||||
|
|
||||||
// Delete from KNX settings any configuration that is not anymore related to this device
|
// Delete from KNX settings any configuration that is not anymore related to this device
|
||||||
byte j;
|
byte j;
|
||||||
for (int i = 0; i < Settings.knx_GA_registered; ++i)
|
for (int i = 0; i < KNX_MAX_device_param; ++i)
|
||||||
{
|
{
|
||||||
j = Settings.knx_GA_param[i];
|
if ( !device_param[i].show ) { // device has this parameter ?
|
||||||
if ( !device_param[j-1].show ) { Settings.knx_GA_param[i] = 0; }
|
j = KNX_GA_Search(i+1); // if not, search for all registered group address to this parameter and delete them
|
||||||
|
while ( j != KNX_Empty ) {
|
||||||
|
KNX_DEL_GA(j);
|
||||||
|
j = KNX_GA_Search(i+1, j + 1);
|
||||||
}
|
}
|
||||||
for (int i = 0; i < Settings.knx_CB_registered; ++i)
|
if ( (i < 8) || (i > 15) ) // check relays and sensors (i from 8 to 16 are toggle relays parameters)
|
||||||
{
|
{
|
||||||
j = Settings.knx_CB_param[i];
|
j = KNX_CB_Search(i+1); // if not, search for all registered group address to this parameter and delete them
|
||||||
if ( !device_param[j-1].show ) { Settings.knx_CB_param[i] = 0; }
|
while ( j != KNX_Empty ) {
|
||||||
|
KNX_DEL_CB(j);
|
||||||
|
j = KNX_CB_Search(i+1, j + 1);
|
||||||
|
}
|
||||||
|
if (i < 8) // when checking if relays are available, also change for toggle relays parameters
|
||||||
|
{
|
||||||
|
j = KNX_CB_Search(i+8); // if not, search for all registered group address to this parameter and delete them
|
||||||
|
while ( j != KNX_Empty ) {
|
||||||
|
KNX_DEL_CB(j);
|
||||||
|
j = KNX_CB_Search(i+8, j + 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register Group Addresses to listen to
|
// Register Group Addresses to listen to
|
||||||
|
@ -511,17 +527,17 @@ void KNX_Send_Button_Power(byte key, byte device, byte state)
|
||||||
// {
|
// {
|
||||||
|
|
||||||
// Search all the registered GA that has that output (variable: device) as parameter
|
// Search all the registered GA that has that output (variable: device) as parameter
|
||||||
byte i = KNX_GA_Search(device + 7);
|
byte i = KNX_GA_Search(device + 8);
|
||||||
while ( i != KNX_Empty ) {
|
while ( i != KNX_Empty ) {
|
||||||
KNX_addr.value = Settings.knx_GA_addr[i];
|
KNX_addr.value = Settings.knx_GA_addr[i];
|
||||||
knx.write_1bit(KNX_addr, !(state == 0));
|
knx.write_1bit(KNX_addr, !(state == 0));
|
||||||
|
|
||||||
snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_KNX "%s = %d " D_SENT_TO " %d.%d.%d"),
|
snprintf_P(log_data, sizeof(log_data), PSTR(D_LOG_KNX "%s = %d " D_SENT_TO " %d.%d.%d"),
|
||||||
device_param_ga[device + 7], !(state == 0),
|
device_param_ga[device + 8], !(state == 0),
|
||||||
KNX_addr.ga.area, KNX_addr.ga.line, KNX_addr.ga.member);
|
KNX_addr.ga.area, KNX_addr.ga.line, KNX_addr.ga.member);
|
||||||
AddLog(LOG_LEVEL_INFO);
|
AddLog(LOG_LEVEL_INFO);
|
||||||
|
|
||||||
i = KNX_GA_Search(device + 7, i + 1);
|
i = KNX_GA_Search(device + 8, i + 1);
|
||||||
}
|
}
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue