Skip to content

Commit

Permalink
hwdef: Parse parameters and detect defined defaults correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
joshanne committed Sep 3, 2024
1 parent 468aaec commit 8472a50
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions libraries/AP_HAL_ChibiOS/hwdef/scripts/chibios_hwdef.py
Original file line number Diff line number Diff line change
Expand Up @@ -2889,12 +2889,14 @@ def get_processed_defaults_file(self, defaults_filepath, depth=0):
def write_processed_defaults_file(self, filepath):
# see if board has a defaults.parm file or a --default-parameters file was specified
defaults_filename = os.path.join(os.path.dirname(self.hwdef[0]), 'defaults.parm')
defaults_path = os.path.join(os.path.dirname(self.hwdef[0]), args.params)

defaults_abspath = None
if os.path.exists(defaults_path):
defaults_abspath = os.path.abspath(self.default_params_filepath)
self.progress("Default parameters path from command line: %s" % self.default_params_filepath)
if isinstance(self.default_params_filepath, str):
defaults_path = os.path.join(os.path.dirname(self.hwdef[0]), self.default_params_filepath)
if not os.path.exists(defaults_path):
self.error(f"Specified defaults file not found at path {defaults_path}")

defaults_abspath = os.path.abspath(defaults_path)
self.progress("Default parameters path from command line: %s" % defaults_path)
elif os.path.exists(defaults_filename):
defaults_abspath = os.path.abspath(defaults_filename)
self.progress("Default parameters path from hwdef: %s" % defaults_filename)
Expand Down

0 comments on commit 8472a50

Please sign in to comment.