From 2128679ab3e4ba888cc3f8b1cb9b00a398847cc5 Mon Sep 17 00:00:00 2001 From: CarlOlsson Date: Thu, 10 Sep 2020 14:41:58 +0200 Subject: [PATCH] rename templates/module to templates/template_module --- .../CMakeLists.txt | 6 ++--- .../template_module.cpp} | 24 +++++++++---------- .../template_module.h} | 10 ++++---- 3 files changed, 20 insertions(+), 20 deletions(-) rename src/templates/{module => template_module}/CMakeLists.txt (95%) rename src/templates/{module/module.cpp => template_module/template_module.cpp} (89%) rename src/templates/{module/module.h => template_module/template_module.h} (90%) diff --git a/src/templates/module/CMakeLists.txt b/src/templates/template_module/CMakeLists.txt similarity index 95% rename from src/templates/module/CMakeLists.txt rename to src/templates/template_module/CMakeLists.txt index 876988238b..19e9e5d313 100644 --- a/src/templates/module/CMakeLists.txt +++ b/src/templates/template_module/CMakeLists.txt @@ -32,10 +32,10 @@ ############################################################################ px4_add_module( - MODULE templates__module - MAIN module + MODULE templates__template_module + MAIN template_module SRCS - module.cpp + template_module.cpp DEPENDS modules__uORB ) diff --git a/src/templates/module/module.cpp b/src/templates/template_module/template_module.cpp similarity index 89% rename from src/templates/module/module.cpp rename to src/templates/template_module/template_module.cpp index 0c56ea54ec..ad087d40ea 100644 --- a/src/templates/module/module.cpp +++ b/src/templates/template_module/template_module.cpp @@ -31,7 +31,7 @@ * ****************************************************************************/ -#include "module.h" +#include "template_module.h" #include #include @@ -41,7 +41,7 @@ #include -int Module::print_status() +int TemplateModule::print_status() { PX4_INFO("Running"); // TODO: print additional runtime information about the state of the module @@ -49,7 +49,7 @@ int Module::print_status() return 0; } -int Module::custom_command(int argc, char *argv[]) +int TemplateModule::custom_command(int argc, char *argv[]) { /* if (!is_running()) { @@ -68,7 +68,7 @@ int Module::custom_command(int argc, char *argv[]) } -int Module::task_spawn(int argc, char *argv[]) +int TemplateModule::task_spawn(int argc, char *argv[]) { _task_id = px4_task_spawn_cmd("module", SCHED_DEFAULT, @@ -85,7 +85,7 @@ int Module::task_spawn(int argc, char *argv[]) return 0; } -Module *Module::instantiate(int argc, char *argv[]) +TemplateModule *TemplateModule::instantiate(int argc, char *argv[]) { int example_param = 0; bool example_flag = false; @@ -121,7 +121,7 @@ Module *Module::instantiate(int argc, char *argv[]) return nullptr; } - Module *instance = new Module(example_param, example_flag); + TemplateModule *instance = new TemplateModule(example_param, example_flag); if (instance == nullptr) { PX4_ERR("alloc failed"); @@ -130,12 +130,12 @@ Module *Module::instantiate(int argc, char *argv[]) return instance; } -Module::Module(int example_param, bool example_flag) +TemplateModule::TemplateModule(int example_param, bool example_flag) : ModuleParams(nullptr) { } -void Module::run() +void TemplateModule::run() { // Example: run the loop synchronized to the sensor_combined topic publication int sensor_combined_sub = orb_subscribe(ORB_ID(sensor_combined)); @@ -175,7 +175,7 @@ void Module::run() orb_unsubscribe(sensor_combined_sub); } -void Module::parameters_update(bool force) +void TemplateModule::parameters_update(bool force) { // check for parameter updates if (_parameter_update_sub.updated() || force) { @@ -188,7 +188,7 @@ void Module::parameters_update(bool force) } } -int Module::print_usage(const char *reason) +int TemplateModule::print_usage(const char *reason) { if (reason) { PX4_WARN("%s\n", reason); @@ -219,7 +219,7 @@ $ module start -f -p 42 return 0; } -int module_main(int argc, char *argv[]) +int template_module_main(int argc, char *argv[]) { - return Module::main(argc, argv); + return TemplateModule::main(argc, argv); } diff --git a/src/templates/module/module.h b/src/templates/template_module/template_module.h similarity index 90% rename from src/templates/module/module.h rename to src/templates/template_module/template_module.h index 56cea2dad4..909249c7bf 100644 --- a/src/templates/module/module.h +++ b/src/templates/template_module/template_module.h @@ -38,21 +38,21 @@ #include #include -extern "C" __EXPORT int module_main(int argc, char *argv[]); +extern "C" __EXPORT int template_module_main(int argc, char *argv[]); -class Module : public ModuleBase, public ModuleParams +class TemplateModule : public ModuleBase, public ModuleParams { public: - Module(int example_param, bool example_flag); + TemplateModule(int example_param, bool example_flag); - virtual ~Module() = default; + virtual ~TemplateModule() = default; /** @see ModuleBase */ static int task_spawn(int argc, char *argv[]); /** @see ModuleBase */ - static Module *instantiate(int argc, char *argv[]); + static TemplateModule *instantiate(int argc, char *argv[]); /** @see ModuleBase */ static int custom_command(int argc, char *argv[]);