wip
This commit is contained in:
parent
d021d7c29d
commit
4dbb575a15
@ -19,7 +19,7 @@ class ClientCallbacks : public BLEClientCallbacks {
|
||||
static ClientCallbacks clientCB;
|
||||
|
||||
BleFingerprint::BleFingerprint(BLEAdvertisedDevice *advertisedDevice, float fcmin, float beta, float dcutoff) : filteredDistance{FilteredDistance(fcmin, beta, dcutoff)} {
|
||||
firstSeenMillis = millis();
|
||||
firstSeenMillis = esphome::millis();
|
||||
address = NimBLEAddress(advertisedDevice->getAddress());
|
||||
addressType = advertisedDevice->getAddressType();
|
||||
rssi = advertisedDevice->getRSSI();
|
||||
@ -70,10 +70,10 @@ bool BleFingerprint::setId(const std::string &newId, short newIdType, const std:
|
||||
qryAttempts = 0;
|
||||
if (rssi < -80) {
|
||||
qryDelayMillis = 30000;
|
||||
lastQryMillis = millis();
|
||||
lastQryMillis = esphome::millis();
|
||||
} else if (rssi < -70) {
|
||||
qryDelayMillis = 5000;
|
||||
lastQryMillis = millis();
|
||||
lastQryMillis = esphome::millis();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -411,7 +411,7 @@ void BleFingerprint::fingerprintManufactureData(NimBLEAdvertisedDevice *advertis
|
||||
}
|
||||
|
||||
bool BleFingerprint::seen(BLEAdvertisedDevice *advertisedDevice) {
|
||||
lastSeenMillis = millis();
|
||||
lastSeenMillis = esphome::millis();
|
||||
reported = false;
|
||||
|
||||
seenCount++;
|
||||
@ -465,7 +465,7 @@ bool BleFingerprint::report(JsonObject *doc) {
|
||||
if (maxDistance > 0 && dist > maxDistance)
|
||||
return false;
|
||||
|
||||
auto now = millis();
|
||||
auto now = esphome::millis();
|
||||
if ((abs(dist - lastReported) < BleFingerprintCollection::skipDistance) && (lastReportedMillis > 0) && (now - lastReportedMillis < BleFingerprintCollection::skipMs))
|
||||
return false;
|
||||
|
||||
@ -483,7 +483,7 @@ bool BleFingerprint::query() {
|
||||
if (!allowQuery || isQuerying) return false;
|
||||
if (rssi < -90) return false; // Too far away
|
||||
|
||||
auto now = millis();
|
||||
auto now = esphome::millis();
|
||||
if (now - lastSeenMillis > 5) return false; // Haven't seen lately
|
||||
if (now - lastQryMillis < qryDelayMillis) return false; // Too soon
|
||||
|
||||
|
@ -20,8 +20,6 @@
|
||||
#include "esphome/core/time.h"
|
||||
|
||||
#define TAG "esp32_presense"
|
||||
#define millis esphome::millis
|
||||
// #define delay esphome::delay
|
||||
|
||||
#define NO_RSSI int8_t(-128)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user