1

Here's my code:

setTimer(delay, (SEEDKEY_MAXTRY * SEEDKEY_FREQ) + (LOGIN_MAXTRY * LOGIN_FREQ));
do {
    // waits, until all operations have been executed;  
} while(isTimerActive(delay));

I know exactly how long it takes to execute my commands, so I set the timer delay to the explicit value. I have to wait, until I return some values.

The simulation stucks at this point, my panels go into Windows-"No response" and the only way I can end the simulation is via Taskmanager.

I think the only explanation is, that the timers need more time, or are not executed at all, while I am in the do ... while statement. (same with while {})

Can someone confirm this thought, or prove me wrong by giving me a solution to my problem?

R. Joiny
  • 309
  • 7
  • 17

1 Answers1

1

Ok I always find a workaround, since CAPL is not too popular on stackoverflow...


For the readers, that want to know how:

I just used a global status variable to restrict the user from performing the action until my processing gets finished.

R. Joiny
  • 309
  • 7
  • 17
  • 1
    I do not know CAPL but in most other languages timers are independent from the flow control. – Christophe Roussy Jun 30 '16 at 07:51
  • It should be like that in CAPL too, but it didn't work out because of the loop, so I did it another way. Unless someone finds another error in my code above, I think CAPL might be a little buggy using loops, that are dependend on results calculated in timers... – R. Joiny Jul 01 '16 at 02:00
  • You're right. CAPL has issues handling loops with no actions to perform. That's why it crashes when you try to run the void while. – PySerial Killer May 28 '18 at 22:42
  • @R.Joiny Can you please me know what do you mean by global status variable? And how you used it to stop processing. – Samarth Janardhan Jun 30 '22 at 14:25