style: (anchor) better comment serial finding

This commit is contained in:
David
2025-11-21 17:06:37 -06:00
parent 3bb3771dce
commit 40fa0d0ab8

View File

@@ -77,26 +77,23 @@ class Anchor(Node):
self.get_logger().info( self.get_logger().info(
f"Selecting MCU '{found_port.description}' at {found_port.device}." f"Selecting MCU '{found_port.description}' at {found_port.device}."
) )
self.serial_port = found_port.device self.serial_port = found_port.device # String, location of device file; e.g., '/dev/ttyACM0'
elif len(recog_ports) > 1: # Found multiple recognized MCUs elif len(recog_ports) > 1: # Found multiple recognized MCUs
# Kinda jank log message # Kinda jank log message
self.get_logger().error( self.get_logger().error(
f"Found multiple recognized MCUs: {[p.device for p in recog_ports].__str__()}" f"Found multiple recognized MCUs: {[p.device for p in recog_ports].__str__()}"
) )
# time.sleep(1) # Don't set self.serial_port; later if-statement will exit()
# sys.exit(1)
elif ( elif (
len(recog_ports) == 0 and len(real_ports) > 0 len(recog_ports) == 0 and len(real_ports) > 0
): # Found real ports but none recognized ): # Found real ports but none recognized; i.e. maybe found an IMU or camera but not a MCU
self.get_logger().error( self.get_logger().error(
f"No recognized MCUs found; instead found {[p.device for p in real_ports].__str__()}." f"No recognized MCUs found; instead found {[p.device for p in real_ports].__str__()}."
) )
# time.sleep(1) # Don't set self.serial_port; later if-statement will exit()
# sys.exit(1)
else: # Found jack shit else: # Found jack shit
self.get_logger().error("No valid Serial ports specified or found.") self.get_logger().error("No valid Serial ports specified or found.")
# time.sleep(1) # Don't set self.serial_port; later if-statement will exit()
# sys.exit(1)
# We still don't have a serial port; fall back to legacy discovery (Areeb's code) # We still don't have a serial port; fall back to legacy discovery (Areeb's code)
# Loop through all serial devices on the computer to check for the MCU # Loop through all serial devices on the computer to check for the MCU