Skip to content

Commit

Permalink
PreflightCheck: remove goto from imu consistency check
Browse files Browse the repository at this point in the history
  • Loading branch information
MaEtUgR authored and bkueng committed Oct 9, 2019
1 parent 6066300 commit c570dc9
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/modules/commander/PreflightCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,6 @@ static bool magnometerCheck(orb_advert_t *mavlink_log_pub, vehicle_status_s &sta

static bool imuConsistencyCheck(orb_advert_t *mavlink_log_pub, vehicle_status_s &status, bool report_status)
{
bool success = true; // start with a pass and change to a fail if any test fails
float test_limit = 1.0f; // pass limit re-used for each test

// Get sensor_preflight data if available and exit with a fail recorded if not
Expand All @@ -169,8 +168,7 @@ static bool imuConsistencyCheck(orb_advert_t *mavlink_log_pub, vehicle_status_s
set_health_flags_healthy(subsystem_info_s::SUBSYSTEM_TYPE_ACC2, false, status);
}

success = false;
goto out;
return false;

} else if (sensors.accel_inconsistency_m_s_s > test_limit * 0.8f) {
if (report_status) {
Expand All @@ -188,17 +186,15 @@ static bool imuConsistencyCheck(orb_advert_t *mavlink_log_pub, vehicle_status_s
set_health_flags_healthy(subsystem_info_s::SUBSYSTEM_TYPE_GYRO2, false, status);
}

success = false;
goto out;
return false;

} else if (sensors.gyro_inconsistency_rad_s > test_limit * 0.5f) {
if (report_status) {
mavlink_log_info(mavlink_log_pub, "Preflight Advice: Gyros inconsistent - Check Cal");
}
}

out:
return success;
return true;
}

// return false if the magnetomer measurements are inconsistent
Expand Down

0 comments on commit c570dc9

Please sign in to comment.