mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
module template: update to use the new Param classes
This commit is contained in:
parent
0d26aeafe2
commit
523bb11577
@ -162,8 +162,7 @@ Module *Module::instantiate(int argc, char *argv[])
|
||||
}
|
||||
|
||||
Module::Module(int example_param, bool example_flag)
|
||||
: SuperBlock(nullptr, "MOD"),
|
||||
_sys_autostart(this, "SYS_AUTOSTART", false)
|
||||
: ModuleParams(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -34,13 +34,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <px4_module.h>
|
||||
#include <controllib/blocks.hpp>
|
||||
#include <controllib/block/BlockParam.hpp>
|
||||
#include <px4_module_params.h>
|
||||
|
||||
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:
|
||||
Module(int example_param, bool example_flag);
|
||||
@ -75,6 +74,9 @@ private:
|
||||
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 */
|
||||
)
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user