Skip to content

Commit

Permalink
Adds NT entry for currently selected auton
Browse files Browse the repository at this point in the history
  • Loading branch information
6kn4eakfr4s committed Apr 18, 2024
1 parent f538ede commit ee26c99
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/main/java/frc/robot/RobotContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ public class RobotContainer {
private NetworkTableInstance ntInstance;
private NetworkTable autonTable;
private NetworkTableEntry listEntry;
private String autonValue = "A145";
private NetworkTableEntry selectedAutonEntry;
private String autonValue = "A123";
private int autonHandle;
private String autoName = "A145";
/**
Expand All @@ -177,10 +178,13 @@ public RobotContainer() {
ntInstance = NetworkTableInstance.getDefault();
autonTable = ntInstance.getTable("Auton");
listEntry = autonTable.getEntry("AutonList");
selectedAutonEntry = autonTable.getEntry("Selected");
// System.out.print("Available Autons: " + AutoBuilder.getAllAutoNames().toArray(new String[0]));
listEntry.setStringArray(AutoBuilder.getAllAutoNames().toArray(new String[0]));
selectedAutonEntry.setString(autonValue);
autonTable.addListener("Auton", EnumSet.of(NetworkTableEvent.Kind.kValueAll), (table, key, event) -> {
this.autonValue = event.valueData.value.getString();
this.selectedAutonEntry.setString(this.autonValue);
System.out.print("New auton value: " + this.autonValue);
});
fmsSubsystem = new FieldManagementSubsystem();
Expand Down

0 comments on commit ee26c99

Please sign in to comment.