A few things.
global variables will always be available while the programming is running, in the code above “armDest” is a global and is available in all tasks.
using bStopTasksBetweenModes is not recommended unless you really understand what it means, your autonomous and usercontrol tasks will not be stopped when the field is disabled, if you do not manage these yourself then they may both end up running together.
Technically it is but it’s going to act like a function, when started the code will run but, as there is no while statement, it will exit and stop almost straight away, see this. https://vexforum.com/index.php/conversation/post/122642
Local variables to a task will not be retained when a task is stopped and re-started unless the variable is declared as static.
use “getTaskState” to get the status of a task, bear in mind that only the current task will be in the taskStateRunning state (ie. you have to be running to even be able to make that function call), other tasks will usually be in the taskStateWaitingForTimer state or taskStateStopped if they really are stopped.
After thinking about it the global variables are all I need to maintain (i.e. If an arm is left in an up position). And I did leave out the while loop and task delay. I will update my example.
in simple code I usually just let the system stop any PID tasks etc., for more complex code I don’t use the supplied competition template anyway so the bStopTasksBetweenModes flag becomes meaningless. Just restart any PID tasks at the start of both auton and driver control.