![](/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:
- 38:8ef3b8d8b908
- Parent:
- 37:40f94c634c3e
- Child:
- 39:bb57aa77b015
--- a/main.cpp Fri Feb 20 13:21:06 2015 +0000 +++ b/main.cpp Sun Feb 22 11:41:18 2015 +0000 @@ -15,16 +15,17 @@ dw.setEUI(0xFAEDCD01FAEDCD01); // basic methods called to check if we have a working SPI connection pc.printf("DEVICE_ID register: 0x%X\r\n", dw.getDeviceID()); pc.printf("EUI register: %016llX\r\n", dw.getEUI()); - pc.printf("Voltage: %f\r\n", dw.getVoltage()); - pc.printf("Size of Frame: %d\r\n", sizeof(r.TX)); + pc.printf("Voltage: %fV\r\n", dw.getVoltage()); + pc.printf("System Configuration: %llX\r\n", dw.readRegister40(DW1000_SYS_CFG, 0)); + pc.printf("Size of Rangingframe: %d\r\n", sizeof(r.TX)); - uint16_t setdelay = 32768; // TODO: = 2^15 + uint16_t setdelay = 32300;//768; // TODO: = 2^15 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; if (r.receiver) - r.address = 1; + r.address = 2; else r.address = 0; // sender node has address 0 pc.printf("Address: %d\r\n", r.address); @@ -34,17 +35,23 @@ if (!r.receiver) { // Request ranging r.requestRanging(1); // TODO: ask all available nodes! wait(0.005); + r.requestRanging(2); + wait(0.005); } - // Output bar on console - for(int j = 0; j < 1; j++) - //pc.printf("%f ", r.tofs[j]*MMRANGING_TIMEUNIT_NS); - pc.printf("%lld [", r.tofs[1]); - int dots = r.tofs[1]*70/1400; - if (abs(dots) < 100000) - for(int j = 0; j < dots; j++) - pc.printf("="); - pc.printf("]\r\n"); + //pc.printf("%lld\r\n", r.tofs[2]); // logging output + + #if 1 // 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]); + int dots = r.tofs[i]*70/1400; + if (abs(dots) < 10000) + for(int j = 0; j < dots; j++) + pc.printf("="); + pc.printf("]\r\n"); + } + #endif #if 1 // Output events for debugging for(int j = 0; j < 10; j++) @@ -56,8 +63,8 @@ #endif pc.printf("Status: %llX\r\n", dw.getStatus()); pc.printf("TX Control: %llX\r\n", dw.readRegister40(DW1000_TX_FCTRL, 0)); - - wait(0.01); + //pc.printf("\r\n"); + //wait(0.05); wait(0.2); } } \ No newline at end of file