mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-20 02:03:34 +08:00
module template: update to use the new Param classes
This commit is contained in:
@@ -162,8 +162,7 @@ Module *Module::instantiate(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
Module::Module(int example_param, bool example_flag)
|
Module::Module(int example_param, bool example_flag)
|
||||||
: SuperBlock(nullptr, "MOD"),
|
: ModuleParams(nullptr)
|
||||||
_sys_autostart(this, "SYS_AUTOSTART", false)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,13 +34,12 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <px4_module.h>
|
#include <px4_module.h>
|
||||||
#include <controllib/blocks.hpp>
|
#include <px4_module_params.h>
|
||||||
#include <controllib/block/BlockParam.hpp>
|
|
||||||
|
|
||||||
extern "C" __EXPORT int module_main(int argc, char *argv[]);
|
extern "C" __EXPORT int module_main(int argc, char *argv[]);
|
||||||
|
|
||||||
|
|
||||||
class Module : public ModuleBase<Module>, public control::SuperBlock
|
class Module : public ModuleBase<Module>, public ModuleParams
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Module(int example_param, bool example_flag);
|
Module(int example_param, bool example_flag);
|
||||||
@@ -75,6 +74,9 @@ private:
|
|||||||
void parameters_update(int parameter_update_sub, bool force = false);
|
void parameters_update(int parameter_update_sub, bool force = false);
|
||||||
|
|
||||||
|
|
||||||
control::BlockParamInt _sys_autostart; /**< example parameter */
|
DEFINE_PARAMETERS(
|
||||||
|
(ParamInt<px4::params::SYS_AUTOSTART>) _sys_autostart, /**< example parameter */
|
||||||
|
(ParamInt<px4::params::SYS_AUTOCONFIG>) _sys_autoconfig /**< another parameter */
|
||||||
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user