Initial commit: ESP32-S3 UWB positioning system
- 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
This commit is contained in:
commit
a89215b7ff
10 changed files with 806 additions and 0 deletions
60
lib/UWBHelper/UWBHelper.h
Normal file
60
lib/UWBHelper/UWBHelper.h
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
#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
|
||||
Loading…
Add table
Add a link
Reference in a new issue