From d157b1f553a2165f003d36936562f43d98cb930d Mon Sep 17 00:00:00 2001 From: abeck70 Date: Wed, 7 Jan 2015 13:26:12 +1100 Subject: [PATCH] OP1670:Sanitycheck acro/rate+cruisecontrol --- flight/libraries/sanitycheck.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/flight/libraries/sanitycheck.c b/flight/libraries/sanitycheck.c index 3564898a6..d1969a2dd 100644 --- a/flight/libraries/sanitycheck.c +++ b/flight/libraries/sanitycheck.c @@ -287,6 +287,18 @@ static bool check_stabilization_settings(int index, bool multirotor, bool copter return false; } + + // if cruise control, ensure rate or acro are not set + if (modes[FLIGHTMODESETTINGS_STABILIZATION1SETTINGS_THRUST] == FLIGHTMODESETTINGS_STABILIZATION1SETTINGS_CRUISECONTROL) { + + for (uint32_t i = 0; i < FLIGHTMODESETTINGS_STABILIZATION1SETTINGS_YAW; i++) { + if ((modes[i] == FLIGHTMODESETTINGS_STABILIZATION1SETTINGS_RATE || + modes[i] == FLIGHTMODESETTINGS_STABILIZATION1SETTINGS_ACRO)) { + return false; + } + } + } + // Warning: This assumes that certain conditions in the XML file are met. That // FLIGHTMODESETTINGS_STABILIZATION1SETTINGS_MANUAL has the same numeric value for each channel // and is the same for STABILIZATIONDESIRED_STABILIZATIONMODE_MANUAL