Yes, you are correct that your user control code takes over your macro execution.
You need to give the macro some time to complete. Use this code as a sample for your user control loop:
bool bMacroIsRunning = false;
uint32_t macroStartTime = 0;
while(1)
{
int joyVal = Controller1.Axis1.position(pct);
if( abs(joyVal) > 10 )
{
motor1.spin(fwd,joyVal,pct);
bMacroIsRunning = false; // cancel macro run
}
else if( Controller1.ButtonL1.pressing() && bMacroIsRunning==false )
{ // user pressed L1 to start macro and macro is not running
macroStartTime = vex::timer::system(); //remember start time
motor1.spin(reverse,20,pct);
bMacroIsRunning = true;
}
else if( bMacroIsRunning==false ||
vex::timer::system() > macroStartTime+1000 )
{ // this gives macro 1 sec to finish
motor1.stop();
bMacroIsRunning = false;
}
vex::task(sleep(1);
}
When you press the button it will start the macro and remember its start time. Then it will stop the motors only if 1 second will pass since beginning.
User control will only take over if you move joystick while macro is running.