Skip to content

Commit

Permalink
fix third anchor loosing connection
Browse files Browse the repository at this point in the history
This bug is reported in several issues (thotro#116, thotro#179). Some solutions have
been implemented like here:
ybc82@22d215e
This pull request have been succesfully tested with 3 anchors and 1 tag.
  • Loading branch information
gautierhattenberger committed Jul 9, 2017
1 parent 5df0971 commit fb1bcc6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/DW1000Ranging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ DW1000Device DW1000RangingClass::_networkDevices[MAX_DEVICES];
byte DW1000RangingClass::_currentAddress[8];
byte DW1000RangingClass::_currentShortAddress[2];
byte DW1000RangingClass::_lastSentToShortAddress[2];
uint8_t DW1000RangingClass::_networkDevicesNumber = 0; // TODO short, 8bit?
volatile uint8_t DW1000RangingClass::_networkDevicesNumber = 0; // TODO short, 8bit?
int16_t DW1000RangingClass::_lastDistantDevice = 0; // TODO short, 8bit?
DW1000Mac DW1000RangingClass::_globalMac;

Expand Down Expand Up @@ -476,7 +476,7 @@ void DW1000RangingClass::loop() {
DW1000Device* myDistantDevice = searchDistantDevice(address);


if(myDistantDevice == NULL) {
if((_networkDevicesNumber != 0) && (myDistantDevice == NULL)) {
Serial.println("Not found");
//we don't have the short address of the device in memory
/*
Expand Down
2 changes: 1 addition & 1 deletion src/DW1000Ranging.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ class DW1000RangingClass {
private:
//other devices in the network
static DW1000Device _networkDevices[MAX_DEVICES];
static uint8_t _networkDevicesNumber;
static volatile uint8_t _networkDevicesNumber;
static int16_t _lastDistantDevice;
static byte _currentAddress[8];
static byte _currentShortAddress[2];
Expand Down

0 comments on commit fb1bcc6

Please sign in to comment.