[BT] Continuous active scanning when adaptive scanning is false (#1448)

Set `interval` and `intervalacts` to the minimum when adaptive scanning is deactivated. When the user encounters a situation on which a device is not detected due to adaptive scanning, we set the gateway to continuous active to maximize the chance to detect the device.
This commit is contained in:
Florian authored and GitHub committed 2023-02-10 17:05:52 -06:00
1 parent 159d362f2a
commit 7c0fafd48e
2 files changed
+11 -4

No files matched your search

+8 -3
View File
@@ -151,12 +151,17 @@ void stateBTMeasures(bool start) {
void BTConfig_fromJson(JsonObject& BTdata, bool startup = false) {
// Attempts to connect to eligible devices or not
BTConfig_update(BTdata, "bleconnect", BTConfig.bleConnect);
// Identify AdaptiveScan deactivation to pass to continuous mode
if (BTdata.containsKey("adaptivescan") && BTdata["adaptivescan"] == false && BTConfig.adaptiveScan == true) {
BTdata["interval"] = MinTimeBtwScan;
BTdata["intervalacts"] = MinTimeBtwScan;
}
BTConfig_update(BTdata, "adaptivescan", BTConfig.adaptiveScan);
// Time before before active scan
// Scan interval set
if (BTdata.containsKey("interval") && BTdata["interval"] != 0)
BTConfig_update(BTdata, "interval", BTConfig.BLEinterval);
// Define if the scan is active or passive
BTConfig_update(BTdata, "adaptivescan", BTConfig.adaptiveScan);
// Time before before active scan
// Define if the scan is adaptive or not
BTConfig_update(BTdata, "intervalacts", BTConfig.intervalActiveScan);
// Time before a connect set
BTConfig_update(BTdata, "intervalcnct", BTConfig.intervalConnect);