Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of GA-Test_copy by
Revision 2:5adf0b785944, committed 2018-01-10
- Comitter:
- bberabi
- Date:
- Wed Jan 10 16:14:49 2018 +0000
- Parent:
- 1:346279def7ac
- Commit message:
- milc
Changed in this revision
--- a/main_minimal.cpp Sat Dec 09 16:02:58 2017 +0000 +++ b/main_minimal.cpp Wed Jan 10 16:14:49 2018 +0000 @@ -128,7 +128,7 @@ // EXECUTE THIS IF A BASE STATION pc.readcommand(executeOrder); - wait_ms(80); + wait_ms(10); wdt.kick(); } @@ -145,6 +145,7 @@ void executeOrder(char* command){ + int repetitions = command[3]*100 + command[4]*10 + command[5] - 5328; //uint8_t dest1 = command[7] - 48; uint8_t dest2 = command[8] - 48; @@ -168,7 +169,7 @@ } if (strncmp(command, "reset", 5) == 0){ // This command is implemented in order to be able to reset BaseStation from Matlab. - wdt.kick(2); // Set up WatchDog + wdt.kick(); // Set up WatchDog pc.printf("Base Station is RESETTED \r\n\r\n"); }
--- a/nodes/nodes.cpp Sat Dec 09 16:02:58 2017 +0000 +++ b/nodes/nodes.cpp Wed Jan 10 16:14:49 2018 +0000 @@ -87,10 +87,11 @@ acknowledgement[1] = true; - //dw.turnonrx(); // start listening again + // dw.turnonrx(); // start listening again break; } - default : break; + default : dw.turnonrx(); + break; } } else{ @@ -131,8 +132,7 @@ */ void BeaconNode::requestRanging(uint8_t destination) { if(noRec[destination] <= MAX_TRIES){ - - + pc.printf(" max try %d\n\r",MAX_TRIES); float time_before = LocalTimer.read(); while(!acknowledgement[2] && LocalTimer.read() < time_before + 0.001f); // Wait until previous StreamFrame is sent @@ -152,10 +152,15 @@ // Stream Data to Basestation sendStreamFrame(destination); } else { + acknowledgement[1]=1; distances[destination] = -10; - noRec[destination]++; + noRec[destination] = 0; + sendStreamFrame(destination); + + } } + pc.printf("no rec dest %d\n\r",noRec[destination]); } #pragma Otime // Compiler optimize Runtime at the cost of image size @@ -459,6 +464,8 @@ ack = true; break; + + } @@ -478,18 +485,18 @@ void BaseStationNode::sendOrder(uint8_t beacon_destination, uint8_t anchor_destination, uint8_t action, uint16_t repetitions, uint8_t type) { ExtendedRangingFrame orderFrame; ack = false; - + orderFrame.source = address; orderFrame.destination = beacon_destination; orderFrame.type = type; orderFrame.signedTime = action << 24 | anchor_destination << 16 | repetitions; int i = 0; - //for(i = 0; i < 10 && !ack; i++){ + for(i = 0; i < 3 && !ack; i++){ float time_before = LocalTimer.read(); dw.sendFrame((uint8_t*)&orderFrame, sizeof(orderFrame), 0, 0); while(!ack && (LocalTimer.read() < time_before + 0.010 + 0.01*i)); // One Ranging normaly takes less than 1.5 miliseconds - //} + } if(!ack) { pc.printf("ERROR: Tag #%d did not respond \r\n", beacon_destination);
--- a/nodes/nodes.h Sat Dec 09 16:02:58 2017 +0000 +++ b/nodes/nodes.h Wed Jan 10 16:14:49 2018 +0000 @@ -14,10 +14,10 @@ #define TIMEUNITS_TO_US (1/(128*499.2)) // conversion between the decawave timeunits (ca 15.65ps) to microseconds. #define US_TO_TIMEUNITS (128*499.2) // conversion between microseconds to the decawave timeunits (ca 15.65ps). #define MMRANGING_2POWER40 1099511627776 // decimal value of 2^40 to correct timeroverflow between timestamps -#define ADRESSES_COUNT 10 // Defines the Adress Space that is covered when Ranging for all +#define ADRESSES_COUNT 128 // Defines the Adress Space that is covered when Ranging for all //static int ADRESSES_COUNT=1; // Adress Space: 0 - (ADRESSES_COUNT - 1) -#define MAX_TRIES 5 // Number of times a Anchor is pinged until determined it is not in range +#define MAX_TRIES 0 // Number of times a Anchor is pinged until determined it is not in range #define BASE_STATION_ADDR 15 // Defines the Adress of the Base Station (reserved Adress) // Constants for Base_Orders