Defined more scanner parameters in settings

This commit is contained in:
demostenes 2019-03-25 22:09:24 +01:00
parent a1e117b33d
commit 14733de81e
2 changed files with 8 additions and 4 deletions

View File

@ -34,7 +34,7 @@ extern "C" {
#include "Settings_a.h"
BLEScan* pBLEScan;
int scanTime = 10; //In seconds
int scanTime = singleScanTime; //In seconds
int waitTime = scanInterval; //In seconds
bool updateInProgress = false;
@ -405,9 +405,9 @@ void setup() {
BLEDevice::init("");
pBLEScan = BLEDevice::getScan(); //create new scan
pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks());
pBLEScan->setActiveScan(true); //active scan uses more power, but get results faster
pBLEScan->setInterval(0x80);
pBLEScan->setWindow(0x10);
pBLEScan->setActiveScan(activeScan);
pBLEScan->setInterval(bleScanInterval);
pBLEScan->setWindow(bleScanWindow);
xTaskCreatePinnedToCore(
scanForDevices,

View File

@ -36,6 +36,10 @@
// Define bluetooth scan parameters
#define scanInterval 2 // Define the interval in seconds between scans
#define singleScanTime 10 // Define the duration of a single scan in seconds
#define activeScan true // Active scan uses more power, but get results faster
#define bleScanInterval 0x80 // (milliseconds) The time interval from when the Controller started its last LE scan until it begins the subsequent LE scan
#define bleScanWindow 0x10 // (milliseconds) The duration of the LE scan, shall be less than or equal to bleScanInterval; if interval and window are equal then perform continuous scan
// Maximum distance (in meters) to report. Devices that are calculated to be further than this distance in meters will not be reported
#define maxDistance 5