From c64916128334f3ae38f0ee550c86fab39ae485eb Mon Sep 17 00:00:00 2001 From: Jason Cox Date: Sat, 13 Feb 2016 12:00:28 -0500 Subject: [PATCH] some more bug fixes. --- src/Robot.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/Robot.cpp b/src/Robot.cpp index 7688ac4..b356e3d 100644 --- a/src/Robot.cpp +++ b/src/Robot.cpp @@ -8,6 +8,7 @@ #define THUMB 2 // Thumb button number #define RAMP_RAISE 3 // Button 3 for Raising Ramp #define RAMP_LOWER 4 // Button 4 to lower ramp. +#define UNJAM 11 #define DEADZONE_RADIUS 0.01 // Deadzone Radius prevents tiny twitches in the joystick's value from // affecting the robot. Use this for cleaning up drive train and shooter. @@ -45,6 +46,7 @@ private: bool inverting; bool ramping; bool shooting; + bool unjamming; float shooter_power; LiveWindow *lw = LiveWindow::GetInstance(); @@ -68,6 +70,7 @@ private: pickupRunning = false; ramping = false; shooting = false; + unjamming = false; shooter_power = 0; } @@ -135,7 +138,9 @@ private: shooter.BoostRamp(); ramping = true; }*/ - else if(ramping) + else if(ramping + && !operator_stick.GetRawButton(RAMP_LOWER) + && !operator_stick.GetRawButton(RAMP_RAISE)) { std::cout << "Stopping Ramp."; shooter.StopRamp(); @@ -143,6 +148,17 @@ private: } + if(!unjamming && operator_stick.GetRawButton(UNJAM)) + { + unjamming = true; + shooter.Unjam(); + } + else if(unjamming && !operator_stick.GetRawButton(UNJAM)) + { + shooter.PickUp(false); + unjamming = false; + } + /* * Run the Shooter only while the THUMB button is held down on the operator stick. @@ -191,7 +207,7 @@ private: shooting = true; shooter.Shoot(); } - else if(shooting) + else if(shooting && !operator_stick.GetRawButton(TRIGGER)) { shooting = false; shooter.StopShooter();