Skip to content

Commit

Permalink
Fixed transmission of negative location values
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasteisberg committed Dec 13, 2016
1 parent 40b1e8e commit d9fada6
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
10 changes: 4 additions & 6 deletions libraries/arduino-dw1000-master/src/DW1000Ranging.cpp
Expand Up @@ -57,8 +57,8 @@ long DW1000RangingClass::timer = 0;
short DW1000RangingClass::counterForBlink = 0;
int32_t DW1000RangingClass::timer2 = 0;
long DW1000RangingClass::locTimeout = 0;
uint16_t DW1000RangingClass::locX = 65535;
uint16_t DW1000RangingClass::locY = 65535;
int16_t DW1000RangingClass::locX = 65535;
int16_t DW1000RangingClass::locY = 65535;
// data buffer
byte DW1000RangingClass::data[LEN_DATA];
// reset line to the chip
Expand Down Expand Up @@ -477,10 +477,10 @@ void DW1000RangingClass::loop() {
// Serial.println("Hi");
output = ~output;
digitalWrite(5,output);
uint16_t x = 0;
int16_t x = 0;
x = data[12]<<8;
x += data[13];
uint16_t y = 0;
int16_t y = 0;
y = data[14]<<8;
y += data[15];
// Serial.print(x);
Expand Down Expand Up @@ -820,8 +820,6 @@ void DW1000RangingClass::transmitLoc() {
byte bytes[4];
// float2Bytes(loc,&bytes[1]);
// memcpy(data[12],bytes,4);
uint16_t x = 50000;
uint16_t y = 50010;
// memcpy(data+12,test,2);
data[12] = locX >> 8;
data[13] = locX & 0b11111111;
Expand Down
4 changes: 2 additions & 2 deletions libraries/arduino-dw1000-master/src/DW1000Ranging.h
Expand Up @@ -123,8 +123,8 @@ class DW1000RangingClass {
static short counterForBlink;
static int32_t timer2;
static long locTimeout;
static uint16_t locX;
static uint16_t locY;
static int16_t locX;
static int16_t locY;
//Handlers:
static void (* _handleNewRange)(void);

Expand Down
2 changes: 2 additions & 0 deletions tag/tag.ino
Expand Up @@ -240,5 +240,7 @@ void newRange() {
digitalWrite(6,HIGH);
}
else digitalWrite(6,LOW);

DW1000Ranging.setLoc(estimate[0], estimate[1]);
}

0 comments on commit d9fada6

Please sign in to comment.