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-18 17:17:17 -09:00
committed by GitHub
parent 657854ae1b
commit ce3e62841f
227 changed files with 1741 additions and 1496 deletions
@@ -49,6 +49,8 @@
using namespace matrix;
using namespace time_literals;
ModuleBase::Descriptor ControlAllocator::desc{task_spawn, custom_command, print_usage};
ControlAllocator::ControlAllocator() :
ModuleParams(nullptr),
ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::rate_ctrl),
@@ -306,7 +308,7 @@ ControlAllocator::Run()
{
if (should_exit()) {
_vehicle_torque_setpoint_sub.unregisterCallback();
exit_and_cleanup();
exit_and_cleanup(desc);
return;
}
@@ -818,8 +820,8 @@ int ControlAllocator::task_spawn(int argc, char *argv[])
ControlAllocator *instance = new ControlAllocator();
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;
@@ -830,8 +832,8 @@ int ControlAllocator::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;
}
@@ -1021,5 +1023,5 @@ extern "C" __EXPORT int control_allocator_main(int argc, char *argv[]);
int control_allocator_main(int argc, char *argv[])
{
return ControlAllocator::main(argc, argv);
return ModuleBase::main(ControlAllocator::desc, argc, argv);
}
@@ -80,9 +80,11 @@
#include <uORB/topics/vehicle_status.h>
#include <uORB/topics/failure_detector_status.h>
class ControlAllocator : public ModuleBase<ControlAllocator>, public ModuleParams, public px4::ScheduledWorkItem
class ControlAllocator : public ModuleBase, public ModuleParams, public px4::ScheduledWorkItem
{
public:
static Descriptor desc;
static constexpr int NUM_ACTUATORS = ControlAllocation::NUM_ACTUATORS;
static constexpr int NUM_AXES = ControlAllocation::NUM_AXES;