diff --git a/src/AutoPilotPlugins/PX4/PX4AdvancedFlightModesController.cc b/src/AutoPilotPlugins/PX4/PX4AdvancedFlightModesController.cc index fa8782b..276ae6e 100644 --- a/src/AutoPilotPlugins/PX4/PX4AdvancedFlightModesController.cc +++ b/src/AutoPilotPlugins/PX4/PX4AdvancedFlightModesController.cc @@ -138,13 +138,11 @@ void PX4AdvancedFlightModesController::_validateConfiguration(void) _validConfiguration = true; // Make sure switches are valid and within channel range - - QStringList switchParams; + + const QStringList switchParams = {"RC_MAP_MODE_SW", "RC_MAP_ACRO_SW", "RC_MAP_POSCTL_SW", "RC_MAP_LOITER_SW", "RC_MAP_RETURN_SW", "RC_MAP_OFFB_SW"}; QList switchMappings; - - switchParams << "RC_MAP_MODE_SW" << "RC_MAP_ACRO_SW" << "RC_MAP_POSCTL_SW" << "RC_MAP_LOITER_SW" << "RC_MAP_RETURN_SW" << "RC_MAP_OFFB_SW"; - - for(int i=0; irawValue().toInt(); switchMappings << map; @@ -155,16 +153,16 @@ void PX4AdvancedFlightModesController::_validateConfiguration(void) } // Make sure mode switches are not double-mapped - - QStringList attitudeParams; - - attitudeParams << "RC_MAP_THROTTLE" << "RC_MAP_YAW" << "RC_MAP_PITCH" << "RC_MAP_ROLL" << "RC_MAP_FLAPS" << "RC_MAP_AUX1" << "RC_MAP_AUX2"; - for (int i=0; irawValue().toInt(); + if (map == 0) { + continue; + } for (int j=0; jrawValue().toFloat(); if (threshold < 0.0f || threshold > 1.0f) { _validConfiguration = false;