Autonomous Acting Weirdly

Well, hard to test without a robot. But the first thing to fix is this.

void usercontrol(void) {
  while(!autonSelected){
    Controller1.ButtonLeft.pressed(autonChanger);
    Controller1.ButtonA.pressed([]() -> void {
      autonSelected = true;
      Controller1.ButtonLeft.pressed([]() -> void {});
      Controller1.ButtonA.pressed([]() -> void {});
    });
    autonDisplay();
    wait(100, msec);
  }

assume you want to select an autonomous before connecting to field control, however, that loop is registering the ButtonLeft.pressed and ButtonA.pressed events many times. You must only register event handlers once.

also

Controller1.ButtonLeft.pressed([]() -> void {});

you cannot unregister an event handler unless you stop all tasks when the robot becomes disabled by setting bStopAllTasksBetweenModes to true.

see this post, make necessary changes and then see what happens.

also this topic.