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