package org.texastorque.texastorque2015.input;

import org.texastorque.texastorque2015.subsystem.Intake;
import org.texastorque.torquelib.util.GenericController;

public class DriverInput extends Input {

    GenericController driver;
    GenericController operator;
    
    private boolean isOverride;

    public DriverInput() {
        driver = new GenericController(0, GenericController.TYPE_XBOX, 0.2);
        operator = new GenericController(1, GenericController.TYPE_XBOX, 0.2);

        isOverride = false;
    }

    @Override
    public void run() {
        if (operator.getLeftCenterButton()) {
            isOverride = true;
        } else if (operator.getRightCenterButton()) {
            isOverride = false;
        }
        
        if (isOverride) {
            calcOverride();
        } else {
            calcElevator();
        }
        
        calcIntake();
        calcDrivebase();
    }
    
    //Drivebase
    private void calcDrivebase() {
        leftSpeed = -1 * driver.getLeftYAxis() + driver.getRightXAxis();
        rightSpeed = -1 * driver.getLeftYAxis() - driver.getRightXAxis();
        strafeSpeed = driver.getLeftXAxis();

        if (driver.getLeftBumper()) {
            leftSpeed = leftSpeed / 2;
            rightSpeed = rightSpeed / 2;
        }
    }
    
    private void calcElevator() {
        
    }
    
    private void calcOverride() {
        overrideElevatorMotorSpeed = -1 * operator.getLeftYAxis();
    }
    
    private void calcIntake() {
        if (operator.getRightBumper()) {
            leftIntakeSpeed = 1.0 - operator.getRightXAxis() / 2;
            rightIntakeSpeed = 1.0 + operator.getRightXAxis() / 2;
            
            if (operator.getRightYAxis() < 0.75) {
                intakeIn = true;
            } else {
                intakeIn = false;
            }
        }
    }
}

@@ -45,65 +45,8 @@
 t;%0A%0A
-import org.texastorque.texastorque2015.subsystem.Intake;%0A
 impo
@@ -98,16 +98,16 @@
 roller;%0A
+
 %0Apublic 
@@ -206,45 +206,8 @@
 tor;
-%0A    %0A    private boolean isOverride;
 %0A%0A  
@@ -388,35 +388,33 @@
  0.2);%0A%0A        
-isO
+o
 verride = false;
@@ -410,24 +410,99 @@
 de = false;%0A
+        armOpen = false;%0A        punchOut = false;%0A        tiltUp = false;%0A
     %7D%0A%0A    @
@@ -584,35 +584,33 @@
 ) %7B%0A            
-isO
+o
 verride = true;%0A
@@ -675,19 +675,17 @@
         
-isO
+o
 verride 
@@ -728,11 +728,9 @@
 if (
-isO
+o
 verr
@@ -1699,9 +1699,9 @@
 s() 
-%3C
+%3E
  0.7
@@ -1785,32 +1785,32 @@
 takeIn = false;%0A
-
             %7D%0A  
@@ -1799,32 +1799,150 @@
 ;%0A            %7D%0A
+        %7D else %7B%0A            leftIntakeSpeed = 0.0;%0A            rightIntakeSpeed = 0.0;%0A            intakeIn = false;%0A
         %7D%0A    %7D%0A

Fix driver input stuff