mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 23:33:34 +08:00
fix launch method iteration
This commit is contained in:
committed by
Lorenz Meier
parent
3e5ce55b94
commit
08bd3ea121
@@ -66,7 +66,7 @@ LaunchDetector::~LaunchDetector()
|
|||||||
void LaunchDetector::reset()
|
void LaunchDetector::reset()
|
||||||
{
|
{
|
||||||
/* Reset all detectors */
|
/* Reset all detectors */
|
||||||
for (uint8_t i = 0; i < sizeof(launchMethods)/sizeof(LaunchMethod); i++) {
|
for (uint8_t i = 0; i < sizeof(launchMethods)/sizeof(LaunchMethod *); i++) {
|
||||||
launchMethods[i]->reset();
|
launchMethods[i]->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,7 +79,7 @@ void LaunchDetector::reset()
|
|||||||
void LaunchDetector::update(float accel_x)
|
void LaunchDetector::update(float accel_x)
|
||||||
{
|
{
|
||||||
if (launchdetection_on.get() == 1) {
|
if (launchdetection_on.get() == 1) {
|
||||||
for (uint8_t i = 0; i < sizeof(launchMethods)/sizeof(LaunchMethod); i++) {
|
for (uint8_t i = 0; i < sizeof(launchMethods)/sizeof(LaunchMethod *); i++) {
|
||||||
launchMethods[i]->update(accel_x);
|
launchMethods[i]->update(accel_x);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -90,7 +90,7 @@ LaunchDetectionResult LaunchDetector::getLaunchDetected()
|
|||||||
if (launchdetection_on.get() == 1) {
|
if (launchdetection_on.get() == 1) {
|
||||||
if (activeLaunchDetectionMethodIndex < 0) {
|
if (activeLaunchDetectionMethodIndex < 0) {
|
||||||
/* None of the active launchmethods has detected a launch, check all launchmethods */
|
/* None of the active launchmethods has detected a launch, check all launchmethods */
|
||||||
for (uint8_t i = 0; i < sizeof(launchMethods)/sizeof(LaunchMethod); i++) {
|
for (uint8_t i = 0; i < sizeof(launchMethods)/sizeof(LaunchMethod *); i++) {
|
||||||
if(launchMethods[i]->getLaunchDetected() != LAUNCHDETECTION_RES_NONE) {
|
if(launchMethods[i]->getLaunchDetected() != LAUNCHDETECTION_RES_NONE) {
|
||||||
warnx("selecting launchmethod %d", i);
|
warnx("selecting launchmethod %d", i);
|
||||||
activeLaunchDetectionMethodIndex = i; // from now on only check this method
|
activeLaunchDetectionMethodIndex = i; // from now on only check this method
|
||||||
@@ -113,7 +113,7 @@ float LaunchDetector::getPitchMax(float pitchMaxDefault) {
|
|||||||
/* if a lauchdetectionmethod is active or only one exists return the pitch limit from this method,
|
/* if a lauchdetectionmethod is active or only one exists return the pitch limit from this method,
|
||||||
* otherwise use the default limit */
|
* otherwise use the default limit */
|
||||||
if (activeLaunchDetectionMethodIndex < 0) {
|
if (activeLaunchDetectionMethodIndex < 0) {
|
||||||
if (sizeof(launchMethods)/sizeof(LaunchMethod) > 1) {
|
if (sizeof(launchMethods)/sizeof(LaunchMethod *) > 1) {
|
||||||
return pitchMaxDefault;
|
return pitchMaxDefault;
|
||||||
} else {
|
} else {
|
||||||
return launchMethods[0]->getPitchMax(pitchMaxDefault);
|
return launchMethods[0]->getPitchMax(pitchMaxDefault);
|
||||||
|
|||||||
Reference in New Issue
Block a user