From 70825be69092f229196b2614432f027fb3f31ea3 Mon Sep 17 00:00:00 2001 From: Brad Miller Date: Wed, 3 Dec 2014 17:19:58 -0500 Subject: [PATCH] Reorded network table init to avoid error and added disabledInit to template (artf3841, artf3840) Change-Id: I5d1b1925f594e8019541033b20f70be003798d82 --- .../resources/templates/command-based/Robot.java | 8 ++++++++ .../java/edu/wpi/first/wpilibj/livewindow/LiveWindow.java | 6 ++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/command-based/Robot.java b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/command-based/Robot.java index 8d0fbe7dba..28fe393c54 100644 --- a/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/command-based/Robot.java +++ b/eclipse-plugins/edu.wpi.first.wpilib.plugins.java/resources/templates/command-based/Robot.java @@ -56,6 +56,14 @@ public class Robot extends IterativeRobot { if (autonomousCommand != null) autonomousCommand.cancel(); } + /** + * This function is called when the disabled button is hit. + * You can use it to reset subsystems before shutting down. + */ + public void disabledInit(){ + + } + /** * This function is called periodically during operator control */ diff --git a/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/livewindow/LiveWindow.java b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/livewindow/LiveWindow.java index 90ed3a8a14..49e1e97e44 100644 --- a/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/livewindow/LiveWindow.java +++ b/wpilibj/wpilibJava/src/main/java/edu/wpi/first/wpilibj/livewindow/LiveWindow.java @@ -53,8 +53,8 @@ public class LiveWindow { private static Vector sensors = new Vector(); // private static Vector actuators = new Vector(); private static Hashtable components = new Hashtable(); - private static ITable livewindowTable = NetworkTable.getTable("LiveWindow"); - private static ITable statusTable = livewindowTable.getSubTable("~STATUS~"); + private static ITable livewindowTable; + private static ITable statusTable; private static boolean liveWindowEnabled = false; private static boolean firstTime = true; @@ -67,6 +67,8 @@ public class LiveWindow { */ private static void initializeLiveWindowComponents() { System.out.println("Initializing the components first time"); + livewindowTable = NetworkTable.getTable("LiveWindow"); + statusTable = livewindowTable.getSubTable("~STATUS~"); for (Enumeration e = components.keys(); e.hasMoreElements();) { LiveWindowSendable component = (LiveWindowSendable) e.nextElement(); LiveWindowComponent c = (LiveWindowComponent) components.get(component);