mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 02:55:07 +08:00
boards: cuav_x25-super: migrate core_heater to new ModuleBase API
The core_heater driver was written against the old CRTP ModuleBase<T>
pattern which was removed in ce3e62841f. Replace with the
descriptor-based API matching src/drivers/heater/.
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
This commit is contained in:
@@ -47,6 +47,8 @@
|
|||||||
# error "To use the heater driver, the board_config.h must define and initialize GPIO_CORE_HEATER_OUTPUT"
|
# error "To use the heater driver, the board_config.h must define and initialize GPIO_CORE_HEATER_OUTPUT"
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
ModuleBase::Descriptor Core_Heater::desc{task_spawn, custom_command, print_usage};
|
||||||
|
|
||||||
Core_Heater::Core_Heater() :
|
Core_Heater::Core_Heater() :
|
||||||
ModuleParams(nullptr),
|
ModuleParams(nullptr),
|
||||||
ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::lp_default)
|
ScheduledWorkItem(MODULE_NAME, px4::wq_configurations::lp_default)
|
||||||
@@ -62,7 +64,7 @@ Core_Heater::~Core_Heater()
|
|||||||
int Core_Heater::custom_command(int argc, char *argv[])
|
int Core_Heater::custom_command(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
// Check if the driver is running.
|
// Check if the driver is running.
|
||||||
if (!is_running()) {
|
if (!is_running(desc)) {
|
||||||
PX4_INFO("not running");
|
PX4_INFO("not running");
|
||||||
return PX4_ERROR;
|
return PX4_ERROR;
|
||||||
}
|
}
|
||||||
@@ -117,7 +119,7 @@ bool Core_Heater::initialize_topics()
|
|||||||
void Core_Heater::Run()
|
void Core_Heater::Run()
|
||||||
{
|
{
|
||||||
if (should_exit()) {
|
if (should_exit()) {
|
||||||
exit_and_cleanup();
|
exit_and_cleanup(desc);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,8 +218,8 @@ int Core_Heater::task_spawn(int argc, char *argv[])
|
|||||||
return PX4_ERROR;
|
return PX4_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
_object.store(core_heater);
|
desc.object.store(core_heater);
|
||||||
_task_id = task_id_is_work_queue;
|
desc.task_id = task_id_is_work_queue;
|
||||||
|
|
||||||
core_heater->start();
|
core_heater->start();
|
||||||
return 0;
|
return 0;
|
||||||
@@ -257,5 +259,5 @@ Background process running periodically on the LP work queue to regulate IMU tem
|
|||||||
|
|
||||||
extern "C" __EXPORT int core_heater_main(int argc, char *argv[])
|
extern "C" __EXPORT int core_heater_main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
return Core_Heater::main(argc, argv);
|
return ModuleBase::main(Core_Heater::desc, argc, argv);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -56,9 +56,10 @@ using namespace time_literals;
|
|||||||
#define CONTROLLER_PERIOD_DEFAULT 10000
|
#define CONTROLLER_PERIOD_DEFAULT 10000
|
||||||
#define TEMPERATURE_TARGET_THRESHOLD 2.5f
|
#define TEMPERATURE_TARGET_THRESHOLD 2.5f
|
||||||
|
|
||||||
class Core_Heater : public ModuleBase<Core_Heater>, public ModuleParams, public px4::ScheduledWorkItem
|
class Core_Heater : public ModuleBase, public ModuleParams, public px4::ScheduledWorkItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
static Descriptor desc;
|
||||||
Core_Heater();
|
Core_Heater();
|
||||||
|
|
||||||
virtual ~Core_Heater();
|
virtual ~Core_Heater();
|
||||||
|
|||||||
Reference in New Issue
Block a user