package org.redalert1741.cageBot;

import org.redalert1741.robotBase.config.Config;
import org.redalert1741.robotBase.config.Configurable;
import org.redalert1741.robotBase.logging.DataLogger;
import org.redalert1741.robotBase.logging.Loggable;

import edu.wpi.first.wpilibj.Solenoid;
import edu.wpi.first.wpilibj.Spark;

public class GearPlacer implements Configurable, Loggable
{
	boolean liftOn, pushOn;
	Solenoid liftL, liftR, pushL, pushR;
	private Spark in;
	/**
	 * Four solenoids for the pneumatic gear placer + one motor for the intake
	 * @param liftL {@link Solenoid} for lift
	 * @param liftR {@link Solenoid} for lift
	 * @param pushL {@link Solenoid} for push
	 * @param pushR {@link Solenoid} for push
	 * @param intake PWM ID for intake {@link Spark}
	 */
	public GearPlacer(int liftL, int liftR, int pushL, int pushR, int intake)
	{
		this.in = new Spark(intake);
		this.liftL = new Solenoid(liftL);
		this.liftR = new Solenoid(liftR);
		this.pushL = new Solenoid(pushL);
		this.pushR = new Solenoid(pushR);
	}
	
	public void liftUp()
	{
		liftL.set(liftOn);
		liftR.set(liftOn);
	}
	
	public void liftDown()
	{
		liftL.set(!liftOn);
		liftR.set(!liftOn);
	}
	
	public void push()
	{
		pushL.set(pushOn);
		pushR.set(pushOn);
	}
	
	public void hold()
	{
		pushL.set(!pushOn);
		pushR.set(!pushOn);
	}
	
	public void setIntake(double x)
	{
		in.set(x);
	}

	@Override
	public void reloadConfig()
	{
		liftOn = Config.getSetting("liftOn", false);
		pushOn = Config.getSetting("pushOn", true);
	}

	@Override
	public void setupLogging(DataLogger logger)
	{
		logger.addAttribute("liftState");
		logger.addAttribute("pushState");
		logger.addAttribute("intakeSpeed");
	}

	@Override
	public void log(DataLogger logger)
	{
		logger.log("liftState", liftL.get());
		logger.log("pushState", pushR.get());
		logger.log("intakeSpeed", in.get());
	}
}

@@ -239,16 +239,61 @@
 gable;%0A%0A
+import edu.wpi.first.wpilibj.DoubleSolenoid;%0A
 import e
@@ -446,16 +446,22 @@
 ushOn;%0A%09
+Double
 Solenoid
@@ -469,30 +469,14 @@
 lift
-L, liftR, pushL, pushR
+, push
 ;%0A%09p
@@ -920,24 +920,29 @@
 his.lift
-L
  = new 
+Double
 Solenoid
@@ -951,39 +951,10 @@
 iftL
-);%0A%09%09this.liftR = new Solenoid(
+, 
 lift
@@ -972,16 +972,21 @@
 push
-L
  = new 
+Double
 Sole
@@ -999,39 +999,10 @@
 ushL
-);%0A%09%09this.pushR = new Solenoid(
+, 
 push
@@ -1037,25 +1037,24 @@
 ()%0A%09%7B%0A%09%09lift
-L
 .set(liftOn)
@@ -1056,29 +1056,72 @@
 ftOn
-);%0A%09%09liftR.set(liftOn
+ ? DoubleSolenoid.Value.kForward : DoubleSolenoid.Value.kReverse
 );%0A%09
@@ -1157,17 +1157,16 @@
 %7B%0A%09%09lift
-L
 .set(!li
@@ -1173,30 +1173,72 @@
 ftOn
-);%0A%09%09liftR.set(!liftOn
+ ? DoubleSolenoid.Value.kForward : DoubleSolenoid.Value.kReverse
 );%0A%09
@@ -1266,25 +1266,24 @@
 ()%0A%09%7B%0A%09%09push
-L
 .set(pushOn)
@@ -1285,29 +1285,72 @@
 shOn
-);%0A%09%09pushR.set(pushOn
+ ? DoubleSolenoid.Value.kForward : DoubleSolenoid.Value.kReverse
 );%0A%09
@@ -1382,17 +1382,16 @@
 %7B%0A%09%09push
-L
 .set(!pu
@@ -1398,30 +1398,72 @@
 shOn
-);%0A%09%09pushR.set(!pushOn
+ ? DoubleSolenoid.Value.kForward : DoubleSolenoid.Value.kReverse
 );%0A%09
@@ -1911,17 +1911,16 @@
 e%22, lift
-L
 .get());
@@ -1950,17 +1950,16 @@
 e%22, push
-R
 .get());

Change Solenoid values to double solenoids.