Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AC_AutoTune: add and use header guards #25725

Merged
merged 1 commit into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions libraries/AC_AutoTune/AC_AutoTune.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#include "AC_AutoTune_config.h"

#if AC_AUTOTUNE_ENABLED

#include "AC_AutoTune.h"

#include <AP_Logger/AP_Logger.h>
Expand Down Expand Up @@ -757,3 +761,4 @@ void AC_AutoTune::next_tune_type(TuneType &curr_tune_type, bool reset)
curr_tune_type = tune_seq[tune_seq_curr];
}

#endif // AC_AUTOTUNE_ENABLED
6 changes: 6 additions & 0 deletions libraries/AC_AutoTune/AC_AutoTune.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
*/
#pragma once

#include "AC_AutoTune_config.h"

#if AC_AUTOTUNE_ENABLED

#include <AC_AttitudeControl/AC_AttitudeControl.h>
#include <AC_AttitudeControl/AC_PosControl.h>
#include <AP_Math/AP_Math.h>
Expand Down Expand Up @@ -327,3 +331,5 @@ class AC_AutoTune
uint32_t last_pilot_override_warning;

};

#endif // AC_AUTOTUNE_ENABLED
6 changes: 6 additions & 0 deletions libraries/AC_AutoTune/AC_AutoTune_Heli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
Converted to a library by Andrew Tridgell, and rewritten to include helicopters by Bill Geyer
*/

#include "AC_AutoTune_config.h"

#if AC_AUTOTUNE_ENABLED

#include "AC_AutoTune_Heli.h"

#include <AP_Logger/AP_Logger.h>
Expand Down Expand Up @@ -1941,3 +1945,5 @@ bool AC_AutoTune_Heli::exceeded_freq_range(float frequency)
}
return ret;
}

#endif // AC_AUTOTUNE_ENABLED
6 changes: 6 additions & 0 deletions libraries/AC_AutoTune/AC_AutoTune_Heli.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@

#pragma once

#include "AC_AutoTune_config.h"

#if AC_AUTOTUNE_ENABLED

#include "AC_AutoTune.h"
#include <AP_Math/chirp.h>
#include <GCS_MAVLink/GCS.h>
Expand Down Expand Up @@ -296,3 +300,5 @@ class AC_AutoTune_Heli : public AC_AutoTune

Chirp chirp_input;
};

#endif // AC_AUTOTUNE_ENABLED
6 changes: 6 additions & 0 deletions libraries/AC_AutoTune/AC_AutoTune_Multi.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#include "AC_AutoTune_config.h"

#if AC_AUTOTUNE_ENABLED

#include "AC_AutoTune_Multi.h"

#include <AP_Logger/AP_Logger.h>
Expand Down Expand Up @@ -1246,3 +1250,5 @@ uint32_t AC_AutoTune_Multi::get_testing_step_timeout_ms() const
return AUTOTUNE_TESTING_STEP_TIMEOUT_MS;
}


#endif // AC_AUTOTUNE_ENABLED
6 changes: 6 additions & 0 deletions libraries/AC_AutoTune/AC_AutoTune_Multi.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@

#pragma once

#include "AC_AutoTune_config.h"

#if AC_AUTOTUNE_ENABLED

#include "AC_AutoTune.h"

class AC_AutoTune_Multi : public AC_AutoTune
Expand Down Expand Up @@ -168,3 +172,5 @@ class AC_AutoTune_Multi : public AC_AutoTune
AP_Float aggressiveness; // aircraft response aggressiveness to be tuned
AP_Float min_d; // minimum rate d gain allowed during tuning
};

#endif // AC_AUTOTUNE_ENABLED
7 changes: 7 additions & 0 deletions libraries/AC_AutoTune/AC_AutoTune_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#pragma once

#include <AP_HAL/AP_HAL_Boards.h>

#ifndef AC_AUTOTUNE_ENABLED
#define AC_AUTOTUNE_ENABLED 1
#endif