Skip to content
This repository has been archived by the owner on Sep 21, 2020. It is now read-only.

Commit

Permalink
Adds field IP to round robin list (#187)
Browse files Browse the repository at this point in the history
With how many more coprocessors are being added, this is probably needed
to make the field crew sane.
  • Loading branch information
ThadHouse authored and PeterJohnson committed Feb 9, 2017
1 parent 13457d1 commit e665632
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,12 @@ public synchronized static void setClientMode() {
* @param team the team number
*/
public synchronized static void setTeam(int team) {
String[] addresses = new String[4];
String[] addresses = new String[5];
addresses[0] = "10." + (int)(team / 100) + "." + (int)(team % 100) + ".2";
addresses[1] = "172.22.11.2";
addresses[2] = "roboRIO-" + team + "-FRC.local";
addresses[3] = "roboRIO-" + team + "-FRC.lan";
addresses[4] = "roboRIO-" + team + "-FRC.frc-field.local";
setIPAddress(addresses);
}

Expand Down
10 changes: 9 additions & 1 deletion src/networktables/NetworkTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ void NetworkTable::SetClientMode() { s_client = true; }
void NetworkTable::SetServerMode() { s_client = false; }

void NetworkTable::SetTeam(int team) {
std::pair<StringRef, unsigned int> servers[4];
std::pair<StringRef, unsigned int> servers[5];

// 10.te.am.2
llvm::SmallString<32> fixed;
Expand Down Expand Up @@ -73,6 +73,14 @@ void NetworkTable::SetTeam(int team) {
servers[3] = std::make_pair(oss.str(), s_port);
}

// roboRIO-<team>-FRC.frc-field.local
llvm::SmallString<64> field_local;
{
llvm::raw_svector_ostream oss{field_local};
oss << "roboRIO-" << team << "-FRC.frc-field.local";
servers[4] = std::make_pair(oss.str(), s_port);
}

nt::SetServer(servers);
}

Expand Down

0 comments on commit e665632

Please sign in to comment.