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
@@ -44,6 +44,8 @@
using namespace time_literals;
ModuleBase::Descriptor CrsfRc::desc{task_spawn, custom_command, print_usage};
#define CRSF_BAUDRATE 420000
CrsfRc::CrsfRc(const char *device) :
@@ -109,8 +111,8 @@ int CrsfRc::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();
@@ -128,7 +130,7 @@ void CrsfRc::Run()
_uart = nullptr;
}
exit_and_cleanup();
exit_and_cleanup(desc);
return;
}
@@ -548,7 +550,7 @@ int CrsfRc::custom_command(int argc, char *argv[])
#ifdef CONFIG_RC_CRSF_INJECT
if (!strcmp(argv[0], "start")) {
if (is_running()) {
if (is_running(desc)) {
return print_usage("already running");
}
@@ -559,7 +561,7 @@ int CrsfRc::custom_command(int argc, char *argv[])
}
}
if (!is_running()) {
if (!is_running(desc)) {
return print_usage("not running");
}
@@ -612,5 +614,5 @@ This module parses the CRSF RC uplink protocol and generates CRSF downlink telem
extern "C" __EXPORT int crsf_rc_main(int argc, char *argv[])
{
return CrsfRc::main(argc, argv);
return ModuleBase::main(CrsfRc::desc, argc, argv);
}
+3 -1
View File
@@ -56,9 +56,11 @@
using namespace device;
class CrsfRc : public ModuleBase<CrsfRc>, public ModuleParams, public px4::ScheduledWorkItem
class CrsfRc : public ModuleBase, public ModuleParams, public px4::ScheduledWorkItem
{
public:
static Descriptor desc;
CrsfRc(const char *device);
~CrsfRc() override;