diff --git a/src/templates/template_module/template_module.cpp b/src/templates/template_module/template_module.cpp index ef185cfe2e..c528ebd3c3 100644 --- a/src/templates/template_module/template_module.cpp +++ b/src/templates/template_module/template_module.cpp @@ -40,6 +40,7 @@ #include #include +ModuleBase::Descriptor TemplateModule::desc{task_spawn, custom_command, print_usage}; int TemplateModule::print_status() { @@ -52,14 +53,14 @@ int TemplateModule::print_status() int TemplateModule::custom_command(int argc, char *argv[]) { /* - if (!is_running()) { + if (!is_running(desc)) { print_usage("not running"); return 1; } // additional custom commands can be handled like this: if (!strcmp(argv[0], "do-something")) { - get_instance()->do_something(); + get_instance(desc)->do_something(); return 0; } */ diff --git a/src/templates/template_module/template_module.h b/src/templates/template_module/template_module.h index a6f51d6cb0..017a60922d 100644 --- a/src/templates/template_module/template_module.h +++ b/src/templates/template_module/template_module.h @@ -43,9 +43,11 @@ using namespace time_literals; extern "C" __EXPORT int template_module_main(int argc, char *argv[]); -class TemplateModule : public ModuleBase, public ModuleParams +class TemplateModule : public ModuleBase, public ModuleParams { public: + static Descriptor desc; + TemplateModule(int example_param, bool example_flag); virtual ~TemplateModule() = default;