[BT] - Adaptive scan (#1440)

* [BT] Adaptive scan

Add adaptive scan to avoid users setting parameters and deduct automatically the scan requirements from the list of devices

---------
Co-authored-by: DigiH <github@digih.net>
This commit is contained in:
FlorianandDigiH authored and GitHub committed 2023-02-07 17:36:18 -06:00
1 parent 05f83c5f80
commit f283327998
7 files changed
+51 -44

No files matched your search

+6 -3
View File
@@ -74,12 +74,15 @@ extern int btQueueLengthCount;
#ifndef BLEScanWindow
# define BLEScanWindow 30 // How long to scan during the interval; in milliseconds.
#endif
#ifndef ActiveBLEScan
# define ActiveBLEScan true // Set active scanning, this will get more data from the advertiser.
#ifndef AdaptiveBLEScan
# define AdaptiveBLEScan true // Sets adaptive scanning, this will automatically decide on the best passive and active scanning intervals
#endif
#ifndef TimeBtwActive
# define TimeBtwActive 55555 //define default time between two BLE active scans when general passive scanning is selected; in milliseconds
#endif
#ifndef MinTimeBtwScan
# define MinTimeBtwScan 100 //define the time between two scans; in milliseconds
#endif
#ifndef TimeBtwConnect
# define TimeBtwConnect 3600000 //define default time between BLE connection attempt (not used for immediate actions); in milliseconds
#endif
@@ -133,7 +136,7 @@ unsigned long scanCount = 0;
/*----------------CONFIGURABLE PARAMETERS-----------------*/
struct BTConfig_s {
bool bleConnect; // Attempt a BLE connection to sensors with ESP32
bool activeScan;
bool adaptiveScan;
unsigned long intervalActiveScan; // Time between 2 active scans when generally passive scanning
unsigned long BLEinterval; // Time between 2 scans
unsigned long intervalConnect; // Time between 2 connects