From e914a08fe87495740cf160330cd799d8eaeab851 Mon Sep 17 00:00:00 2001 From: Bob Long Date: Wed, 26 Jun 2024 15:17:33 +1000 Subject: [PATCH] waf: process Cx SITL defaults on configure SW-241 --- .../Carbonix_scripts/process_sitl_defaults.py | 3 +++ wscript | 20 +++++++++++++++++++ 2 files changed, 23 insertions(+) mode change 100644 => 100755 Tools/Carbonix_scripts/process_sitl_defaults.py diff --git a/Tools/Carbonix_scripts/process_sitl_defaults.py b/Tools/Carbonix_scripts/process_sitl_defaults.py old mode 100644 new mode 100755 index a63497e9ae..f18eb90417 --- a/Tools/Carbonix_scripts/process_sitl_defaults.py +++ b/Tools/Carbonix_scripts/process_sitl_defaults.py @@ -1,3 +1,6 @@ +#!/usr/bin/env python +# encoding: utf-8 + ''' Build SITL default parameter files for use with SITL launcher ''' diff --git a/wscript b/wscript index bed6994a8c..6dda03fd86 100644 --- a/wscript +++ b/wscript @@ -400,6 +400,26 @@ def configure(cfg): if cfg.options.board is None: cfg.options.board = 'sitl' + if cfg.options.board == 'sitl': + # Loop through all .parm files in libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/sitl_params/ + param_folder = 'libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/sitl_params/' + for file in os.listdir(param_folder): + if not file.endswith('.parm'): + continue + + # make build/sitl directory if it doesn't exist + if not os.path.exists('build'): + os.makedirs('build') + if not os.path.exists('build/sitl'): + os.makedirs('build/sitl') + + in_file = os.path.join(param_folder, file) + out_file = os.path.join('build/sitl', file) + + # Call Tools/Carbonix_scripts/process_sitl_defaults.py $in_file $out_file + cfg.msg('Processing default parameters', file) + subprocess.run(['Tools/Carbonix_scripts/process_sitl_defaults.py', in_file, out_file]) + boards_names = boards.get_boards_names() if not cfg.options.board in boards_names: for b in boards_names: