Skip to content

Commit

Permalink
Bug fixes including choosers that don't appear and livewindow widgets…
Browse files Browse the repository at this point in the history
… that don't appear (wpilibsuite#185)

Fixed conflicts in moving these changes from the old NT3 world to the NT4-based SmartDashboard.
  • Loading branch information
chauser committed Sep 3, 2024
1 parent cabbeb2 commit 9a7aeaf
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/main/java/edu/wpi/first/smartdashboard/SmartDashboard.java
Original file line number Diff line number Diff line change
Expand Up @@ -171,5 +171,39 @@ public void run() {
teamProp.setValue(teamNumber);
monitor.setProgress(1000);
}


if (argParser.hasValue("ip")) {
monitor.setProgress(1000);
monitor.setNote("Connecting to robot at: " + argParser.getValue("ip"));
Robot.setHost(argParser.getValue("ip"));
System.out.println("IP: " + argParser.getValue("ip"));
} else {
NetworkTable.setDSClientEnabled(true);
try {
Thread.sleep(500);
} catch (InterruptedException e) {
// No harm if the sleep is interrupted
}
monitor.setProgress(800);
monitor.setNote("Getting Team Number");
StringProperty teamProp = frame.getPrefs().team;
String teamNumber = teamProp.getValue();

teamNumberLoop:
while (teamNumber.equals("0")) {
String input = JOptionPane.showInputDialog("Input Team Number\\Host");
if (input == null) {
break teamNumberLoop;
}
teamNumber = input;
}

monitor.setProgress(850);
monitor.setNote("Connecting to robot: " + teamNumber);
Robot.setHost(teamNumber);
teamProp.setValue(teamNumber);
monitor.setProgress(1000);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@ private void addSubsystemElement(String key, NetworkTable value) {
System.out.println(
"\nSubsystem \"" + getFieldName() + "\" does not contain widget \"" + key + "\"");
System.out.println("Table: " + value);
<<<<<<< HEAD
System.out.println("Type: " + value.getEntry(".type").getString(null));
=======
System.out.println("Type: " + value.getString(".type", null));
>>>>>>> 72dbfdf (Bug fixes including choosers that don't appear and livewindow widgets that don't appear (#185))
DataType dataType = DataType.getType(value);
if (dataType != null) {
System.out.println(
Expand All @@ -116,7 +120,11 @@ private void addSubsystemElement(String key, NetworkTable value) {
revalidate();
repaint();
} else {
<<<<<<< HEAD
System.out.println("Skipping: No registered dataType for type " + value.getEntry(".type").getString(null));
=======
System.out.println("Skipping: No registered dataType for type " + value.getString(".type", null) );
>>>>>>> 72dbfdf (Bug fixes including choosers that don't appear and livewindow widgets that don't appear (#185))
}
System.out.println();
} catch (InstantiationException | IllegalAccessException ex) {
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/edu/wpi/first/smartdashboard/robot/Robot.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
package edu.wpi.first.smartdashboard.robot;

<<<<<<< HEAD
import java.util.function.Consumer;

import edu.wpi.first.networktables.NetworkTable;
import edu.wpi.first.networktables.NetworkTableEvent;
import edu.wpi.first.networktables.NetworkTableInstance;
=======
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

import edu.wpi.first.wpilibj.networktables.NetworkTable;
import edu.wpi.first.wpilibj.tables.IRemoteConnectionListener;
import edu.wpi.first.wpilibj.tables.ITable;
>>>>>>> 72dbfdf (Bug fixes including choosers that don't appear and livewindow widgets that don't appear (#185))

/**
* @author Joe
Expand All @@ -21,12 +30,19 @@ public class Robot {
private static final NetworkTableInstance ntInstance = NetworkTableInstance.getDefault();

static {
<<<<<<< HEAD
ntInstance.stopDSClient();
ntInstance.startClient4(identity);
}

public static void startDSClient() {
ntInstance.startDSClient();
=======
NetworkTable.setClientMode();
NetworkTable.setNetworkIdentity(identity);
NetworkTable.setDSClientEnabled(false);
NetworkTable.initialize();
>>>>>>> 72dbfdf (Bug fixes including choosers that don't appear and livewindow widgets that don't appear (#185))
}

public static void setTeam(int team) {
Expand Down

0 comments on commit 9a7aeaf

Please sign in to comment.