![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Tobi's ubw test branch
Dependencies: mavlink_bridge mbed
Fork of AIT_UWB_Range by
Diff: main.cpp
- Revision:
- 47:b6120c152ad1
- Parent:
- 46:6398237672a0
- Child:
- 48:5999e510f154
--- a/main.cpp Tue Mar 10 12:11:13 2015 +0000 +++ b/main.cpp Thu Mar 19 12:54:28 2015 +0000 @@ -37,7 +37,7 @@ node.requestRanging(destination); if(node.overflow){ - myprintf("Overflow! Measured: %f\r\n", node.distances[destination]); + myprintf("Overflow! Measured: %f\r\n", node.distances[destination]); // This is the output to see if a timer overflow was corrected by the two way ranging class } if (node.distances[destination] == -1) { @@ -95,53 +95,44 @@ pc.printf("EUI register: %016llX\r\n", dw.getEUI()); pc.printf("Voltage: %fV\r\n", dw.getVoltage()); - node.isAnchor = true; - // declare as anchor or beacon + node.isAnchor = true; // declare as anchor or beacon + if (node.isAnchor) { - node.address = 5; + node.address = 1; myprintf("This node is Anchor node %d \r\n", node.address); } else { node.address = 0; myprintf("This node is a Beacon. "); } - if (node.address == 5){ - dw.setCallbacks(&altCallbackRX, NULL); - } + if (node.address == 5){ // the node with address 5 was used as an observer node putting out the results in our test case + dw.setCallbacks(&altCallbackRX, NULL); + } while(1) { if (!node.isAnchor){ rangeAndDisplayAll(); //calibrationRanging(4); - - - - - }else - //myprintf(".\r"); - + } else { + //myprintf("."); // to see if the core and output is working wait(0.5); + } } } -void altCallbackRX(){ +void altCallbackRX() { // this callback was used in our verification test case for the observer node which only receives and outputs the resulting data DistancesFrame distFrame; float distances[4]; dw.readRegister(DW1000_RX_BUFFER, 0, (uint8_t*)&distFrame, dw.getFramelength()); - if (distFrame.destination == 5){ + if (distFrame.destination == 5) { for (int i = 0; i<4; i++){ - distances[i] = distFrame.dist[i]; + myprintf("%f, ", distFrame.dist[i]); } - - for (int i = 0; i < 4; i++) { // Output Results - myprintf("%f, ", distances[i]); - - } - + myprintf("\r\n"); } dw.startRX();