mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-09 22:08:56 +08:00
fix(param): use C-style array for parameters_volatile/readonly
NuttX builds do not provide the C++17 <array> header, so the generated
px4_parameters.hpp failed to compile on every NuttX board (px4_fmu-v5,
nxp_fmuk66-v3, modalai voxl2 SLPI, etc.) with:
fatal error: array: No such file or directory
Drop std::array in favour of plain C arrays, which range-based for
already supports and which the embedded toolchains can compile. The
length is no longer needed in the type because the generator now
pre-filters volatile_params and readonly_param_names, and an empty
array would have been ill-formed under either spelling.
Signed-off-by: Nuno Marques <n.marques21@hotmail.com>
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
|
||||
#include <math.h> // NAN
|
||||
|
||||
#include <array>
|
||||
#include <stdint.h>
|
||||
#include <parameters/param.h>
|
||||
|
||||
@@ -39,13 +38,13 @@ static constexpr param_type_t parameters_type[] = {
|
||||
{%- endfor -%}
|
||||
};
|
||||
|
||||
static constexpr std::array<params, {{ volatile_params | length }}> parameters_volatile {
|
||||
static constexpr params parameters_volatile[] = {
|
||||
{% for param in volatile_params %}
|
||||
params::{{ param.attrib["name"] }},
|
||||
{% endfor %}
|
||||
};
|
||||
|
||||
static constexpr std::array<params, {{ readonly_param_names | length }}> parameters_readonly {
|
||||
static constexpr params parameters_readonly[] = {
|
||||
{% for param_name in readonly_param_names %}
|
||||
params::{{ param_name }},
|
||||
{% endfor %}
|
||||
|
||||
Reference in New Issue
Block a user