Tobi's ubw test branch

Dependencies:   mavlink_bridge mbed

Fork of AIT_UWB_Range by Benjamin Hepp

Revision:
56:2eba104e663f
Parent:
55:0587f7ad4bdd
Child:
57:b4e7324b0faf
--- a/main.cpp	Mon Jan 04 18:09:05 2016 +0000
+++ b/main.cpp	Mon Jan 04 18:27:41 2016 +0000
@@ -111,7 +111,10 @@
 
         // HACK
         InterruptHandler irq_mp(DW_IRQ_PIN);
-        irq_mp.getIRQ().rise(&irq_mp, &InterruptHandler::trigger);  // attach interrupt handler to rising edge of interrupt pin from DW1000
+        if (i == 0)
+        {
+            irq_mp.getIRQ().rise(&irq_mp, &InterruptHandler::trigger);  // attach interrupt handler to rising edge of interrupt pin from DW1000
+        }
 
         dw_array[i] = new DW1000(spi, irq_mp, DW_CS_PINS[i]);   // Device driver instanceSPI pins: (MOSI, MISO, SCLK, CS, IRQ, RESET)
 
@@ -145,18 +148,20 @@
                 pc.printf("This node is a Beacon\r\n");
         }
 
-        uint8_t remote_address = ANCHOR_ADDRESS_OFFSET + 0;
+        /*uint8_t remote_address = ANCHOR_ADDRESS_OFFSET + 0;
         node.requestRanging(remote_address);
         rangeAndDisplayAll(node, mb, timer);
         irq_mp.clear();
-        wait(0.5);
+        wait(0.5);*/
     }
 
     // wait(1);
-// MM2WayRanging& node = *node_array[1];
-//  uint8_t remote_address = ANCHOR_ADDRESS_OFFSET + 0;
-//  node.requestRanging(remote_address);
-// rangeAndDisplayAll(node, mb, timer);
+    MM2WayRanging& node = *node_array[0];
+    uint8_t remote_address = ANCHOR_ADDRESS_OFFSET + 0;
+    node.requestRanging(remote_address);
+    pc.printf("%d - %d> dist = %.4f\r\n", node.address, remote_address, node.distances[remote_address]);
+    //rangeAndDisplayAll(node, mb, timer);
+
     if (!MAVLINK_COMM)
         pc.printf("Entering main loop\r\n");