From 2997acf8c3d7957aa6a946171b8810a902e5bfd0 Mon Sep 17 00:00:00 2001 From: Caleb Berger Date: Sat, 2 Feb 2019 14:19:01 -0500 Subject: [PATCH] Simplify SmartDashboard checkboxes --- src/main/java/frc/robot/Robot.java | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/main/java/frc/robot/Robot.java b/src/main/java/frc/robot/Robot.java index 8b892ac..f833e94 100644 --- a/src/main/java/frc/robot/Robot.java +++ b/src/main/java/frc/robot/Robot.java @@ -1,6 +1,5 @@ package frc.robot; -import edu.wpi.first.wpilibj.Preferences; import edu.wpi.first.wpilibj.TimedRobot; import edu.wpi.first.wpilibj.command.Command; import edu.wpi.first.wpilibj.command.Scheduler; @@ -32,17 +31,13 @@ public void robotInit() { // chooser.addOption("My Auto", new MyAutoCommand()); SmartDashboard.putData("Auto mode", chooser); - if (!SmartDashboard.containsKey("Display Drivetrain data?")) { - SmartDashboard.putBoolean("Display Drivetrain data?", false); - SmartDashboard.setPersistent("Display Drivetrain data?"); + String[] displays = new String[]{"Display Drivetrain data?", "Display navX data?"}; + for (String display : displays) { + if (!SmartDashboard.containsKey(display)) { + SmartDashboard.putBoolean(display, false); + SmartDashboard.setPersistent(display); + } } - Preferences.getInstance().putBoolean("Display Drivetrain data?", false); - - if (!SmartDashboard.containsKey("Display navX data?")) { - SmartDashboard.putBoolean("Display navX data?", false); - SmartDashboard.setPersistent("Display navX data?"); - } - Preferences.getInstance().putBoolean("Display navX data?", false); } /**