Make one euro adjustable via settings
This commit is contained in:
parent
5f839c66a1
commit
d93b5d5eb1
|
@ -43,7 +43,7 @@ BleFingerprint::~BleFingerprint()
|
||||||
Serial.printf("%d Del | MAC: %s, ID: %s\n", xPortGetCoreID(), SMacf(address).c_str(), id.c_str());
|
Serial.printf("%d Del | MAC: %s, ID: %s\n", xPortGetCoreID(), SMacf(address).c_str(), id.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
BleFingerprint::BleFingerprint(BLEAdvertisedDevice *advertisedDevice)
|
BleFingerprint::BleFingerprint(BLEAdvertisedDevice *advertisedDevice, float fcmin, float beta, float dcutoff) : oneEuro{one_euro_filter<double, unsigned long>(1, fcmin, beta, dcutoff)}
|
||||||
{
|
{
|
||||||
firstSeenMicros = esp_timer_get_time();
|
firstSeenMicros = esp_timer_get_time();
|
||||||
address = advertisedDevice->getAddress();
|
address = advertisedDevice->getAddress();
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
#ifndef _BLEFINGERPRINT_
|
#ifndef _BLEFINGERPRINT_
|
||||||
#define _BLEFINGERPRINT_
|
#define _BLEFINGERPRINT_
|
||||||
|
|
||||||
#include <NimBLEDevice.h>
|
|
||||||
#include <NimBLEAdvertisedDevice.h>
|
|
||||||
#include <NimBLEEddystoneURL.h>
|
|
||||||
#include <NimBLEEddystoneTLM.h>
|
|
||||||
#include <NimBLEBeacon.h>
|
|
||||||
#include <ArduinoJson.h>
|
#include <ArduinoJson.h>
|
||||||
|
#include <NimBLEAdvertisedDevice.h>
|
||||||
|
#include <NimBLEBeacon.h>
|
||||||
|
#include <NimBLEDevice.h>
|
||||||
|
#include <NimBLEEddystoneTLM.h>
|
||||||
|
#include <NimBLEEddystoneURL.h>
|
||||||
#include <SoftFilters.h>
|
#include <SoftFilters.h>
|
||||||
|
|
||||||
class BleFingerprint
|
class BleFingerprint
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
BleFingerprint(BLEAdvertisedDevice *advertisedDevice);
|
BleFingerprint(BLEAdvertisedDevice *advertisedDevice, float fcmin, float beta, float dcutoff);
|
||||||
~BleFingerprint();
|
~BleFingerprint();
|
||||||
|
|
||||||
void seen(BLEAdvertisedDevice *advertisedDevice);
|
void seen(BLEAdvertisedDevice *advertisedDevice);
|
||||||
|
@ -38,7 +38,7 @@ private:
|
||||||
Reading<Differential<float>> output;
|
Reading<Differential<float>> output;
|
||||||
|
|
||||||
TimestampFilter<float> tsFilter;
|
TimestampFilter<float> tsFilter;
|
||||||
one_euro_filter<double, unsigned long> oneEuro{one_euro_filter<double, unsigned long>(1, 0.01, 0.01, 1)};
|
one_euro_filter<double, unsigned long> oneEuro;
|
||||||
DifferentialFilter<float> diffFilter;
|
DifferentialFilter<float> diffFilter;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -83,3 +83,9 @@
|
||||||
|
|
||||||
// Number of seconds between update checks
|
// Number of seconds between update checks
|
||||||
#define CHECK_FOR_UPDATES_INTERVAL 300
|
#define CHECK_FOR_UPDATES_INTERVAL 300
|
||||||
|
|
||||||
|
#define ONE_EURO_FCMIN 0.05
|
||||||
|
|
||||||
|
#define ONE_EURO_BETA 0.05
|
||||||
|
|
||||||
|
#define ONE_EURO_DCUTOFF 1
|
||||||
|
|
|
@ -10,7 +10,7 @@ BleFingerprint *getFingerprintInternal(BLEAdvertisedDevice *advertisedDevice)
|
||||||
return *it;
|
return *it;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto created = new BleFingerprint(advertisedDevice);
|
auto created = new BleFingerprint(advertisedDevice, ONE_EURO_FCMIN, ONE_EURO_BETA, ONE_EURO_DCUTOFF);
|
||||||
auto it2 = std::find_if(fingerprints.begin(), fingerprints.end(), [created](BleFingerprint *f) { return f->getId() == created->getId(); });
|
auto it2 = std::find_if(fingerprints.begin(), fingerprints.end(), [created](BleFingerprint *f) { return f->getId() == created->getId(); });
|
||||||
if (it2 != fingerprints.end())
|
if (it2 != fingerprints.end())
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue