From 22da7f1e7f7533c8974d4440c02676e21276a7d8 Mon Sep 17 00:00:00 2001
From: DTTerastar
Date: Mon, 23 Aug 2021 23:59:48 -0400
Subject: [PATCH] Go back to active scanning
---
lib/BleFingerprint/BleFingerprint.cpp | 8 +++-----
src/Settings.h | 2 +-
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/lib/BleFingerprint/BleFingerprint.cpp b/lib/BleFingerprint/BleFingerprint.cpp
index 244bb24..055da3f 100644
--- a/lib/BleFingerprint/BleFingerprint.cpp
+++ b/lib/BleFingerprint/BleFingerprint.cpp
@@ -174,7 +174,7 @@ void BleFingerprint::setInitial(int initalRssi, float initalDistance)
bool BleFingerprint::report(JsonDocument *doc, int maxDistance)
{
- if (id == nullptr && name == nullptr)
+ if (id.isEmpty() && name.isEmpty())
return false;
if (!hasValue)
@@ -210,10 +210,8 @@ bool BleFingerprint::report(JsonDocument *doc, int maxDistance)
close = false;
}
- if (id != nullptr)
- (*doc)[F("id")] = id;
- if (name != nullptr)
- (*doc)[F("name")] = name;
+ if (!id.isEmpty()) (*doc)[F("id")] = id;
+ if (!name.isEmpty()) (*doc)[F("name")] = name;
(*doc)[F("rssi@1m")] = calRssi;
(*doc)[F("rssi")] = rssi;
diff --git a/src/Settings.h b/src/Settings.h
index c0a331e..becde6e 100644
--- a/src/Settings.h
+++ b/src/Settings.h
@@ -61,7 +61,7 @@
#define CHANNEL String("presense")
// Define bluetooth scan parameters
-#define BLE_ACTIVE_SCAN false // Active scan uses more power, but get results faster
+#define BLE_ACTIVE_SCAN true // Active scan uses more power, but get results faster
#define BLE_SCAN_INTERVAL 40 // Used to determine antenna sharing between Bluetooth and WiFi. Do not modify unless you are confident you know what you're doing
#define BLE_SCAN_WINDOW 30 // Used to determine antenna sharing between Bluetooth and WiFi. Do not modify unless you are confident you know what you're doing