Tournament manager calls user_control() multiple times?

Any user function may run in any order, any number of times. Your code should be designed around this fact.

Common scenario:

  1. User starts program with controller UNPLUGGED from field control.
  2. Program starts, VEXos falls back to default competition flags when unplugged (DRIVER | ENABLED).
  3. Driver control starts.
  4. User plugs controller into field control.
  5. Field control places robot into (DISABLED | AUTONOMOUS).
  6. Robot is disabled until the match starts.
  7. Match starts, autonomous runs, disabled again, driver runs for the second time.

Simply starting your program before plugging into field control result in user_control()running twice. In reality, it can run any number of times. For example, a radio drop could potentially do weird things to user code, or TM may decide to re-run auto.

The only code guaranteed to run ONCE is main/initialize/pre_auton/etc…

Don’t register persistent callbacks or tasks, or expect any competition handler to run only a single time in a specific order.

See Competition code and user created tasks as well.