autotest: look in parent directories for vehicle type in sim_vehicle.py

this allows eeprom.bin per vehicle type without using -v
This commit is contained in:
Andrew Tridgell 2016-06-24 10:48:24 +10:00
parent 043b1d321d
commit a8e5255b90
1 changed files with 12 additions and 0 deletions

View File

@ -277,6 +277,18 @@ default_frame_for_vehicle = {
"AntennaTracker": "tracker"
}
if not default_frame_for_vehicle.has_key(opts.vehicle):
# try in parent directories, useful for having config in subdirectories
cwd = os.getcwd()
while cwd:
bname = os.path.basename(cwd)
if not bname:
break
if bname in default_frame_for_vehicle:
opts.vehicle = bname
break
cwd = os.path.dirname(cwd)
# try to validate vehicle
if not default_frame_for_vehicle.has_key(opts.vehicle):
progress("** Is (%s) really your vehicle type? Try -v VEHICLETYPE if not, or be in the e.g. ArduCopter subdirectory" % (opts.vehicle,))