Tobi's ubw test branch
Dependencies: mavlink_bridge mbed
Fork of AIT_UWB_Range by
Diff: main.cpp
- Revision:
- 35:95d838d33bf5
- Parent:
- 34:f56962030c5c
- Child:
- 36:883de6f9a73b
diff -r f56962030c5c -r 95d838d33bf5 main.cpp --- a/main.cpp Sat Dec 27 14:37:12 2014 +0000 +++ b/main.cpp Tue Feb 17 10:58:58 2015 +0000 @@ -18,30 +18,32 @@ pc.printf("Voltage: %f\r\n", dw.getVoltage()); pc.printf("Size of Frame: %d\r\n", sizeof(r.TX)); - uint16_t setdelay = 65500; + uint16_t setdelay = 32768; 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; - bool senderstart = true; while(1) { - for(int j = 0; j < 10; j++) - pc.printf("%d ", (unsigned int)r.tofs[j]); - pc.printf("\r\n"); - for(int j = 0; j < 10; j++) + for(int j = 0; j < 1; j++) + //pc.printf("%f ", r.tofs[j]*MMRANGING_TIMEUNIT_NS); + pc.printf("%lld [", r.tofs); + int dots = r.tofs*70/1400; + if (abs(dots) < 100000) + for(int j = 0; j < dots; j++) + pc.printf("="); + pc.printf("]\r\n"); + /*for(int j = 0; j < 10; j++) if(r.event[j][0] == '!') { pc.printf("%s Time: %lldus\r\n", r.event[j], r.eventtimes[j]); r.event[j][0] = 'X'; - } + } */ if (!r.receiver) { - if(senderstart) - r.requestRanging(); - else - r.requestTime(); - senderstart = !senderstart; + r.requestRanging(); + wait(0.05); + r.requestTime(); } - pc.printf("Status: %llX\r\n", dw.getStatus()); - wait(2); + //pc.printf("Status: %llX\r\n", dw.getStatus()); + wait(0.01); } } \ No newline at end of file