Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug fixes #57

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion 0D/Beacon/nanoTron_Beacon_v0/beacon_settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ By: Matthew Shryock, Jacob Karl
#define ANALOGAUX5 A12

struct Tag {
String ID; //the unique ID of this tag
String ID; //the unique ID of this tag (12 bytes long)
float distance = -1; //the distance of the tag from the boundary when we ranged it last in cmd. Initialized to -1 to prevent us from warning a tag that just entered the network.
int cooldown_timestamp = 0; //the next time we know the tag will be awake. In mS ahead of current time (also in mS). i.e. if current time is 5000mS and we know that the tag will be awake in 2000mS this variable will be 7000mS.
int encryption_key[32]; //this tags unique encryption_key. One of the 32 encryption keys from the encryption_key_table.
Expand Down
37 changes: 28 additions & 9 deletions 0D/Beacon/nanoTron_Beacon_v0/nanoTron_Beacon_v0.ino
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,24 @@ void setup() {
Serial2.println("EDNI 1");
//1.0 Initialize Transmission Recieved interupt
attachInterrupt(digitalPinToInterrupt(LED1), txRecieve, RISING);

//Create tag objects
Tag tag1;
tag1.ID = "100000000001";
walshRow(1, 32, tag1);
all_tags[0] = tag1;

Tag tag2;
tag2.ID = "100000000002";
walshRow(2, 32, tag2);
all_tags[1] = tag2;

Tag tag3;
tag3.ID = "100000000003";
walshRow(3, 32, tag3);
all_tags[2] = tag3;


}

void loop() {
Expand Down Expand Up @@ -125,16 +143,16 @@ void loop() {
}*/
dataLog = ""; // clear dataLog
//0.10 broadcast [Message] & 0.11 clear [Message]
Serial.print("Broadcasting: ");
//Serial.print("Broadcasting: ");
Serial2.print("BDAT 0 40 ");
Serial.print("BDAT 0 40 ");
//Serial.print("BDAT 0 40 ");
for (int i = 0; i < 128; i++) {
Serial2.print(message[i]);
Serial.print(message[i]);
//Serial.print(message[i]);
message[i] = 0;
}
Serial2.println();
Serial.println();
//Serial.println();

/*if (Serial2.available())
{
Expand Down Expand Up @@ -176,8 +194,9 @@ void loop() {
}
Serial.println(reading);
//1.2 if transmission is a ranging result
if (reading.substring(0, 3) == "*RRN") {
if (reading.substring(0, 4) == "*RRN") {
//1.2.1 update [tag.distance] for relavant [tag] and go to 1.4
Serial.println(reading.substring(5,16));
all_tags[getTag(reading.substring(5, 16))].distance = reading.substring(33, 38).toInt();
}
//1.3 if transmission is a new tag message
Expand All @@ -194,9 +213,9 @@ void loop() {
Serial2.print(newID);
Serial2.print(" 01 ");
if (number_of_tags < 10) {
Serial.println("0" + number_of_tags);
Serial2.println("0" + number_of_tags);
} else {
Serial.println(number_of_tags);
Serial2.println(number_of_tags);
}
}
//1.4 set [tag.communication attempts] to 0
Expand All @@ -205,8 +224,8 @@ void loop() {
//-------------------------------------------------------------------

//0.12 Sleep until atleast one [tag] will have [tag.cooldown timestamp] <=0
Serial.print("Sleep Duration: ");
Serial.println(min_cool);
//Serial.print("Sleep Duration: ");
//Serial.println(min_cool);
Sleep(min_cool);
}

Expand Down