Skip to content
This repository has been archived by the owner on May 19, 2024. It is now read-only.

Commit

Permalink
refactor: Add method to make widgets fullscreen.
Browse files Browse the repository at this point in the history
  • Loading branch information
haydenheroux committed Jan 22, 2024
1 parent 0b76386 commit efe6a0e
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
1 change: 1 addition & 0 deletions simgui.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"types": {
"/FMSInfo": "FMSInfo",
"/Shuffleboard/Auto/Auto Chooser": "String Chooser",
"/Shuffleboard/Auto/SendableChooser[0]": "String Chooser",
"/Shuffleboard/Vision/Field": "Field2d",
"/SmartDashboard/VisionSystemSim-visionSystem/Sim Field": "Field2d"
},
Expand Down
16 changes: 7 additions & 9 deletions src/main/java/frc/lib/Telemetry.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
import edu.wpi.first.networktables.BooleanEntry;
import edu.wpi.first.networktables.DoubleEntry;
import edu.wpi.first.networktables.NetworkTable;
import edu.wpi.first.util.sendable.Sendable;
import edu.wpi.first.wpilibj.shuffleboard.BuiltInLayouts;
import edu.wpi.first.wpilibj.shuffleboard.ComplexWidget;
import edu.wpi.first.wpilibj.shuffleboard.Shuffleboard;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardComponent;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardLayout;
import edu.wpi.first.wpilibj.shuffleboard.ShuffleboardTab;
import edu.wpi.first.wpilibj.shuffleboard.SuppliedValueWidget;
Expand Down Expand Up @@ -66,15 +65,14 @@ public static ShuffleboardLayout addColumn(ShuffleboardTab tab, String columnTit
}

/**
* Adds a fullscreen sendable to a Shuffleboard tab.
* Makes a Shuffleboard component fullscreen.
*
* @param tab the Shuffleboard tab to add the Sendable to.
* @param title the title of the sendable.
* @param sendable the sendable to add.
* @return the sendable widget.
* @param component the component to make fullscreen.
* @return the fullscreen component.
*/
public static ComplexWidget addFullscreen(ShuffleboardTab tab, String title, Sendable sendable) {
return tab.add(title, sendable).withPosition(0, 0).withSize(10, 4);
// TODO
public static ShuffleboardComponent makeFullscreen(ShuffleboardComponent component) {
return component.withPosition(0, 0).withSize(10, 4);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/frc/robot/auto/Auto.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void periodic() {}

@Override
public void addToShuffleboard(ShuffleboardTab tab) {
Telemetry.addFullscreen(tab, "Auto Chooser", autoChooser);
Telemetry.makeFullscreen(tab.add("Auto Chooser", autoChooser));
}

/**
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/frc/robot/lights/Lights.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import edu.wpi.first.wpilibj.shuffleboard.SimpleWidget;
import edu.wpi.first.wpilibj.util.Color;
import frc.lib.Subsystem;
import frc.lib.Telemetry;
import frc.robot.lights.LEDControllerIO.LEDControllerIOValues;
import frc.robot.lights.LightsConstants.Animations;
import java.util.Map;
Expand Down Expand Up @@ -62,6 +63,8 @@ public void addToShuffleboard(ShuffleboardTab tab) {
tab.add("Light Color", true)
.withProperties(
Map.of("colorWhenFalse", "#000000", "colorWhenTrue", getColor().toHexString()));

Telemetry.makeFullscreen(lightWidget);
}

/**
Expand Down

0 comments on commit efe6a0e

Please sign in to comment.