From 43719d5e5d72644649aa13efb10c34e656627023 Mon Sep 17 00:00:00 2001 From: Lyuyang Hu Date: Thu, 11 Jul 2019 09:05:55 +0900 Subject: [PATCH] Rover: move contents of Rover.cpp to APMrover2.cpp --- APMrover2/APMrover2.cpp | 20 ++++++++++++++++++-- APMrover2/Rover.cpp | 35 ----------------------------------- 2 files changed, 18 insertions(+), 37 deletions(-) delete mode 100644 APMrover2/Rover.cpp diff --git a/APMrover2/APMrover2.cpp b/APMrover2/APMrover2.cpp index c96f862e3f..664e95d6ec 100644 --- a/APMrover2/APMrover2.cpp +++ b/APMrover2/APMrover2.cpp @@ -31,9 +31,11 @@ #include "Rover.h" -const AP_HAL::HAL& hal = AP_HAL::get_HAL(); +#define FORCE_VERSION_H_INCLUDE +#include "version.h" +#undef FORCE_VERSION_H_INCLUDE -Rover rover; +const AP_HAL::HAL& hal = AP_HAL::get_HAL(); #define SCHED_TASK(func, _interval_ticks, _max_time_micros) SCHED_TASK_CLASS(Rover, &rover, func, _interval_ticks, _max_time_micros) @@ -107,6 +109,18 @@ const AP_Scheduler::Task Rover::scheduler_tasks[] = { constexpr int8_t Rover::_failsafe_priorities[7]; +Rover::Rover(void) : + param_loader(var_info), + channel_steer(nullptr), + channel_throttle(nullptr), + channel_lateral(nullptr), + logger{g.log_bitmask}, + modes(&g.mode1), + control_mode(&mode_initializing), + G_Dt(0.02f) +{ +} + #if STATS_ENABLED == ENABLED /* update AP_Stats @@ -319,4 +333,6 @@ void Rover::update_mission(void) } } +Rover rover; + AP_HAL_MAIN_CALLBACKS(&rover); diff --git a/APMrover2/Rover.cpp b/APMrover2/Rover.cpp deleted file mode 100644 index 42fe6ee29f..0000000000 --- a/APMrover2/Rover.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ -/* - main Rover class, containing all vehicle specific state -*/ - -#include "Rover.h" - -#define FORCE_VERSION_H_INCLUDE -#include "version.h" -#undef FORCE_VERSION_H_INCLUDE - -Rover::Rover(void) : - param_loader(var_info), - channel_steer(nullptr), - channel_throttle(nullptr), - channel_lateral(nullptr), - logger{g.log_bitmask}, - modes(&g.mode1), - control_mode(&mode_initializing), - G_Dt(0.02f) -{ -}