Copter: Make mode flowhold a build option via MODE_FLOWHOLD_ENABLED

This commit is contained in:
Stephen Dade 2022-08-17 12:18:38 +10:00 committed by Randy Mackay
parent 5b5cdfa1f1
commit 58cb4cbfb1
6 changed files with 14 additions and 8 deletions

View File

@ -983,7 +983,7 @@ private:
#if MODE_SMARTRTL_ENABLED == ENABLED #if MODE_SMARTRTL_ENABLED == ENABLED
ModeSmartRTL mode_smartrtl; ModeSmartRTL mode_smartrtl;
#endif #endif
#if !HAL_MINIMIZE_FEATURES && AP_OPTICALFLOW_ENABLED #if MODE_FLOWHOLD_ENABLED == ENABLED
ModeFlowHold mode_flowhold; ModeFlowHold mode_flowhold;
#endif #endif
#if MODE_ZIGZAG_ENABLED == ENABLED #if MODE_ZIGZAG_ENABLED == ENABLED

View File

@ -885,7 +885,7 @@ const AP_Param::GroupInfo ParametersG2::var_info[] = {
// @User: Advanced // @User: Advanced
AP_GROUPINFO("LAND_ALT_LOW", 25, ParametersG2, land_alt_low, 1000), AP_GROUPINFO("LAND_ALT_LOW", 25, ParametersG2, land_alt_low, 1000),
#if !HAL_MINIMIZE_FEATURES && AP_OPTICALFLOW_ENABLED #if MODE_FLOWHOLD_ENABLED == ENABLED
// @Group: FHLD // @Group: FHLD
// @Path: mode_flowhold.cpp // @Path: mode_flowhold.cpp
AP_SUBGROUPPTR(mode_flowhold_ptr, "FHLD", 26, ParametersG2, ModeFlowHold), AP_SUBGROUPPTR(mode_flowhold_ptr, "FHLD", 26, ParametersG2, ModeFlowHold),
@ -1160,7 +1160,7 @@ ParametersG2::ParametersG2(void)
#if MODE_SMARTRTL_ENABLED == ENABLED #if MODE_SMARTRTL_ENABLED == ENABLED
,smart_rtl() ,smart_rtl()
#endif #endif
#if !HAL_MINIMIZE_FEATURES && AP_OPTICALFLOW_ENABLED #if MODE_FLOWHOLD_ENABLED == ENABLED
,mode_flowhold_ptr(&copter.mode_flowhold) ,mode_flowhold_ptr(&copter.mode_flowhold)
#endif #endif
#if MODE_FOLLOW_ENABLED == ENABLED #if MODE_FOLLOW_ENABLED == ENABLED

View File

@ -319,6 +319,12 @@
# define MODE_TURTLE_ENABLED !HAL_MINIMIZE_FEATURES && !defined(DISABLE_DSHOT) && FRAME_CONFIG != HELI_FRAME # define MODE_TURTLE_ENABLED !HAL_MINIMIZE_FEATURES && !defined(DISABLE_DSHOT) && FRAME_CONFIG != HELI_FRAME
#endif #endif
//////////////////////////////////////////////////////////////////////////////
// Flowhold - use optical flow to hover in place
#ifndef MODE_FLOWHOLD_ENABLED
# define MODE_FLOWHOLD_ENABLED !HAL_MINIMIZE_FEATURES && AP_OPTICALFLOW_ENABLED
#endif
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////

View File

@ -139,7 +139,7 @@ Mode *Copter::mode_from_mode_num(const Mode::Number mode)
break; break;
#endif #endif
#if AP_OPTICALFLOW_ENABLED #if MODE_FLOWHOLD_ENABLED == ENABLED
case Mode::Number::FLOWHOLD: case Mode::Number::FLOWHOLD:
ret = (Mode *)g2.mode_flowhold_ptr; ret = (Mode *)g2.mode_flowhold_ptr;
break; break;

View File

@ -836,7 +836,7 @@ private:
}; };
#if !HAL_MINIMIZE_FEATURES && AP_OPTICALFLOW_ENABLED #if MODE_FLOWHOLD_ENABLED == ENABLED
/* /*
class to support FLOWHOLD mode, which is a position hold mode using class to support FLOWHOLD mode, which is a position hold mode using
optical flow directly, avoiding the need for a rangefinder optical flow directly, avoiding the need for a rangefinder
@ -922,7 +922,7 @@ private:
// last time there was significant stick input // last time there was significant stick input
uint32_t last_stick_input_ms; uint32_t last_stick_input_ms;
}; };
#endif // AP_OPTICALFLOW_ENABLED #endif // MODE_FLOWHOLD_ENABLED
class ModeGuided : public Mode { class ModeGuided : public Mode {

View File

@ -1,7 +1,7 @@
#include "Copter.h" #include "Copter.h"
#include <utility> #include <utility>
#if !HAL_MINIMIZE_FEATURES && AP_OPTICALFLOW_ENABLED #if MODE_FLOWHOLD_ENABLED == ENABLED
/* /*
implement FLOWHOLD mode, for position hold using optical flow implement FLOWHOLD mode, for position hold using optical flow
@ -509,4 +509,4 @@ void ModeFlowHold::update_height_estimate(void)
last_ins_height = ins_height; last_ins_height = ins_height;
} }
#endif // AP_OPTICALFLOW_ENABLED #endif // MODE_FLOWHOLD_ENABLED