From 873e036e85e2c0919d8938545d4caa55884dcbca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Mon, 14 May 2018 20:05:29 +0200 Subject: [PATCH] px_romfs_pruner: reduce multiple consecutive spaces into a single space for mixers (#9457) Reduces FLASH usage by about 3kb. Plus add a missing cmake dependency. --- ROMFS/CMakeLists.txt | 1 + Tools/px_romfs_pruner.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ROMFS/CMakeLists.txt b/ROMFS/CMakeLists.txt index 38d646e5bb..ec6a3d992c 100644 --- a/ROMFS/CMakeLists.txt +++ b/ROMFS/CMakeLists.txt @@ -81,6 +81,7 @@ add_custom_command(OUTPUT ${romfs_temp_dir}/init.d/rcS ${romfs_temp_dir}/init.d/ --folder ${romfs_temp_dir} --board ${BOARD} DEPENDS ${config_romfs_files_list} + ${PX4_SOURCE_DIR}/Tools/px_romfs_pruner.py ${PX4_SOURCE_DIR}/ROMFS/${config_romfs_root}/init.d/rcS ${PX4_SOURCE_DIR}/Tools/px_process_airframes.py ) diff --git a/Tools/px_romfs_pruner.py b/Tools/px_romfs_pruner.py index c8ac842ee9..1b2518719f 100644 --- a/Tools/px_romfs_pruner.py +++ b/Tools/px_romfs_pruner.py @@ -95,7 +95,9 @@ def main(): # handle mixer files differently than startup files if file_path.endswith(".mix"): if line.startswith(("Z:", "M:", "R: ", "O:", "S:", "H:", "T:", "P:")): - pruned_content += line + # reduce multiple consecutive spaces into a single space + line_reduced = re.sub(' +', ' ', line) + pruned_content += line_reduced else: if not line.isspace() \ and not line.strip().startswith("#"):