Wait command that works after unpausing programm


In my programm I use a wait command. If the programm is paused within this wait command, either via the safety stop (Laserscanner) or manually and than unpaused, the code gets stuck in this wait command.
I tried two versions of the waiting command, both of them lead to the same problem.
Here the two versions of the waiting command:


How to avoid this problem?

Some more Information:

The robot is placing parts into a machine. It has to wait until the machine is ready to be loaded. There are two “ready to load” signals: Pos A or Pos B ready. Those Signals are monitored with two digital inptus “Pos_B_bereit” and “Pos_A_Bereit”.
But there is a lasercurtain in the machine that prevents the rotation of the plate (with the two positions A and B), when the robot arm is in the machines danger area.

Both signals get low at the same time, while the plate is turning. The Position A or B turns high, when ready to be loaded.

I managed to observe a case, where one of the positions was ready to be loaded, the robot entered the machines safety area and then the plate turned again - which resultet in an error.

Therefore I have to make sure, that the plate has finished turning, before the robot enters the protected area. Waiting 1Sekond after one of both Positions is ready to be loaded is sufficent to make sure, that the machine is ready to be loaded.

I am creating a variable “Telr_fertg_gedreht” (Plate has finished turning) to make sure, the plate has finished turning before the robot is entering the machines safety area.