mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-01 19:14:06 +08:00
boards v6x: save FLASH by removing param longDesc from parameters.json
This commit is contained in:
parent
073013cf85
commit
8447a8d75e
5
Kconfig
5
Kconfig
@ -100,6 +100,11 @@ menu "Toolchain"
|
||||
help
|
||||
flag to enable constrained memory options (eg limit maximum number of uORB publications)
|
||||
|
||||
config BOARD_PARAM_REMOVE_LONGDESC
|
||||
bool "Remove parameter long description from JSON"
|
||||
help
|
||||
flag to remove parameter long descriptions from the JSON output
|
||||
|
||||
config BOARD_EXTERNAL_METADATA
|
||||
bool "External metadata"
|
||||
help
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
CONFIG_BOARD_TOOLCHAIN="arm-none-eabi"
|
||||
CONFIG_BOARD_ARCHITECTURE="cortex-m7"
|
||||
CONFIG_BOARD_ETHERNET=y
|
||||
CONFIG_BOARD_PARAM_REMOVE_LONGDESC=y
|
||||
CONFIG_BOARD_SERIAL_GPS1="/dev/ttyS0"
|
||||
CONFIG_BOARD_SERIAL_GPS2="/dev/ttyS7"
|
||||
CONFIG_BOARD_SERIAL_TEL1="/dev/ttyS6"
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
CONFIG_BOARD_TOOLCHAIN="arm-none-eabi"
|
||||
CONFIG_BOARD_ARCHITECTURE="cortex-m7"
|
||||
CONFIG_BOARD_ETHERNET=y
|
||||
CONFIG_BOARD_PARAM_REMOVE_LONGDESC=y
|
||||
CONFIG_BOARD_SERIAL_GPS1="/dev/ttyS0"
|
||||
CONFIG_BOARD_SERIAL_GPS2="/dev/ttyS7"
|
||||
CONFIG_BOARD_SERIAL_TEL1="/dev/ttyS6"
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
CONFIG_BOARD_TOOLCHAIN="arm-none-eabi"
|
||||
CONFIG_BOARD_ARCHITECTURE="cortex-m7"
|
||||
CONFIG_BOARD_ETHERNET=y
|
||||
CONFIG_BOARD_PARAM_REMOVE_LONGDESC=y
|
||||
CONFIG_BOARD_SERIAL_GPS1="/dev/ttyS1"
|
||||
CONFIG_BOARD_SERIAL_GPS2="/dev/ttyS3"
|
||||
CONFIG_BOARD_SERIAL_TEL1="/dev/ttyS2"
|
||||
|
||||
@ -368,6 +368,12 @@ if(EXISTS ${BOARD_DEFCONFIG})
|
||||
add_definitions(-DCONSTRAINED_MEMORY)
|
||||
endif()
|
||||
|
||||
set(config_process_params_extra_flags "" CACHE INTERNAL "process params command extra flags" FORCE)
|
||||
|
||||
if(PARAM_REMOVE_LONGDESC)
|
||||
set(config_process_params_extra_flags "--no-long-desc" CACHE INTERNAL "process params command extra flags" FORCE)
|
||||
endif()
|
||||
|
||||
if(TESTING)
|
||||
set(PX4_TESTING "1" CACHE INTERNAL "testing enabled" FORCE)
|
||||
endif()
|
||||
|
||||
@ -78,7 +78,7 @@ add_custom_target(metadata_parameters
|
||||
--src-path `find ${PX4_SOURCE_DIR}/src -maxdepth 4 -type d` ${generated_params_dir}
|
||||
--inject-xml ${PX4_SOURCE_DIR}/src/lib/parameters/parameters_injected.xml
|
||||
--json ${PX4_BINARY_DIR}/docs/parameters.json
|
||||
--compress
|
||||
--compress ${config_process_params_extra_flags}
|
||||
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/src/lib/parameters/px_process_params.py
|
||||
--src-path `find ${PX4_SOURCE_DIR}/src -maxdepth 4 -type d` ${generated_params_dir}
|
||||
|
||||
@ -126,6 +126,7 @@ add_custom_command(OUTPUT ${parameters_xml} ${parameters_json} ${parameters_json
|
||||
--inject-xml ${CMAKE_CURRENT_SOURCE_DIR}/parameters_injected.xml
|
||||
--overrides ${PARAM_DEFAULT_OVERRIDES}
|
||||
--board ${PX4_BOARD}
|
||||
${config_process_params_extra_flags}
|
||||
#--verbose
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${PX4_SOURCE_DIR}/Tools/validate_json.py
|
||||
--schema-file ${PX4_SOURCE_DIR}/src/modules/mavlink/mavlink/component_information/parameter.schema.json
|
||||
@ -161,7 +162,7 @@ add_custom_target(parameters_header DEPENDS px4_parameters.hpp)
|
||||
set(SRCS)
|
||||
|
||||
list(APPEND SRCS
|
||||
parameters.cpp
|
||||
parameters.cpp
|
||||
atomic_transaction.cpp
|
||||
autosave.cpp
|
||||
)
|
||||
|
||||
@ -5,7 +5,7 @@ import sys
|
||||
|
||||
|
||||
class JsonOutput():
|
||||
def __init__(self, groups, board, inject_xml_file_name):
|
||||
def __init__(self, groups, board, ignored_codes=[]):
|
||||
all_json=dict()
|
||||
all_json['version']=1
|
||||
all_params=[]
|
||||
@ -38,19 +38,19 @@ class JsonOutput():
|
||||
}
|
||||
|
||||
schema_map = {
|
||||
"short_desc": "shortDesc",
|
||||
"long_desc": "longDesc",
|
||||
"unit": "units",
|
||||
}
|
||||
"short_desc": "shortDesc",
|
||||
"long_desc": "longDesc",
|
||||
"unit": "units",
|
||||
}
|
||||
schema_map_typed = {
|
||||
"min": "min",
|
||||
"max": "max",
|
||||
"increment": "increment",
|
||||
}
|
||||
"min": "min",
|
||||
"max": "max",
|
||||
"increment": "increment",
|
||||
}
|
||||
schema_map_fix_type = {
|
||||
"reboot_required": ("rebootRequired", bool),
|
||||
"decimal": ("decimalPlaces", int),
|
||||
}
|
||||
"reboot_required": ("rebootRequired", bool),
|
||||
"decimal": ("decimalPlaces", int),
|
||||
}
|
||||
allowed_types = { "Uint8", "Int8", "Uint16", "Int16", "Uint32", "Int32", "Float"}
|
||||
|
||||
last_param_name = ""
|
||||
@ -86,6 +86,10 @@ class JsonOutput():
|
||||
last_param_name = param.GetName()
|
||||
for code in param.GetFieldCodes():
|
||||
value = param.GetFieldValue(code)
|
||||
# skip ignored codes
|
||||
if code in ignored_codes:
|
||||
continue
|
||||
|
||||
if code == "board":
|
||||
if value == board:
|
||||
board_specific_param_set = True
|
||||
|
||||
@ -108,6 +108,9 @@ def main():
|
||||
default="{}",
|
||||
metavar="OVERRIDES",
|
||||
help="a dict of overrides in the form of a json string")
|
||||
parser.add_argument("-nl", "--no-long-desc",
|
||||
action='store_true',
|
||||
help="remove long parameter descriptions from the JSON output")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
@ -171,11 +174,13 @@ def main():
|
||||
|
||||
# Output to JSON file
|
||||
if args.json:
|
||||
ignored_codes = []
|
||||
if args.verbose:
|
||||
print("Creating Json file " + args.json)
|
||||
if args.no_long_desc:
|
||||
ignored_codes.append('long_desc')
|
||||
cur_dir = os.path.dirname(os.path.realpath(__file__))
|
||||
out = jsonout.JsonOutput(param_groups, args.board,
|
||||
os.path.join(cur_dir, args.inject_xml))
|
||||
out = jsonout.JsonOutput(param_groups, args.board, ignored_codes)
|
||||
out.Save(args.json)
|
||||
output_files.append(args.json)
|
||||
|
||||
@ -184,7 +189,7 @@ def main():
|
||||
if args.verbose:
|
||||
print("Compressing file " + f)
|
||||
save_compressed(f)
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user