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
+8 -6
View File
@@ -35,6 +35,8 @@
using namespace time_literals;
ModuleBase::Descriptor FakeImu::desc{task_spawn, custom_command, print_usage};
FakeImu::FakeImu() :
ModuleParams(nullptr),
ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::hp_default),
@@ -60,7 +62,7 @@ void FakeImu::Run()
{
if (should_exit()) {
ScheduleClear();
exit_and_cleanup();
exit_and_cleanup(desc);
return;
}
@@ -168,8 +170,8 @@ int FakeImu::task_spawn(int argc, char *argv[])
FakeImu *instance = new FakeImu();
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()) {
return PX4_OK;
@@ -180,8 +182,8 @@ int FakeImu::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;
}
@@ -211,5 +213,5 @@ int FakeImu::print_usage(const char *reason)
extern "C" __EXPORT int fake_imu_main(int argc, char *argv[])
{
return FakeImu::main(argc, argv);
return ModuleBase::main(FakeImu::desc, argc, argv);
}
+3 -1
View File
@@ -51,9 +51,11 @@
# include <uORB/topics/esc_status.h>
#endif // FAKE_IMU_FAKE_ESC_STATUS
class FakeImu : public ModuleBase<FakeImu>, public ModuleParams, public px4::ScheduledWorkItem
class FakeImu : public ModuleBase, public ModuleParams, public px4::ScheduledWorkItem
{
public:
static Descriptor desc;
FakeImu();
~FakeImu() override = default;