From d157b1f553a2165f003d36936562f43d98cb930d Mon Sep 17 00:00:00 2001 From: abeck70 Date: Wed, 7 Jan 2015 13:26:12 +1100 Subject: [PATCH 1/2] 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 From bc94fbc2df51e3a4b90f2d57bc0e664fc3bb3c49 Mon Sep 17 00:00:00 2001 From: abeck70 Date: Thu, 19 Feb 2015 08:27:10 +1100 Subject: [PATCH 2/2] OP-1670 uncrustify sanitycheck --- flight/libraries/sanitycheck.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/flight/libraries/sanitycheck.c b/flight/libraries/sanitycheck.c index d1969a2dd..13bca13be 100644 --- a/flight/libraries/sanitycheck.c +++ b/flight/libraries/sanitycheck.c @@ -290,13 +290,12 @@ static bool check_stabilization_settings(int index, bool multirotor, bool copter // 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; - } - } + 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