[BT Discovery] Deactivate/Activate sliders dynamicaly depending on auto adaptive state (#1502)
To avoid having unnecessaries commands in the interface
This commit is contained in:
1 parent
df228a4aa4
commit
9c73896999
2 files changed
+38
-19
No files matched your search
+10
-1
@@ -137,7 +137,7 @@ void stateBTMeasures(bool start) {
|
||||
void BTConfig_fromJson(JsonObject& BTdata, bool startup = false) {
|
||||
// Attempts to connect to eligible devices or not
|
||||
Config_update(BTdata, "bleconnect", BTConfig.bleConnect);
|
||||
// Identify AdaptiveScan deactivation to pass to continuous mode
|
||||
// Identify AdaptiveScan deactivation to pass to continuous mode or activation to come back to default settings
|
||||
if (startup == false) {
|
||||
if (BTdata.containsKey("adaptivescan") && BTdata["adaptivescan"] == false && BTConfig.adaptiveScan == true) {
|
||||
BTdata["interval"] = MinTimeBtwScan;
|
||||
@@ -145,9 +145,18 @@ void BTConfig_fromJson(JsonObject& BTdata, bool startup = false) {
|
||||
} else if (BTdata.containsKey("adaptivescan") && BTdata["adaptivescan"] == true && BTConfig.adaptiveScan == false) {
|
||||
BTdata["interval"] = TimeBtwRead;
|
||||
BTdata["intervalacts"] = TimeBtwActive;
|
||||
# ifdef ZmqttDiscovery
|
||||
// Remove discovered entities
|
||||
eraseTopic("number", (char*)getUniqueId("interval", "").c_str());
|
||||
eraseTopic("number", (char*)getUniqueId("intervalacts", "").c_str());
|
||||
# endif
|
||||
}
|
||||
}
|
||||
Config_update(BTdata, "adaptivescan", BTConfig.adaptiveScan);
|
||||
# ifdef ZmqttDiscovery
|
||||
// Create discovery entities
|
||||
btScanParametersDiscovery();
|
||||
# endif
|
||||
// Time before before active scan
|
||||
// Scan interval set
|
||||
if (BTdata.containsKey("interval") && BTdata["interval"] != 0)
|
||||
|
||||
Reference in new issue
Block a user