Browse Source

Rover: allow AP_Stats to be optional

mission-4.1.18
night-ghost 7 years ago committed by Andrew Tridgell
parent
commit
bab54ea647
  1. 4
      APMrover2/APMrover2.cpp
  2. 3
      APMrover2/Parameters.cpp
  3. 2
      APMrover2/Parameters.h
  4. 4
      APMrover2/config.h
  5. 3
      APMrover2/system.cpp

4
APMrover2/APMrover2.cpp

@ -87,7 +87,9 @@ const AP_Scheduler::Task Rover::scheduler_tasks[] = { @@ -87,7 +87,9 @@ const AP_Scheduler::Task Rover::scheduler_tasks[] = {
SCHED_TASK_CLASS(AP_InertialSensor, &rover.ins, periodic, 50, 50),
SCHED_TASK_CLASS(AP_Scheduler, &rover.scheduler, update_logging, 0.1, 75),
SCHED_TASK_CLASS(AP_Button, &rover.button, update, 5, 100),
#if STATS_ENABLED == ENABLED
SCHED_TASK(stats_update, 1, 100),
#endif
SCHED_TASK(crash_check, 10, 1000),
SCHED_TASK(cruise_learn_update, 50, 50),
#if ADVANCED_FAILSAFE == ENABLED
@ -95,6 +97,7 @@ const AP_Scheduler::Task Rover::scheduler_tasks[] = { @@ -95,6 +97,7 @@ const AP_Scheduler::Task Rover::scheduler_tasks[] = {
#endif
};
#if STATS_ENABLED == ENABLED
/*
update AP_Stats
*/
@ -103,6 +106,7 @@ void Rover::stats_update(void) @@ -103,6 +106,7 @@ void Rover::stats_update(void)
g2.stats.set_flying(motor_active());
g2.stats.update();
}
#endif
/*
setup is called when the sketch starts

3
APMrover2/Parameters.cpp

@ -450,10 +450,11 @@ const AP_Param::Info Rover::var_info[] = { @@ -450,10 +450,11 @@ const AP_Param::Info Rover::var_info[] = {
2nd group of parameters
*/
const AP_Param::GroupInfo ParametersG2::var_info[] = {
#if STATS_ENABLED == ENABLED
// @Group: STAT
// @Path: ../libraries/AP_Stats/AP_Stats.cpp
AP_SUBGROUPINFO(stats, "STAT", 1, ParametersG2, AP_Stats),
#endif
// @Param: SYSID_ENFORCE
// @DisplayName: GCS sysid enforcement
// @Description: This controls whether packets from other than the expected GCS system ID will be accepted

2
APMrover2/Parameters.h

@ -284,8 +284,10 @@ public: @@ -284,8 +284,10 @@ public:
// var_info for holding Parameter information
static const struct AP_Param::GroupInfo var_info[];
#if STATS_ENABLED == ENABLED
// vehicle statistics
AP_Stats stats;
#endif
// whether to enforce acceptance of packets only from sysid_my_gcs
AP_Int8 sysid_enforce;

4
APMrover2/config.h

@ -166,3 +166,7 @@ @@ -166,3 +166,7 @@
#ifndef ADVANCED_FAILSAFE
#define ADVANCED_FAILSAFE DISABLED
#endif
#ifndef STATS_ENABLED
# define STATS_ENABLED ENABLED
#endif

3
APMrover2/system.cpp

@ -32,9 +32,10 @@ void Rover::init_ardupilot() @@ -32,9 +32,10 @@ void Rover::init_ardupilot()
//
load_parameters();
#if STATS_ENABLED == ENABLED
// initialise stats module
g2.stats.init();
#endif
gcs().set_dataflash(&DataFlash);

Loading…
Cancel
Save