package org.usfirst.frc.team1002.robot;

import org.usfirst.frc.team1002.robot.commands.Lift;
import org.usfirst.frc.team1002.robot.subsystems.Drive;

import edu.wpi.first.wpilibj.GenericHID;
import edu.wpi.first.wpilibj.buttons.JoystickButton;

public class OI {
	JoystickButton upButton;
	JoystickButton downButton;
	JoystickButton gyroReset;
	JoystickButton cartesianToggle;

	public OI(GenericHID joystick) {
		this.upButton = new JoystickButton(joystick, 6);
		this.downButton = new JoystickButton(joystick, 4);
		this.gyroReset = new JoystickButton(joystick, 2);
		this.cartesianToggle = new JoystickButton(joystick, 11);

		// Forklift
		this.upButton.whileHeld(new Lift(1));
		this.downButton.whileHeld(new Lift(-1));
		this.upButton.whenReleased(new Lift(0));
		this.downButton.whenReleased(new Lift(0));

		// Switch between Cartesian and polar
		if (this.cartesianToggle.get()) {
			Drive.isCartesian = !Drive.isCartesian;
		}

		// Reset the gyro angle
		if (this.gyroReset.get()) {
			Drive.gyro.reset();
		}
	}

}

@@ -34,16 +34,69 @@
 robot;%0A%0A
+import org.usfirst.frc.team1002.robot.commands.Fork;%0A
 import o
@@ -310,17 +310,20 @@
 ss OI %7B%0A
-%09
+    
 Joystick
@@ -331,33 +331,36 @@
 utton upButton;%0A
-%09
+    
 JoystickButton d
@@ -370,17 +370,20 @@
 Button;%0A
-%09
+    
 Joystick
@@ -400,17 +400,20 @@
 oReset;%0A
-%09
+    
 Joystick
@@ -436,18 +436,76 @@
 Toggle;%0A
-%0A%09
+    JoystickButton forkIn;%0A    JoystickButton forkOut;%0A%0A    
 public O
@@ -529,17 +529,16 @@
 tick) %7B%0A
-%09
 %09this.up
@@ -579,17 +579,16 @@
 ck, 6);%0A
-%09
 %09this.do
@@ -631,17 +631,16 @@
 ck, 4);%0A
-%09
 %09this.gy
@@ -682,17 +682,16 @@
 ck, 2);%0A
-%09
 %09this.ca
@@ -740,18 +740,114 @@
 k, 11);%0A
-%0A
 %09
+this.forkIn = new JoystickButton(joystick, 3);%0A%09this.forkOut = new JoystickButton(joystick, 5);%0A%0A
 %09// Fork
@@ -851,17 +851,16 @@
 orklift%0A
-%09
 %09this.up
@@ -886,25 +886,24 @@
 w Lift(1));%0A
-%09
 %09this.downBu
@@ -928,25 +928,25 @@
  Lift(-1));%0A
-%09
+%0A
 %09this.upButt
@@ -975,17 +975,16 @@
 ft(0));%0A
-%09
 %09this.do
@@ -1021,16 +1021,174 @@
 (0));%0A%0A%09
+this.forkIn.whileHeld(new Fork(1));%0A%09this.forkOut.whileHeld(new Fork(-1));%0A%0A%09this.forkIn.whenReleased(new Fork(0));%0A%09this.forkOut.whenReleased(new Fork(0));%0A%0A
 %09// Swit
@@ -1218,17 +1218,16 @@
 d polar%0A
-%09
 %09if (thi
@@ -1250,26 +1250,28 @@
 e.get()) %7B%0A%09
-%09%09
+    
 Drive.isCart
@@ -1302,14 +1302,12 @@
 an;%0A
-%09
 %09%7D%0A%0A
-%09
 %09// 
@@ -1327,17 +1327,16 @@
 o angle%0A
-%09
 %09if (thi
@@ -1357,18 +1357,20 @@
 t()) %7B%0A%09
-%09%09
+    
 Drive.gy
@@ -1385,14 +1385,15 @@
 ();%0A
-%09
 %09%7D%0A
-%09%7D%0A
+    %7D
 %0A%7D%0A

add joystick buttons for fork