Commit d22a9bb1 authored by Tomaz Canabrava's avatar Tomaz Canabrava Committed by Daniel Agar

Lists should use brace initializer

parent 29b2077a
......@@ -31,9 +31,10 @@ PX4AdvancedFlightModesController::PX4AdvancedFlightModesController(void) :
_returnModeSelected(false),
_offboardModeSelected(false)
{
QStringList usedParams;
usedParams << "RC_MAP_THROTTLE" << "RC_MAP_YAW" << "RC_MAP_PITCH" << "RC_MAP_ROLL" << "RC_MAP_FLAPS" << "RC_MAP_AUX1" << "RC_MAP_AUX2" <<
"RC_MAP_MODE_SW" << "RC_MAP_RETURN_SW" << "RC_MAP_LOITER_SW" << "RC_MAP_POSCTL_SW" << "RC_MAP_OFFB_SW" << "RC_MAP_ACRO_SW";
QStringList usedParams = QStringList({
"RC_MAP_THROTTLE", "RC_MAP_YAW", "RC_MAP_PITCH", "RC_MAP_ROLL", "RC_MAP_FLAPS", "RC_MAP_AUX1", "RC_MAP_AUX2",
"RC_MAP_MODE_SW", "RC_MAP_RETURN_SW", "RC_MAP_LOITER_SW", "RC_MAP_POSCTL_SW", "RC_MAP_OFFB_SW", "RC_MAP_ACRO_SW"});
if (!_allParametersExists(FactSystem::defaultComponentId, usedParams)) {
return;
}
......@@ -98,12 +99,9 @@ void PX4AdvancedFlightModesController::_init(void)
}
// Setup the channel combobox model
QVector<int> usedChannels;
QList<int> usedChannels;
QStringList attitudeParams;
attitudeParams << "RC_MAP_THROTTLE" << "RC_MAP_YAW" << "RC_MAP_PITCH" << "RC_MAP_ROLL" << "RC_MAP_FLAPS" << "RC_MAP_AUX1" << "RC_MAP_AUX2";
foreach(const QString &attitudeParam, attitudeParams) {
for (const QString &attitudeParam : {"RC_MAP_THROTTLE", "RC_MAP_YAW", "RC_MAP_PITCH", "RC_MAP_ROLL", "RC_MAP_FLAPS", "RC_MAP_AUX1", "RC_MAP_AUX2"}) {
int channel = getParameterFact(-1, attitudeParam)->rawValue().toInt();
if (channel != 0) {
usedChannels << channel;
......
......@@ -43,9 +43,7 @@ bool PX4RadioComponent::setupComplete(void) const
if (_vehicle->parameterManager()->getParameter(-1, "COM_RC_IN_MODE")->rawValue().toInt() != 1) {
// The best we can do to detect the need for a radio calibration is look for attitude
// controls to be mapped.
QStringList attitudeMappings;
attitudeMappings << "RC_MAP_ROLL" << "RC_MAP_PITCH" << "RC_MAP_YAW" << "RC_MAP_THROTTLE";
foreach(const QString &mapParam, attitudeMappings) {
for(const QString &mapParam : {"RC_MAP_ROLL", "RC_MAP_PITCH", "RC_MAP_YAW", "RC_MAP_THROTTLE"}) {
if (_vehicle->parameterManager()->getParameter(FactSystem::defaultComponentId, mapParam)->rawValue().toInt() == 0) {
return false;
}
......@@ -57,11 +55,7 @@ bool PX4RadioComponent::setupComplete(void) const
QStringList PX4RadioComponent::setupCompleteChangedTriggerList(void) const
{
QStringList triggers;
triggers << "COM_RC_IN_MODE" << "RC_MAP_ROLL" << "RC_MAP_PITCH" << "RC_MAP_YAW" << "RC_MAP_THROTTLE";
return triggers;
return {"COM_RC_IN_MODE", "RC_MAP_ROLL", "RC_MAP_PITCH", "RC_MAP_YAW", "RC_MAP_THROTTLE"};
}
QUrl PX4RadioComponent::setupSource(void) const
......
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