Something in my program causes it to start as soon as the brain runs, and runs one of the tasks

The task that runs is called ‘OutakeUntil’, I initialize it globally here:

int outtakeUntil(){
  while(1){
    
    if(!(spitBall == Tower::BALL::BLUE && Config.Optical.color() == color::red ) && !(spitBall == Tower::BALL::RED && Config.Optical.color() == color::blue)){
      tower.spin(127,spitBall);
      intakes.spin(127);
    }else{
      tower.stop();
    }
    task::sleep(10);
  }
}
task OutakeUntil(outtakeUntil);

I’ve tried to stop it from running by placing a suspend command as the first thing in main but it doesn’t work.

I’m not very sure where to start looking but if you have any ideas about what could be wrong, I can post the appropriate code.

If this is global, it will start the task as soon as you run your program.
Any time you create a task it will run, but in global constructors is generally a bad idea.

2 Likes