# Event handler to shut down the launch system if the check_serial_device returns -1

# or start auto_cell_str2str if check_serial_device returns 1

cond_auto_cell_str2str = RegisterEventHandler(

OnProcessExit(

target_action=check_serial_device,

on_exit=lambda event, context: [LogInfo(msg="event.returncode == -1 ")] if event.returncode != 0

else [

TimerAction(

period=3.0, # 3 second delay

actions=[

LogInfo(msg="Starting auto_cell_str2str...")

#auto_cell_str2str

]

)

]

)

)