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
@@ -41,6 +41,8 @@
using namespace time_literals;
ModuleBase::Descriptor VTX::desc{task_spawn, custom_command, print_usage};
VTX::VTX(const char *device) :
ModuleParams(nullptr),
ScheduledWorkItem(MODULE_NAME, px4::serial_port_to_wq(device)),
@@ -99,7 +101,7 @@ void VTX::Run()
static constexpr auto _INTERVAL{50_ms};
if (should_exit()) {
exit_and_cleanup();
exit_and_cleanup(desc);
return;
}
@@ -338,7 +340,7 @@ void VTX::handle_uorb()
int VTX::custom_command(int argc, char *argv[])
{
if (!strcmp(argv[0], "start")) {
if (is_running()) {
if (is_running(desc)) {
return print_usage("already running");
}
@@ -349,7 +351,7 @@ int VTX::custom_command(int argc, char *argv[])
}
}
if (!is_running()) {
if (!is_running(desc)) {
return print_usage("not running");
}
@@ -393,8 +395,8 @@ int VTX::task_spawn(int argc, char *argv[])
return PX4_ERROR;
}
_object.store(instance);
_task_id = task_id_is_work_queue;
desc.object.store(instance);
desc.task_id = task_id_is_work_queue;
instance->ScheduleNow();
@@ -478,5 +480,5 @@ Supported protocols are:
extern "C" __EXPORT int vtx_main(int argc, char *argv[])
{
return VTX::main(argc, argv);
return ModuleBase::main(VTX::desc, argc, argv);
}
+3 -1
View File
@@ -56,10 +56,12 @@
/**
* @author Niklas Hauser <niklas@auterion.com>
*/
class VTX : public ModuleBase<VTX>, public ModuleParams, public px4::ScheduledWorkItem
class VTX : public ModuleBase, public ModuleParams, public px4::ScheduledWorkItem
{
public:
static Descriptor desc;
VTX(const char *device);
virtual ~VTX();