Commit Graph
3 Commits
Author SHA1 Message Date
Jacob DahlandBalduin 5535d849a2 refactor(platform): out-line the ModuleParams constructor to save flash (#29545)
The constructor was defined in the header, so every one of the ~150
module and library classes deriving from ModuleParams expanded it into
its own constructor: the ListNode and child-list initialisation plus
the setParent() call, repeated per class.

Moving the body next to setParent() in module_params.cpp leaves a single
call at each site. px4_fmu-v6x_default: 1934288 -> 1932520 bytes of
text, -1768 B.

Assisted-by: Claude:claude-fable-5-1

Co-authored-by: Balduin <balduin@auterion.com>
2026-10-31 11:43:01 -06:00
Jacob DahlandBalduin 9c1e218b1f refactor(platform): out-line ModuleParams::updateParams() to save flash (#29543)
The base implementation, which walks the child list and then calls
updateParamsImpl(), was defined in the class body. Every module that
calls updateParams() on a parameter update therefore inlined the list
walk. Define it in module_params.cpp next to setParent().

px4_fmu-v6x_default: 1917160 -> 1915056 bytes of text, -2104 B.

Assisted-by: Claude:claude-fable-5-1

Co-authored-by: Balduin <balduin@auterion.com>
2026-10-31 11:42:34 -06:00
Jacob DahlandBalduin 6c53460f2e refactor(platform): out-line ModuleParams setParent and destructor to save flash (#28321)
Both were defined inline in the header, so the List add/remove bodies
were duplicated into the constructor and destructor of every one of the
150+ ModuleParams-derived classes. Construction and destruction are cold
paths; a call is smaller at each site.

Two consumers reach ModuleParams without px4_platform on the link line
and now need the definitions explicitly: health_and_arming_checks (the
functional-ModeManagement test only pulls it in transitively through
modules__commander, after px4_platform) and the failsafe_web emscripten
build, which compiles module_params.cpp directly.

The smaller constructors let the compiler fully inline the defaulted
FlightTaskDescend constructor on the ITCM boards, so its entry is
dropped from their linker scripts.

Saves 3968 B of .text on px4_fmu-v6x_default.


Assisted-by: Claude:claude-fable-5

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
Co-authored-by: Balduin <balduin@auterion.com>
2026-08-21 10:34:09 -06:00