refactor(modes): deduplicate nav_state_names table across translation units

nav_state_names is a namespace-scope const array defined in a header,
which gives it internal linkage: every translation unit including
ui.hpp carried its own copy of the 124-byte pointer table. Declare it
inline (C++17) so the linker keeps a single shared instance.

px4_fmu-v6x_default flash: -376 B
This commit is contained in:
Balduin
2026-08-31 13:53:37 +02:00
committed by Balduin
parent 8a2391730f
commit a0a0ebf69e

View File

@@ -69,7 +69,9 @@ static inline uint32_t getValidNavStates()
static_assert(vehicle_status_s::NAVIGATION_STATE_MAX == 31, "update valid nav states");
}
const char *const nav_state_names[vehicle_status_s::NAVIGATION_STATE_MAX] = {
// inline: this header is included from several translation units, and a namespace-scope const
// array has internal linkage, so without it each of them gets its own copy of the table
inline const char *const nav_state_names[vehicle_status_s::NAVIGATION_STATE_MAX] = {
"Manual",
"Altitude",
"Position",