- Added anchor and tag implementations for MaUWB modules - Configured for 6.8Mbps communication with range filtering - Support for multiple tags (tag/tag2 environments) - OLED display integration for real-time measurements - Simplified code without sleep mode and OTA functionality - Complete UWBHelper library for AT command interface
60 lines
No EOL
1.3 KiB
C++
60 lines
No EOL
1.3 KiB
C++
#ifndef UWBHELPER_H
|
|
#define UWBHELPER_H
|
|
|
|
#include <Arduino.h>
|
|
#include <HardwareSerial.h>
|
|
|
|
struct DeviceData {
|
|
int deviceId;
|
|
float distance;
|
|
float rssi;
|
|
unsigned long lastUpdate;
|
|
bool active;
|
|
};
|
|
|
|
class UWBHelper {
|
|
private:
|
|
HardwareSerial* uwbSerial;
|
|
int resetPin;
|
|
|
|
public:
|
|
UWBHelper(HardwareSerial* serial, int reset);
|
|
|
|
// Initialization
|
|
bool begin();
|
|
void reset();
|
|
|
|
// Configuration
|
|
bool configureDevice(int deviceId, bool isAnchor, int dataRate = 1, int rangeFilter = 1);
|
|
bool setCapacity(int tagCount, int timeSlot = 10, int extMode = 1);
|
|
bool setNetwork(int networkId);
|
|
bool enableReporting(bool enable);
|
|
bool saveConfiguration();
|
|
bool restartDevice();
|
|
|
|
// Communication
|
|
String sendCommand(String command, int timeout = 2000);
|
|
bool parseRangeData(String data, DeviceData devices[], int maxDevices);
|
|
|
|
// Utility
|
|
String getVersion();
|
|
bool isResponseOK(String response);
|
|
void printDiagnostics();
|
|
};
|
|
|
|
// Data filtering class
|
|
class DistanceFilter {
|
|
private:
|
|
static const int FILTER_SIZE = 5;
|
|
float readings[FILTER_SIZE];
|
|
int index;
|
|
bool filled;
|
|
|
|
public:
|
|
DistanceFilter();
|
|
float addReading(float distance);
|
|
float getFilteredValue();
|
|
void reset();
|
|
};
|
|
|
|
#endif // UWBHELPER_H
|