Commit 860cb89f authored by Tomaz Canabrava's avatar Tomaz Canabrava

Change the if/else chain for failure to a single goto call

I know that some people belive that goto's are devil's work
but sometimes (like chaining if/elses for failures) it can
actually simplify the code for a better readability and
improved speed.
Signed-off-by: 's avatarTomaz Canabrava <tomaz.canabrava@intel.com>
parent a9c57c55
......@@ -628,17 +628,13 @@ void APMCompassCal::startCalibration(void)
_rgSavedCompassOffsets[i][j] = paramFact->rawValue().toFloat();
paramFact->setRawValue(0.0);
} else {
_calWorkerThread->rgCompassAvailable[i] = false;
goto has_compass;
}
}
} else {
_calWorkerThread->rgCompassAvailable[i] = false;
}
} else {
_calWorkerThread->rgCompassAvailable[i] = false;
}
_calWorkerThread->rgCompassAvailable[i] = false;
has_compass:
qCDebug(APMCompassCalLog) << QStringLiteral("Compass %1 available: %2").arg(i).arg(_calWorkerThread->rgCompassAvailable[i]);
}
......
......@@ -73,7 +73,7 @@ QUrl APMTuningComponent::setupSource(void) const
case MAV_TYPE_OCTOROTOR:
case MAV_TYPE_TRICOPTER:
// Older firmwares do not have CH9_OPT, we don't support Tuning on older firmwares
if (_autopilot->parameterExists(-1, "CH9_OPT")) {
if (_autopilot->parameterExists(-1, QStringLiteral("CH9_OPT"))) {
qmlFile = QStringLiteral("qrc:/qml/APMTuningComponentCopter.qml");
}
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment