Tools: sysid cannot be run together with auto-sysid

Added per @peterbarker suggestion
Co-authored-by: Peter Barker <pb-gh@barker.dropbear.id.au>
This commit is contained in:
Michael Day 2021-10-30 17:18:32 -04:00 committed by Tom Pittenger
parent d065515b2a
commit 93e6c1a920

View File

@ -714,8 +714,15 @@ def start_vehicle(binary, opts, stuff, spawns=None):
c = ["-I" + str(i)]
if spawns is not None:
c.extend(["--home", spawns[i]])
if opts.auto_sysid and opts.sysid is None and 0 <= i < 255:
c.extend(["--sysid", str(i + 1)])
if opts.auto_sysid:
if opts.sysid is not None:
raise ValueError("Can't use auto-sysid and sysid together")
sysid = i + 1
# Take 0-based logging into account
if i < 0 or i > 255:
raise ValueError("Invalid system id %d" % i)
c.extend(["--sysid", str(sysid)])
os.chdir(i_dir)
run_in_terminal_window(cmd_name, cmd + c)
os.chdir(old_dir)
@ -1232,6 +1239,10 @@ if cmd_opts.strace and cmd_opts.valgrind:
if cmd_opts.strace and cmd_opts.callgrind:
print("callgrind and strace almost certainly not a good idea")
if cmd_opts.sysid and cmd_opts.auto_sysid:
print("Cannot use auto-sysid together with sysid")
sys.exit(1)
# magically determine vehicle type (if required):
if cmd_opts.vehicle is None:
cwd = os.getcwd()