mirror of https://github.com/arendst/Tasmota.git
Merge pull request #3528 from ascillato/patch-1
Add extra KNX configuration check at startup
This commit is contained in:
commit
db3681ef12
|
@ -400,6 +400,7 @@ void KNX_DEL_CB( byte CBnum )
|
|||
|
||||
bool KNX_CONFIG_NOT_MATCH()
|
||||
{
|
||||
// Check for configured parameters that the device does not have (module changed)
|
||||
for (byte i = 0; i < KNX_MAX_device_param; ++i)
|
||||
{
|
||||
if ( !device_param[i].show ) { // device has this parameter ?
|
||||
|
@ -407,19 +408,42 @@ bool KNX_CONFIG_NOT_MATCH()
|
|||
|
||||
// Checks all GA
|
||||
if ( KNX_GA_Search(i+1) != KNX_Empty ) { return true; }
|
||||
|
||||
// Check all CB
|
||||
if ( i < 8 ) // check relays (i from 8 to 15 are toggle relays parameters)
|
||||
{
|
||||
if ( KNX_CB_Search(i+1) != KNX_Empty ) { return true; }
|
||||
if ( KNX_CB_Search(i+9) != KNX_Empty ) { return true; }
|
||||
}
|
||||
if ( i > 15 ) // check sensors and others
|
||||
// check sensors and others
|
||||
if ( i > 15 )
|
||||
{
|
||||
if ( KNX_CB_Search(i+1) != KNX_Empty ) { return true; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check for invalid or erroneous configuration (tasmota flashed without clearing the memory)
|
||||
for (byte i = 0; i < Settings.knx_GA_registered; ++i)
|
||||
{
|
||||
if ( Settings.knx_GA_param[i] != 0 ) // the GA[i] have a parameter defined?
|
||||
{
|
||||
if ( Settings.knx_GA_addr[i] == 0 ) // the GA[i] with parameter have the 0/0/0 as address?
|
||||
{
|
||||
return true; // So, it is invalid. Reset KNX configuration
|
||||
}
|
||||
}
|
||||
}
|
||||
for (byte i = 0; i < Settings.knx_CB_registered; ++i)
|
||||
{
|
||||
if ( Settings.knx_CB_param[i] != 0 ) // the CB[i] have a parameter defined?
|
||||
{
|
||||
if ( Settings.knx_CB_addr[i] == 0 ) // the CB[i] with parameter have the 0/0/0 as address?
|
||||
{
|
||||
return true; // So, it is invalid. Reset KNX configuration
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue