diff --git a/Tools/completion/zsh/_ap_bin b/Tools/completion/zsh/_ap_bin index 67e1cdd867e01..8735278916370 100644 --- a/Tools/completion/zsh/_ap_bin +++ b/Tools/completion/zsh/_ap_bin @@ -21,16 +21,16 @@ _ap_bin() { '--gimbal[enable simulated MAVLink gimbal]' \ '--autotest-dir[set directory for additional files]:DIR:' \ '--defaults[set path to defaults file]:PATH:' \ - '--uartA[set device string for SERIAL0]:DEVICE:' \ - '--uartC[set device string for SERIAL1]:DEVICE:' \ - '--uartD[set device string for SERIAL2]:DEVICE:' \ - '--uartB[set device string for SERIAL3]:DEVICE:' \ - '--uartE[set device string for SERIAL4]:DEVICE:' \ - '--uartF[set device string for SERIAL5]:DEVICE:' \ - '--uartG[set device string for SERIAL6]:DEVICE:' \ - '--uartH[set device string for SERIAL7]:DEVICE:' \ - '--uartI[set device string for SERIAL8]:DEVICE:' \ - '--uartJ[set device string for SERIAL9]:DEVICE:' \ + '--uartA[(deprecated) set device string for SERIAL0]:DEVICE:' \ + '--uartC[(deprecated) set device string for SERIAL1]:DEVICE:' \ + '--uartD[(deprecated) set device string for SERIAL2]:DEVICE:' \ + '--uartB[(deprecated) set device string for SERIAL3]:DEVICE:' \ + '--uartE[(deprecated) set device string for SERIAL4]:DEVICE:' \ + '--uartF[(deprecated) set device string for SERIAL5]:DEVICE:' \ + '--uartG[(deprecated) set device string for SERIAL6]:DEVICE:' \ + '--uartH[(deprecated) set device string for SERIAL7]:DEVICE:' \ + '--uartI[(deprecated) set device string for SERIAL8]:DEVICE:' \ + '--uartJ[(deprecated) set device string for SERIAL9]:DEVICE:' \ '--serial0[set device string for SERIAL0]:DEVICE:' \ '--serial1[set device string for SERIAL1]:DEVICE:' \ '--serial2[set device string for SERIAL2]:DEVICE:' \ diff --git a/libraries/AP_HAL_SITL/SITL_cmdline.cpp b/libraries/AP_HAL_SITL/SITL_cmdline.cpp index 5ca530e38b072..1daa760e8526c 100644 --- a/libraries/AP_HAL_SITL/SITL_cmdline.cpp +++ b/libraries/AP_HAL_SITL/SITL_cmdline.cpp @@ -92,16 +92,16 @@ void SITL_State::_usage(void) "\t--gimbal enable simulated MAVLink gimbal\n" "\t--autotest-dir DIR set directory for additional files\n" "\t--defaults path set path to defaults file\n" - "\t--uartA device set device string for SERIAL0\n" - "\t--uartB device set device string for SERIAL3\n" // ordering captures the historical use of uartB as SERIAL3 - "\t--uartC device set device string for SERIAL1\n" - "\t--uartD device set device string for SERIAL2\n" - "\t--uartE device set device string for SERIAL4\n" - "\t--uartF device set device string for SERIAL5\n" - "\t--uartG device set device string for SERIAL6\n" - "\t--uartH device set device string for SERIAL7\n" - "\t--uartI device set device string for SERIAL8\n" - "\t--uartJ device set device string for SERIAL9\n" + "\t--uartA device (deprecated) set device string for SERIAL0\n" + "\t--uartC device (deprecated) set device string for SERIAL1\n" // ordering captures the historical use of uartB as SERIAL3 + "\t--uartD device (deprecated) set device string for SERIAL2\n" + "\t--uartB device (deprecated) set device string for SERIAL3\n" + "\t--uartE device (deprecated) set device string for SERIAL4\n" + "\t--uartF device (deprecated) set device string for SERIAL5\n" + "\t--uartG device (deprecated) set device string for SERIAL6\n" + "\t--uartH device (deprecated) set device string for SERIAL7\n" + "\t--uartI device (deprecated) set device string for SERIAL8\n" + "\t--uartJ device (deprecated) set device string for SERIAL9\n" "\t--serial0 device set device string for SERIAL0\n" "\t--serial1 device set device string for SERIAL1\n" "\t--serial2 device set device string for SERIAL2\n" @@ -246,6 +246,16 @@ void SITL_State::_parse_command_line(int argc, char * const argv[]) CMDLINE_FGVIEW, CMDLINE_AUTOTESTDIR, CMDLINE_DEFAULTS, + CMDLINE_UARTA, // must be in A-J order and numbered consecutively + CMDLINE_UARTB, + CMDLINE_UARTC, + CMDLINE_UARTD, + CMDLINE_UARTE, + CMDLINE_UARTF, + CMDLINE_UARTG, + CMDLINE_UARTH, + CMDLINE_UARTI, + CMDLINE_UARTJ, CMDLINE_SERIAL0, // must be in 0-9 order and numbered consecutively CMDLINE_SERIAL1, CMDLINE_SERIAL2, @@ -295,16 +305,16 @@ void SITL_State::_parse_command_line(int argc, char * const argv[]) {"disable-fgview", false, 0, CMDLINE_FGVIEW}, {"autotest-dir", true, 0, CMDLINE_AUTOTESTDIR}, {"defaults", true, 0, CMDLINE_DEFAULTS}, - {"uartA", true, 0, CMDLINE_SERIAL0}, - {"uartB", true, 0, CMDLINE_SERIAL3}, // ordering captures the historical use of uartB as SERIAL3 - {"uartC", true, 0, CMDLINE_SERIAL1}, - {"uartD", true, 0, CMDLINE_SERIAL2}, - {"uartE", true, 0, CMDLINE_SERIAL4}, - {"uartF", true, 0, CMDLINE_SERIAL5}, - {"uartG", true, 0, CMDLINE_SERIAL6}, - {"uartH", true, 0, CMDLINE_SERIAL7}, - {"uartI", true, 0, CMDLINE_SERIAL8}, - {"uartJ", true, 0, CMDLINE_SERIAL9}, + {"uartA", true, 0, CMDLINE_UARTA}, + {"uartB", true, 0, CMDLINE_UARTB}, + {"uartC", true, 0, CMDLINE_UARTC}, + {"uartD", true, 0, CMDLINE_UARTD}, + {"uartE", true, 0, CMDLINE_UARTE}, + {"uartF", true, 0, CMDLINE_UARTF}, + {"uartG", true, 0, CMDLINE_UARTG}, + {"uartH", true, 0, CMDLINE_UARTH}, + {"uartI", true, 0, CMDLINE_UARTI}, + {"uartJ", true, 0, CMDLINE_UARTJ}, {"serial0", true, 0, CMDLINE_SERIAL0}, {"serial1", true, 0, CMDLINE_SERIAL1}, {"serial2", true, 0, CMDLINE_SERIAL2}, @@ -439,6 +449,27 @@ void SITL_State::_parse_command_line(int argc, char * const argv[]) case CMDLINE_DEFAULTS: defaults_path = strdup(gopt.optarg); break; + case CMDLINE_UARTA: + case CMDLINE_UARTB: + case CMDLINE_UARTC: + case CMDLINE_UARTD: + case CMDLINE_UARTE: + case CMDLINE_UARTF: + case CMDLINE_UARTG: + case CMDLINE_UARTH: + case CMDLINE_UARTI: + case CMDLINE_UARTJ: { + int uart_idx = opt - CMDLINE_UARTA; + // ordering captures the historical use of uartB as SERIAL3 + static const uint8_t mapping[] = { 0, 3, 1, 2, 4, 5, 6, 7, 8, 9 }; + int serial_idx = mapping[uart_idx]; + char uart_letter = (char)(uart_idx)+'A'; + printf("WARNING: deprecated option --uart%c will be removed in a " + "future release. Use --serial%d instead.\n", + uart_letter, serial_idx); + _serial_path[serial_idx] = gopt.optarg; + break; + } case CMDLINE_SERIAL0: case CMDLINE_SERIAL1: case CMDLINE_SERIAL2: