Skip to content

Commit 4252bdd

Browse files
committed
Merge pull request #318 from ThomasJClark/project-settings-fix
Fix some issues with ProjectSettings
2 parents 699f31b + fe71439 commit 4252bdd

File tree

3 files changed

+25
-22
lines changed

3 files changed

+25
-22
lines changed

core/src/main/java/edu/wpi/grip/core/operations/networktables/NTManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public void updateSettings(ProjectSettingsChangedEvent event) {
6060

6161
NetworkTable.shutdown();
6262
if (projectSettings.getNetworkProtocol() == ProjectSettings.NetworkProtocol.NETWORK_TABLES) {
63-
NetworkTable.setIPAddress(projectSettings.computeNetworkProtocolServerAddress());
63+
NetworkTable.setIPAddress(projectSettings.computePublishAddress());
6464
NetworkTable.initialize();
6565
}
6666
}

core/src/main/java/edu/wpi/grip/core/settings/ProjectSettings.java

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@ public enum NetworkProtocol {
2727
@Setting(label = "FRC Team Number", description = "The team number, if used for FRC")
2828
private int teamNumber = 0;
2929

30-
@Setting(label = "NetworkTables Server Address", description = "The host that runs the Network Protocol server. If not " +
31-
"specified and Network Tables is specified as the protocol, the hostname is derived from the team number.")
32-
private String networkProtocolServerAddress = "";
30+
@Setting(label = "NetworkTables Server Address", description = "The host that runs the Network Protocol server. " +
31+
"If not specified and NetworkTables is specified as the protocol, the hostname is derived from the team " +
32+
"number.")
33+
private String publishAddress = "";
3334

34-
@Setting(label = "Deploy Address", description = "The remote host that grip should be remotely deployed to. If not " +
35-
"specified and Network Tables is specified as the protocol, the hostname is derived from the team number.")
35+
@Setting(label = "Deploy Address", description = "The remote host that grip should be remotely deployed to. If " +
36+
"not specified, the hostname is derived from the team number.")
3637
private String deployAddress = "";
3738

3839
public void setNetworkProtocol(NetworkProtocol networkProtocol) {
@@ -52,13 +53,13 @@ public int getTeamNumber() {
5253
return teamNumber;
5354
}
5455

55-
public void setNetworkProtocolServerAddress(String networkProtocolServerAddress) {
56-
this.networkProtocolServerAddress =
57-
checkNotNull(networkProtocolServerAddress, "Network Protocol Server Address cannot be null");
56+
public void setPublishAddress(String publishAddress) {
57+
this.publishAddress =
58+
checkNotNull(publishAddress, "Network Protocol Server Address cannot be null");
5859
}
5960

60-
public String getNetworkProtocolServerAddress() {
61-
return networkProtocolServerAddress;
61+
public String getPublishAddress() {
62+
return publishAddress;
6263
}
6364

6465
public void setDeployAddress(String deployAddress) {
@@ -71,29 +72,31 @@ public String getDeployAddress() {
7172

7273
/**
7374
* @return The address of the machine that the NetworkTables server is running on. If
74-
* {@link #setNetworkProtocolServerAddress} is specified, that is returned, otherwise this is based on the team number.
75+
* {@link #setPublishAddress} is specified, that is returned, otherwise this is based on the team
76+
* number.
7577
*/
76-
public String computeNetworkProtocolServerAddress() {
77-
if (networkProtocolServerAddress.isEmpty()) {
78-
return "roboio-" + teamNumber + "-frc.local";
78+
public String computePublishAddress() {
79+
if (publishAddress == null || publishAddress.isEmpty()) {
80+
return "roborio-" + teamNumber + "-frc.local";
7981
} else {
80-
return networkProtocolServerAddress;
82+
return publishAddress;
8183
}
8284
}
8385

84-
public String computeDeployAddresss() {
85-
if (networkProtocolServerAddress.isEmpty()) {
86-
return "roboio-" + teamNumber + "-frc.local";
86+
public String computeDeployAddress() {
87+
if (deployAddress == null || deployAddress.isEmpty()) {
88+
return "roborio-" + teamNumber + "-frc.local";
8789
} else {
88-
return networkProtocolServerAddress;
90+
return publishAddress;
8991
}
9092
}
9193

9294
@Override
9395
public String toString() {
9496
return MoreObjects.toStringHelper(this)
9597
.add("networkProtocol", networkProtocol)
96-
.add("networkProtocolServerAddress", networkProtocolServerAddress)
98+
.add("publishAddress", publishAddress)
99+
.add("deployAddress", deployAddress)
97100
.add("teamNumber", teamNumber)
98101
.toString();
99102
}

ui/src/main/java/edu/wpi/grip/ui/deployment/FRCAdvancedDeploymentOptionsController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ FRCAdvancedDeploymentOptionsController create(
4040
@Assisted("stdErr") Supplier<OutputStream> stdErr) {
4141
super("FRC Advanced", onDeployCallback);
4242
this.deployedInstanceManagerFactor = deployedInstanceManagerFactor;
43-
this.projectAddress = pipeline.getProjectSettings().computeDeployAddresss();
43+
this.projectAddress = pipeline.getProjectSettings().computeDeployAddress();
4444
this.stdOut = stdOut;
4545
this.stdErr = stdErr;
4646

0 commit comments

Comments
 (0)