I saw that you show progress dialog.
There is a little problem the this dialog cannot be dismissed in a short amount of time.
So:
- Temporarily disable the OnDisconnect and OnConnect blocks
- Change the massive if blocks to
if...else if...at lastelse - put the
clock1.timer enabled -> trueblock at the end of the else part
Set the clock to at least 50ms
If anything not working, may you send a test aia that can reproduce your bugs?