serial port config include device (eg /dev/ttyS3) in label (eg TELEM/SERIAL 4 (/dev/ttyS3))

This commit is contained in:
Daniel Agar 2021-07-05 12:25:24 -04:00 committed by Junwoo Hwang
parent ebae9ae3d7
commit 3ec84d28da
1 changed files with 4 additions and 1 deletions

View File

@ -235,10 +235,13 @@ for tag, device in board_ports:
raise Exception("Unknown serial port {:}. "
"You might have to add it to serial_ports in\n {:}".format(tag,
os.path.realpath(__file__)))
# Helper label to indicate which device is connected to which port (e.g. TELEM1 = /dev/ttyS1)
label_append = (" (" + device + ")") if device != "" else ""
serial_devices.append({
'tag': tag,
'device': device,
'label': serial_ports[tag]["label"],
'label': serial_ports[tag]["label"] + label_append,
'index': serial_ports[tag]["index"],
'default_baudrate': serial_ports[tag]["default_baudrate"]
})