Browse Source

Copter: allow AP_Stats to be optional

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

2
ArduCopter/ArduCopter.cpp

@ -176,7 +176,9 @@ const AP_Scheduler::Task Copter::scheduler_tasks[] = { @@ -176,7 +176,9 @@ const AP_Scheduler::Task Copter::scheduler_tasks[] = {
SCHED_TASK(userhook_SuperSlowLoop, 1, 75),
#endif
SCHED_TASK_CLASS(AP_Button, &copter.g2.button, update, 5, 100),
#if STATS_ENABLED == ENABLED
SCHED_TASK_CLASS(AP_Stats, &copter.g2.stats, update, 1, 100),
#endif
};

4
ArduCopter/Parameters.cpp

@ -905,11 +905,11 @@ const AP_Param::GroupInfo ParametersG2::var_info[] = { @@ -905,11 +905,11 @@ const AP_Param::GroupInfo ParametersG2::var_info[] = {
// @Values: 0:NotEnforced,1:Enforced
// @User: Advanced
AP_GROUPINFO("SYSID_ENFORCE", 11, ParametersG2, sysid_enforce, 0),
#if STATS_ENABLED == ENABLED
// @Group: STAT
// @Path: ../libraries/AP_Stats/AP_Stats.cpp
AP_SUBGROUPINFO(stats, "STAT", 12, ParametersG2, AP_Stats),
#endif
#if GRIPPER_ENABLED == ENABLED
// @Group: GRIP_
// @Path: ../libraries/AP_Gripper/AP_Gripper.cpp

2
ArduCopter/Parameters.h

@ -498,8 +498,10 @@ public: @@ -498,8 +498,10 @@ public:
// button checking
AP_Button button;
#if STATS_ENABLED == ENABLED
// vehicle statistics
AP_Stats stats;
#endif
#if GRIPPER_ENABLED
AP_Gripper gripper;

5
ArduCopter/config.h

@ -693,7 +693,10 @@ @@ -693,7 +693,10 @@
#define TOY_MODE_ENABLED DISABLED
#endif
#if TOY_MODE_ENABLED && FRAME_CONFIG == HELI_FRAME
#error Toy mode is not available on Helicopters
#endif
#ifndef STATS_ENABLED
# define STATS_ENABLED ENABLED
#endif

2
ArduCopter/land_detector.cpp

@ -104,7 +104,9 @@ void Copter::set_land_complete(bool b) @@ -104,7 +104,9 @@ void Copter::set_land_complete(bool b)
}
ap.land_complete = b;
#if STATS_ENABLED == ENABLED
g2.stats.set_flying(!b);
#endif
// tell AHRS flying state
ahrs.set_likely_flying(!b);

2
ArduCopter/system.cpp

@ -52,8 +52,10 @@ void Copter::init_ardupilot() @@ -52,8 +52,10 @@ void Copter::init_ardupilot()
// actual loop rate
G_Dt = 1.0 / scheduler.get_loop_rate_hz();
#if STATS_ENABLED == ENABLED
// initialise stats module
g2.stats.init();
#endif
gcs().set_dataflash(&DataFlash);

Loading…
Cancel
Save