package org.firstinspires.ftc.team7316.util.hardware;

import com.qualcomm.robotcore.hardware.DcMotor;

import org.firstinspires.ftc.team7316.util.Constants;
import org.firstinspires.ftc.team7316.util.Loopable;
import org.firstinspires.ftc.team7316.util.input.ButtonWrapper;

/**
 * Created by Maxim on 1/17/2017.
 */

public class CapballWrapper implements Loopable {

    private DcMotor motor;
    private ButtonWrapper upButton, downButton;

    public CapballWrapper(DcMotor motor, ButtonWrapper upButton, ButtonWrapper downButton) {
        this.motor = motor;
        this.upButton = upButton;
        this.downButton = downButton;
    }

    @Override
    public void init() {

    }

    @Override
    public void loop() {
        Hardware.log(Hardware.tag, "Encoder: " + this.motor.getCurrentPosition());

        if (this.motor.getCurrentPosition() > Constants.CAP_BALL_TOP_LIMIT || this.motor.getCurrentPosition() < 0) {
            this.motor.setPower(0);
            return;
        }

        if (downButton.state()) {
            this.motor.setPower(-Constants.CAP_BALL_SPEED);
        } else if (upButton.state()) {
            this.motor.setPower(Constants.CAP_BALL_SPEED);
        } else {
            this.motor.setPower(0);
        }
    }

    @Override
    public boolean shouldRemove() {
        return false;
    }

    @Override
    public void terminate() {
        this.motor.setPower(0);
    }
}

@@ -857,9 +857,9 @@
 n() 
-%3E
+%3C
  Con
@@ -888,129 +888,11 @@
 MIT 
-%7C%7C this.motor.getCurrentPosition() %3C 0) %7B%0A            this.motor.setPower(0);%0A            return;%0A        %7D%0A%0A        if (
+&& 
 down
@@ -961,32 +961,32 @@
 AP_BALL_SPEED);%0A
-
         %7D else i
@@ -988,16 +988,55 @@
 lse if (
+this.motor.getCurrentPosition() %3E 0 && 
 upButton

Fix the capball thing