diff options
author | sjwilks <sjwilks@gmail.com> | 2014-09-11 09:49:14 +0200 |
---|---|---|
committer | sjwilks <sjwilks@gmail.com> | 2014-09-11 09:49:14 +0200 |
commit | 852b36661d5f03d76c8217444554122c3cadfba0 (patch) | |
tree | 3814de9a3f7bd92c68f38975184f86139accef29 /src/lib/launchdetection/LaunchDetector.cpp | |
parent | e4f3fd88f0623659e6759b9b076be15e4e2f5703 (diff) | |
parent | 26e6d7e12e5036b0e3008b0543d7771d3e527a39 (diff) | |
download | px4-firmware-852b36661d5f03d76c8217444554122c3cadfba0.tar.gz px4-firmware-852b36661d5f03d76c8217444554122c3cadfba0.tar.bz2 px4-firmware-852b36661d5f03d76c8217444554122c3cadfba0.zip |
Merge pull request #1356 from PX4/launchpitchlimit_master
FW: additional upper pitch limit during launch
Diffstat (limited to 'src/lib/launchdetection/LaunchDetector.cpp')
-rw-r--r-- | src/lib/launchdetection/LaunchDetector.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/lib/launchdetection/LaunchDetector.cpp b/src/lib/launchdetection/LaunchDetector.cpp index 2958c0a31..52f5c3257 100644 --- a/src/lib/launchdetection/LaunchDetector.cpp +++ b/src/lib/launchdetection/LaunchDetector.cpp @@ -105,4 +105,24 @@ LaunchDetectionResult LaunchDetector::getLaunchDetected() return LAUNCHDETECTION_RES_NONE; } +float LaunchDetector::getPitchMax(float pitchMaxDefault) { + if (!launchdetection_on.get()) { + return pitchMaxDefault; + } + + /* if a lauchdetectionmethod is active or only one exists return the pitch limit from this method, + * otherwise use the default limit */ + if (activeLaunchDetectionMethodIndex < 0) { + if (sizeof(launchMethods)/sizeof(LaunchMethod) > 1) { + return pitchMaxDefault; + } else { + return launchMethods[0]->getPitchMax(pitchMaxDefault); + } + } else { + return launchMethods[activeLaunchDetectionMethodIndex]->getPitchMax(pitchMaxDefault); + } + +} + + } |