Catapult Code Help (VEX C++)

Hi all! I am having some trouble with coding my catapult to shoot and then retract back while driving. Currently, I have a function:
void catapultControl(){
vex::rotationUnits revolutions = vex::rotationUnits::rev;
float retract = 3.0;
Catapult.rotateFor(retract, revolutions);
}
and in my user control before my while(true) { statement
Controller1.ButtonR2.pressed(catapultControl);

I saw on another post someone used this code but the catapult does not run and I am having trouble trying to figure out a way to be able to still drive and control the other buttons while the catapult shoots and retracts back to its original position. I tried putting it with my other catapult if statements (we currently pull the catapult back manually with a button) but I have to wait for the catapult to retract before I can start using the other buttons again. I also tried to use the startRotateFor and the startRotateTo functions as well but nothing happens. I would really appreciate some help thanks!

well, I have no idea how to code with vex C++ (I use robotC), but I can show you how I did this with robotC. I’d bet this would work with vex C++ as well

//written with pseudocode
if(buttonPressedOnController){
    //move catapult down
}
else{
    //move catapult down until its reached loading position
}

I have all this in my driver control while loop, hope this helps

bool lower;
while (true) {
     /* drive stuff (base, arm, intake, etc) */
     lower = /*button to auto lower is pressed */;
     if (!lower) {
          setCatapult(); // or whatever you use to power the motor
     } else {
          setCatapult(127); // lower the catapult
          lower = /* has the catapult reached the bottom? */
     }
}

Edit: You might the catapult to stop if you press a button

while (true) {
     /* drive stuff (base, arm, intake, etc) */
     lower = /*button to auto lower is pressed */;
     if (!lower) {
          setCatapult(); // or whatever you use to power the motor
     } else {
          setCatapult(127); // lower the catapult
          lower = /*button is pressed*/ ? false : /* has the catapult reached the bottom? */;
     }
}

So if you look at the actual rotate for documentation it has there parameters: rotateFor(double rotation, rotationUnits units, bool waitForCompletion=true)

That last one is important so normally when a function like rotateFor is run the default value is that it will wait for the motor to reach the target(it stops the whole program) but if you change it to false then it should continue with the rest of the program.

void catapultControl(){
vex::rotationUnits revolutions = vex::rotationUnits::rev;
float retract = 3.0;
Catapult.rotateFor(retract, revolutions);
}

^^So not really sure what you did there but how I would do it is like this

void catapultControl() {
    rotateFor(3, vex::rotationUnits:rev, false)
}

Hope that helps!

I tried what you suggested but our catapult only moves slightly. Heres the code:
else if(Controller1.ButtonR2.pressing() || Controller2.ButtonR2.pressing()){
Catapult.rotateFor(3, vex::rotationUnits::rev, false);
}

When I set it to true, the robot will shoot and retract all the way down, but I cannot control anything until it completes.