User Program has exceded time limit of 3 seconds

So, i have a c++ iq programming, but when i try to use it, after about 1 second the brain stop working and shows on screen “User Program has exceded time limit of 3 seconds” and ask to reboot, heres my code btw

Is this a blocks project ? or a project that started as a blocks project and now you are using C++ ?
When did it stop working ? I see a revision history, that may give a clue.

Anyway, send me the project (zip up the vexcode file and post here) and I will take a look, it’s a big project and may just be too much for the IQ generation 1.

4 Likes

The project was an block project, but since about 3 months i made on c++, the changelog (the changelog is on spanish btw).
Heres a drive link to the programming on zip

removing the while loop in the check button handler seems to solve the issue.

What you are really suffering from is that block code makes really bad C++ code, that is, the programming patterns used in blocks (mostly all the event/broadcast stuff, variables forced to be floats) is really not the way it would be written in C if starting with a new program. In general, event handlers should not contain blocking loops. IQ can only allow a small number of tasks and event handlers to run at any one time, a blocking event handler is using up valuable resources. However, for now try this change (remove or comment out the while(true) loop) and see if everything else is working.

code fix
void onevent_buttonCheck_pressed_0() {
//  while (true){
  if (MenuEnd == Off_) {
    if (selector == 1.0) {
      Driver.broadcastAndWait();
    }
    if (selector == 2.0) {
      Autonumus.broadcast();
    }
    if (selector == 3.0) {
      Slot3.broadcast();
    }
    if (selector == 4.0) {
      Slot4.broadcast();
    }
    if (selector == 5.0) {
      Slot5.broadcast();
    }
  }
//}
}
5 Likes