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-Berkay_Alex by
Diff: nodes/nodes.cpp
- Revision:
- 2:5adf0b785944
- Parent:
- 1:346279def7ac
- Child:
- 3:8bee1711d186
--- 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);
