Browse Source

Lists should use brace initializer

QGC4.4
Tomaz Canabrava 6 years ago committed by Daniel Agar
parent
commit
d22a9bb103
  1. 14
      src/AutoPilotPlugins/PX4/PX4AdvancedFlightModesController.cc
  2. 10
      src/AutoPilotPlugins/PX4/PX4RadioComponent.cc

14
src/AutoPilotPlugins/PX4/PX4AdvancedFlightModesController.cc

@ -31,9 +31,10 @@ PX4AdvancedFlightModesController::PX4AdvancedFlightModesController(void) : @@ -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) @@ -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;

10
src/AutoPilotPlugins/PX4/PX4RadioComponent.cc

@ -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) {
// 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 @@ -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

Loading…
Cancel
Save