Tobi's ubw test branch
Dependencies: mavlink_bridge mbed
Fork of AIT_UWB_Range by
Diff: MM2WayRanging/MM2WayRanging.cpp
- Revision:
- 50:50b8aea54a51
- Parent:
- 48:5999e510f154
- Child:
- 51:e9391d04af00
diff -r 73cd2b37f5b3 -r 50b8aea54a51 MM2WayRanging/MM2WayRanging.cpp --- a/MM2WayRanging/MM2WayRanging.cpp Tue Nov 24 16:43:13 2015 +0000 +++ b/MM2WayRanging/MM2WayRanging.cpp Thu Nov 26 21:42:51 2015 +0000 @@ -140,6 +140,7 @@ void MM2WayRanging::requestRanging(uint8_t remote_address) { // pc.printf("Request range %d\r\n", remote_address); dw.enable_irq(); + dw.startRX(); // pc.printf("Enabled IRQ %d\r\n", remote_address); acknowledgement[remote_address] = false; float time_before = LocalTimer.read(); @@ -148,7 +149,7 @@ sendPingFrame(remote_address); // pc.printf("Waiting for ack\r\n"); - while(!acknowledgement[remote_address] && (LocalTimer.read() < time_before + 0.5f)); // wait for succeeding ranging or timeout + while(!acknowledgement[remote_address] && (LocalTimer.read() < time_before + 0.3f)); // wait for succeeding ranging or timeout roundtriptimes[remote_address] = LocalTimer.read() - time_before; @@ -157,6 +158,7 @@ } else { distances[remote_address] = -1; } + dw.stopTRX(); dw.disable_irq(); }