Rover: remove ENABLE/DISABLE defines

This commit is contained in:
Peter Barker 2024-08-05 10:54:28 +10:00 committed by Randy Mackay
parent 516c2a853f
commit 227b6780b2
14 changed files with 30 additions and 38 deletions

View File

@ -418,7 +418,7 @@ const AP_Param::GroupInfo ParametersG2::var_info[] = {
// @Path: ../libraries/RC_Channel/RC_Channels_VarInfo.h
AP_SUBGROUPINFO(rc_channels, "RC", 4, ParametersG2, RC_Channels_Rover),
#if ADVANCED_FAILSAFE == ENABLED
#if AP_ROVER_ADVANCED_FAILSAFE_ENABLED
// @Group: AFS_
// @Path: ../libraries/AP_AdvancedFailsafe/AP_AdvancedFailsafe.cpp
AP_SUBGROUPINFO(afs, "AFS_", 5, ParametersG2, AP_AdvancedFailsafe),
@ -667,7 +667,7 @@ const AP_Param::GroupInfo ParametersG2::var_info[] = {
// @User: Advanced
AP_GROUPINFO("MANUAL_OPTIONS", 53, ParametersG2, manual_options, 0),
#if MODE_DOCK_ENABLED == ENABLED
#if MODE_DOCK_ENABLED
// @Group: DOCK
// @Path: mode_dock.cpp
AP_SUBGROUPPTR(mode_dock_ptr, "DOCK", 54, ParametersG2, ModeDock),
@ -729,7 +729,7 @@ const AP_Param::GroupInfo ParametersG2::var_info[] = {
ParametersG2::ParametersG2(void)
:
#if ADVANCED_FAILSAFE == ENABLED
#if AP_ROVER_ADVANCED_FAILSAFE_ENABLED
afs(),
#endif
#if AP_BEACON_ENABLED
@ -739,7 +739,7 @@ ParametersG2::ParametersG2(void)
wheel_rate_control(wheel_encoder),
attitude_control(),
smart_rtl(),
#if MODE_DOCK_ENABLED == ENABLED
#if MODE_DOCK_ENABLED
mode_dock_ptr(&rover.mode_dock),
#endif
#if HAL_PROXIMITY_ENABLED

View File

@ -301,7 +301,7 @@ public:
// control over servo output ranges
SRV_Channels servo_channels;
#if ADVANCED_FAILSAFE == ENABLED
#if AP_ROVER_ADVANCED_FAILSAFE_ENABLED
// advanced failsafe library
AP_AdvancedFailsafe_Rover afs;
#endif
@ -340,7 +340,7 @@ public:
AP_Proximity proximity;
#endif
#if MODE_DOCK_ENABLED == ENABLED
#if MODE_DOCK_ENABLED
// we need a pointer to the mode for the G2 table
class ModeDock *mode_dock_ptr;
#endif

View File

@ -215,7 +215,7 @@ bool RC_Channel_Rover::do_aux_function(const AUX_FUNC ch_option, const AuxSwitch
do_aux_function_change_mode(rover.mode_loiter, ch_flag);
break;
#if MODE_FOLLOW_ENABLED == ENABLED
#if MODE_FOLLOW_ENABLED
// Set mode to Follow
case AUX_FUNC::FOLLOW:
do_aux_function_change_mode(rover.mode_follow, ch_flag);

View File

@ -134,7 +134,7 @@ const AP_Scheduler::Task Rover::scheduler_tasks[] = {
#endif
SCHED_TASK(crash_check, 10, 200, 123),
SCHED_TASK(cruise_learn_update, 50, 200, 126),
#if ADVANCED_FAILSAFE == ENABLED
#if AP_ROVER_ADVANCED_FAILSAFE_ENABLED
SCHED_TASK(afs_fs_check, 10, 200, 129),
#endif
};

View File

@ -60,7 +60,7 @@
// Local modules
#include "AP_Arming.h"
#include "sailboat.h"
#if ADVANCED_FAILSAFE == ENABLED
#if AP_ROVER_ADVANCED_FAILSAFE_ENABLED
#include "afs_rover.h"
#endif
#include "Parameters.h"
@ -81,7 +81,7 @@ public:
friend class ParametersG2;
friend class AP_Rally_Rover;
friend class AP_Arming_Rover;
#if ADVANCED_FAILSAFE == ENABLED
#if AP_ROVER_ADVANCED_FAILSAFE_ENABLED
friend class AP_AdvancedFailsafe_Rover;
#endif
#if AP_EXTERNAL_CONTROL_ENABLED
@ -99,11 +99,11 @@ public:
friend class ModeManual;
friend class ModeRTL;
friend class ModeSmartRTL;
#if MODE_FOLLOW_ENABLED == ENABLED
#if MODE_FOLLOW_ENABLED
friend class ModeFollow;
#endif
friend class ModeSimple;
#if MODE_DOCK_ENABLED == ENABLED
#if MODE_DOCK_ENABLED
friend class ModeDock;
#endif
@ -253,11 +253,11 @@ private:
ModeSteering mode_steering;
ModeRTL mode_rtl;
ModeSmartRTL mode_smartrtl;
#if MODE_FOLLOW_ENABLED == ENABLED
#if MODE_FOLLOW_ENABLED
ModeFollow mode_follow;
#endif
ModeSimple mode_simple;
#if MODE_DOCK_ENABLED == ENABLED
#if MODE_DOCK_ENABLED
ModeDock mode_dock;
#endif
@ -322,7 +322,7 @@ private:
// failsafe.cpp
void failsafe_trigger(uint8_t failsafe_type, const char* type_str, bool on);
void handle_battery_failsafe(const char* type_str, const int8_t action);
#if ADVANCED_FAILSAFE == ENABLED
#if AP_ROVER_ADVANCED_FAILSAFE_ENABLED
void afs_fs_check(void);
#endif

View File

@ -4,7 +4,7 @@
#include "Rover.h"
#if ADVANCED_FAILSAFE == ENABLED
#if AP_ROVER_ADVANCED_FAILSAFE_ENABLED
/*
Setup radio_out values for all channels to termination values

View File

@ -18,7 +18,7 @@
advanced failsafe support for rover
*/
#if ADVANCED_FAILSAFE == ENABLED
#if AP_ROVER_ADVANCED_FAILSAFE_ENABLED
#include <AP_AdvancedFailsafe/AP_AdvancedFailsafe.h>
/*

View File

@ -72,6 +72,6 @@
#define RESET_SWITCH_CHAN_PWM 1750
#endif
#ifndef ADVANCED_FAILSAFE
#define ADVANCED_FAILSAFE DISABLED
#ifndef AP_ROVER_ADVANCED_FAILSAFE_ENABLED
#define AP_ROVER_ADVANCED_FAILSAFE_ENABLED 0
#endif

View File

@ -3,14 +3,6 @@
// Internal defines, don't edit and expect things to work
// -------------------------------------------------------
// Just so that it's completely clear...
#define ENABLED 1
#define DISABLED 0
// this avoids a very common config error
#define ENABLE ENABLED
#define DISABLE DISABLED
#define SERVO_MAX 4500.0 // This value represents 45 degrees and is just an arbitrary representation of servo max travel.
// types of failsafe events

View File

@ -133,18 +133,18 @@ void Rover::handle_battery_failsafe(const char* type_str, const int8_t action)
}
break;
case FailsafeAction::Terminate:
#if ADVANCED_FAILSAFE == ENABLED
#if AP_ROVER_ADVANCED_FAILSAFE_ENABLED
char battery_type_str[17];
snprintf(battery_type_str, 17, "%s battery", type_str);
g2.afs.gcs_terminate(true, battery_type_str);
#else
arming.disarm(AP_Arming::Method::BATTERYFAILSAFE);
#endif // ADVANCED_FAILSAFE == ENABLED
#endif // AP_ROVER_ADVANCED_FAILSAFE_ENABLED
break;
}
}
#if ADVANCED_FAILSAFE == ENABLED
#if AP_ROVER_ADVANCED_FAILSAFE_ENABLED
/*
check for AFS failsafe check
*/

View File

@ -531,7 +531,7 @@ Mode *Rover::mode_from_mode_num(const enum Mode::Number num)
case Mode::Number::LOITER:
ret = &mode_loiter;
break;
#if MODE_FOLLOW_ENABLED == ENABLED
#if MODE_FOLLOW_ENABLED
case Mode::Number::FOLLOW:
ret = &mode_follow;
break;
@ -557,7 +557,7 @@ Mode *Rover::mode_from_mode_num(const enum Mode::Number num)
case Mode::Number::INITIALISING:
ret = &mode_initializing;
break;
#if MODE_DOCK_ENABLED == ENABLED
#if MODE_DOCK_ENABLED
case Mode::Number::DOCK:
ret = (Mode *)g2.mode_dock_ptr;
break;

View File

@ -19,7 +19,7 @@ public:
LOITER = 5,
FOLLOW = 6,
SIMPLE = 7,
#if MODE_DOCK_ENABLED == ENABLED
#if MODE_DOCK_ENABLED
DOCK = 8,
#endif
CIRCLE = 9,
@ -808,7 +808,7 @@ protected:
bool _enter() override { return false; };
};
#if MODE_FOLLOW_ENABLED == ENABLED
#if MODE_FOLLOW_ENABLED
class ModeFollow : public Mode
{
public:
@ -868,7 +868,7 @@ private:
float _desired_heading_cd; // latest desired heading (in centi-degrees) from pilot
};
#if MODE_DOCK_ENABLED == ENABLED
#if MODE_DOCK_ENABLED
class ModeDock : public Mode
{
public:

View File

@ -1,6 +1,6 @@
#include "Rover.h"
#if MODE_DOCK_ENABLED == ENABLED
#if MODE_DOCK_ENABLED
const AP_Param::GroupInfo ModeDock::var_info[] = {
// @Param: _SPEED

View File

@ -30,7 +30,7 @@ void Rover::init_ardupilot()
// setup telem slots with serial ports
gcs().setup_uarts();
#if OSD_ENABLED == ENABLED
#if OSD_ENABLED
osd.init();
#endif
@ -201,7 +201,7 @@ bool Rover::gcs_mode_enabled(const Mode::Number mode_num) const
(uint8_t)Mode::Number::RTL,
(uint8_t)Mode::Number::SMART_RTL,
(uint8_t)Mode::Number::GUIDED,
#if MODE_DOCK_ENABLED == ENABLED
#if MODE_DOCK_ENABLED
(uint8_t)Mode::Number::DOCK
#endif
};