mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-28 07:13:34 +08:00
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:
@@ -35,6 +35,8 @@
|
||||
|
||||
using namespace time_literals;
|
||||
|
||||
ModuleBase::Descriptor RoverMecanum::desc{task_spawn, custom_command, print_usage};
|
||||
|
||||
RoverMecanum::RoverMecanum() :
|
||||
ModuleParams(nullptr),
|
||||
ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::rate_ctrl)
|
||||
@@ -195,8 +197,8 @@ int RoverMecanum::task_spawn(int argc, char *argv[])
|
||||
RoverMecanum *instance = new RoverMecanum();
|
||||
|
||||
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;
|
||||
@@ -207,8 +209,8 @@ int RoverMecanum::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;
|
||||
}
|
||||
@@ -238,5 +240,5 @@ Rover mecanum module.
|
||||
|
||||
extern "C" __EXPORT int rover_mecanum_main(int argc, char *argv[])
|
||||
{
|
||||
return RoverMecanum::main(argc, argv);
|
||||
return ModuleBase::main(RoverMecanum::desc, argc, argv);
|
||||
}
|
||||
|
||||
@@ -59,10 +59,12 @@
|
||||
#include "MecanumDriveModes/MecanumManualMode/MecanumManualMode.hpp"
|
||||
#include "MecanumDriveModes/MecanumOffboardMode/MecanumOffboardMode.hpp"
|
||||
|
||||
class RoverMecanum : public ModuleBase<RoverMecanum>, public ModuleParams,
|
||||
class RoverMecanum : public ModuleBase, public ModuleParams,
|
||||
public px4::ScheduledWorkItem
|
||||
{
|
||||
public:
|
||||
static Descriptor desc;
|
||||
|
||||
/**
|
||||
* @brief Constructor for RoverMecanum
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user