Tobi's ubw test branch

Dependencies:   mavlink_bridge mbed

Fork of AIT_UWB_Range by Benjamin Hepp

Revision:
39:bb57aa77b015
Parent:
38:8ef3b8d8b908
Child:
40:5ce51b7e3118
--- a/main.cpp	Sun Feb 22 11:41:18 2015 +0000
+++ b/main.cpp	Sun Feb 22 17:40:38 2015 +0000
@@ -23,7 +23,7 @@
     dw.writeRegister16(DW1000_TX_ANTD, 0, setdelay);
     pc.printf("Antenna Delay TX: %d\r\n", dw.readRegister16(DW1000_TX_ANTD, 0));
     pc.printf("Antenna Delay RX: %d\r\n", dw.readRegister16(DW1000_LDE_CTRL, 0x1804));
-    r.receiver = true;
+    //r.receiver = true;
     if (r.receiver)
         r.address = 2;
     else
@@ -37,11 +37,14 @@
             wait(0.005);
             r.requestRanging(2);
             wait(0.005);
+            pc.printf("%lld\r\n", r.tofs[2]); // logging output
+        } else {
+            pc.printf("%lld\r\n", r.rangingtimingsReceiver[0][1] - r.rangingtimingsReceiver[0][0]);
         }
         
-        //pc.printf("%lld\r\n", r.tofs[2]); // logging output
+        
         
-        #if 1 // Output bars on console
+        #if 0 // Output bars on console
             for(int i = 1; i < 3; i++) {
                 //pc.printf("%f ", r.tofs[j]*MMRANGING_TIMEUNIT_NS);
                 pc.printf("%lld [", r.tofs[i]);
@@ -53,7 +56,7 @@
             }
         #endif
         
-        #if 1   // Output events for debugging
+        #if 0   // Output events for debugging
             for(int j = 0; j < 10; j++)
                 if(r.event[j][0] == '!') {
                     pc.printf("%s\r\n", r.event[j]);
@@ -61,10 +64,10 @@
                 }
             r.event_i = 0;
         #endif
-        pc.printf("Status: %llX\r\n", dw.getStatus());
-        pc.printf("TX Control: %llX\r\n", dw.readRegister40(DW1000_TX_FCTRL, 0));
+        //pc.printf("Status: %llX\r\n", dw.getStatus());
+        //pc.printf("TX Control: %llX\r\n", dw.readRegister40(DW1000_TX_FCTRL, 0));
         //pc.printf("\r\n");
-        //wait(0.05);
-        wait(0.2);
+        wait(0.02);
+        //wait(0.1);
     }
 }
\ No newline at end of file