Bluetooth Classic ESP32 automatic re-connect function is interrupting the App

Dear Experts

I have created my own block for an automatic reconnect function for BT Classic with my ESP32 using a Clock Block. The function itself works to my satisfaction and tries to reconnect to the last stored/connected device as soon as the connection is lost (within the loop time specified in the clock function).

Please find my simplified block here:

The issue if the device is not anymore available/powered:
The problem with my function is that if the device is not powered and therefore no connection with the block below can be re-established, the block seems to halt the entire app and freezes it for a short period of time until the block is completed (without reconnection). Then the app is running smooth for a very short time until the Clock block calls this function again and it again halts/interrupts the app:

Note: this block is part of the Clock function above, see first if clause

Is the a better way to try to reconnect in the background without any interuption of the app?

Thank you very much.

Cervino

Dear all

I have now reviewed different projects from similar threads in this community like this one:

Bluetooth Auto Connect without user action HC-05, HC-06, ESP32, no ListPicker or TinyDB needed

Unfortunately, the behavior of this command has been confirmed by all examples I have found: It halts the app during the (unsuccessful) connection attempt. :

BT Conn

Any idea or workaround to solve this?

Thanks.

Cervino