I have EKI running in a user defined submit (multi-submit package installed) on a KRC4. I am not sure how to close the connection when deselecting the submit.
This sometimes causes an error when the submit is selected. Error - Connection is already initialized. I am trying to find a way to check if the connection is initialized before calling EKI_Init(), but I have not found a valid way to check this. IF NOT RET_Init.Connected THEN EKI_Init() also causes an error.
I will continue looking for a way to check if there is a connection before initializing (maybe with $FLAG[x]...?), but I also want to know how to close the connection when the submit is deselected. It doesn't make sense to leave it open when it is not in use.
I found some useful information in this thread How to tell if a connection has already been opened in KUKA.EthernetKRL, but I haven't figured out how to implement the suggestions without getting more erros:
IF RET.Msg_NO==0 THEN...
IF NOT RET.Connected THEN...
I checked the EthernetKRL30 documentation as recommended as well, but it only says to "Delete overprogrammed function" to solve the already initialized error. I only have EKI_Init in the program one time. The issue is that it is called more than once when the program is run again. Actually, the issue is that the program does not close when deselected. I would like to handle both issues, but I am a bit stuck.