diff --git a/python_app/scripts/laser_temp_monitor.py b/python_app/scripts/laser_temp_monitor.py index b8a21e0..86a8d67 100644 --- a/python_app/scripts/laser_temp_monitor.py +++ b/python_app/scripts/laser_temp_monitor.py @@ -26,6 +26,7 @@ from python_app.hardware_full.laser_control.controller import ( DEVICE_MAIN_MESSAGE_ID, LaserController, ) +from python_app.hardware_full.laser_control.exceptions import PortBusyError from python_app.hardware_full.laser_control.models import VariationType from python_app.hardware_full.laser_control.monitoring import ( DEFAULT_READINGS_PATH, @@ -114,7 +115,13 @@ def main() -> int: pi_coeff2_p=laser.pi_coeff2_p, pi_coeff2_i=laser.pi_coeff2_i, ) - controller.connect() + try: + controller.connect() + except PortBusyError as exc: + # Expected, benign conflict: the manual-control UI (or another monitor) + # already owns the port. Exit cleanly with guidance, not a traceback. + logger.error("%s", exc) + return 2 try: if args.start: _start_variation(controller, variation)