module_base: remove CRTP template pattern to reduce flash bloat (#26476)

* module_base: claude rewrite to remove CRTP bloat

* module_base: apply to all drivers/modules

* format

* fix build errors

* fix missing syntax

* remove reference to module.h in files that need module_base.h

* remove old ModuleBase<T>

* add module_base.cpp to px4_protected_layers.cmake

* fix IridiumSBD can_stop()

* fix IridiumSBD.cpp

* clang-tidy: downcast static cast

* get_instance() template accessor, revert clang-tidy global

* rename module_base.h to module.h

* revert changes in zenoh/Kconfig.topics
This commit is contained in:
Jacob Dahl
2026-02-19 15:17:17 +13:00
committed by GitHub
parent 657854ae1b
commit ce3e62841f
227 changed files with 1741 additions and 1496 deletions
@@ -33,6 +33,8 @@
#include "NavioRGBLed.hpp"
ModuleBase::Descriptor NavioRGBLed::desc{task_spawn, custom_command, print_usage};
NavioRGBLed::NavioRGBLed() :
ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::lp_default)
{
@@ -130,8 +132,8 @@ int NavioRGBLed::task_spawn(int argc, char *argv[])
NavioRGBLed *instance = new NavioRGBLed();
if (instance) {
_object.store(instance);
_task_id = task_id_is_work_queue;
desc.object.store(instance);
desc.task_id = task_id_is_work_queue;
if (instance->init() == PX4_OK) {
return PX4_OK;
@@ -142,8 +144,8 @@ int NavioRGBLed::task_spawn(int argc, char *argv[])
}
delete instance;
_object.store(nullptr);
_task_id = -1;
desc.object.store(nullptr);
desc.task_id = -1;
return PX4_ERROR;
}
@@ -170,5 +172,5 @@ Emlid Navio2 RGB LED driver.
extern "C" __EXPORT int navio_rgbled_main(int argc, char *argv[])
{
return NavioRGBLed::main(argc, argv);
return ModuleBase::main(NavioRGBLed::desc, argc, argv);
}
@@ -40,9 +40,11 @@
#include <lib/led/led.h>
class NavioRGBLed : public ModuleBase<NavioRGBLed>, public px4::ScheduledWorkItem
class NavioRGBLed : public ModuleBase, public px4::ScheduledWorkItem
{
public:
static Descriptor desc;
NavioRGBLed();
~NavioRGBLed() override;