mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-02 10:24:11 +01:00
OP-1222 Fixed a 'off-by-one' bug with channels. Fixed some bugs in the configuration plugin regarding fixed wings.
This commit is contained in:
parent
527ec1d15d
commit
a7ab68f539
@ -107,6 +107,18 @@ QStringList ConfigFixedWingWidget::getChannelDescriptions()
|
||||
return channelDesc;
|
||||
}
|
||||
|
||||
void ConfigFixedWingWidget::resetChannelboxesAndSliders()
|
||||
{
|
||||
m_aircraft->fwRudder1ChannelBox->setEnabled(false);
|
||||
m_aircraft->fwRudder2ChannelBox->setEnabled(false);
|
||||
m_aircraft->fwElevator1ChannelBox->setEnabled(false);
|
||||
m_aircraft->fwElevator2ChannelBox->setEnabled(false);
|
||||
m_aircraft->fwAileron1ChannelBox->setEnabled(false);
|
||||
m_aircraft->fwAileron2ChannelBox->setEnabled(false);
|
||||
m_aircraft->elevonSlider1->setEnabled(false);
|
||||
m_aircraft->elevonSlider2->setEnabled(false);
|
||||
}
|
||||
|
||||
void ConfigFixedWingWidget::setupUI(QString frameType)
|
||||
{
|
||||
Q_ASSERT(m_aircraft);
|
||||
@ -126,6 +138,8 @@ void ConfigFixedWingWidget::setupUI(QString frameType)
|
||||
if (frameType == "FixedWing" || frameType == "Elevator aileron rudder") {
|
||||
plane->setElementId("aileron");
|
||||
setComboCurrentIndex(m_aircraft->fixedWingType, m_aircraft->fixedWingType->findText("Elevator aileron rudder"));
|
||||
resetChannelboxesAndSliders();
|
||||
|
||||
m_aircraft->fwRudder1ChannelBox->setEnabled(true);
|
||||
m_aircraft->fwRudder2ChannelBox->setEnabled(true);
|
||||
m_aircraft->fwElevator1ChannelBox->setEnabled(true);
|
||||
@ -138,15 +152,12 @@ void ConfigFixedWingWidget::setupUI(QString frameType)
|
||||
m_aircraft->fwElevator1Label->setText("Elevator 1");
|
||||
m_aircraft->fwElevator2Label->setText("Elevator 2");
|
||||
|
||||
m_aircraft->elevonSlider1->setEnabled(false);
|
||||
m_aircraft->elevonSlider2->setEnabled(false);
|
||||
} else if (frameType == "FixedWingVtail" || frameType == "Vtail") {
|
||||
// do nothing for now
|
||||
} else if (frameType == "FixedWingElevon" || frameType == "Elevon") {
|
||||
plane->setElementId("elevon");
|
||||
setComboCurrentIndex(m_aircraft->fixedWingType, m_aircraft->fixedWingType->findText("Elevon"));
|
||||
m_aircraft->fwRudder1ChannelBox->setEnabled(false);
|
||||
m_aircraft->fwRudder2ChannelBox->setEnabled(false);
|
||||
resetChannelboxesAndSliders();
|
||||
|
||||
m_aircraft->fwElevator1Label->setText("Elevon 1");
|
||||
m_aircraft->fwElevator1ChannelBox->setEnabled(true);
|
||||
@ -156,6 +167,7 @@ void ConfigFixedWingWidget::setupUI(QString frameType)
|
||||
|
||||
m_aircraft->fwAileron1Label->setText("Aileron 1");
|
||||
m_aircraft->fwAileron2Label->setText("Aileron 2");
|
||||
|
||||
m_aircraft->elevonLabel1->setText("Roll");
|
||||
m_aircraft->elevonLabel2->setText("Pitch");
|
||||
|
||||
|
@ -53,6 +53,7 @@ public:
|
||||
virtual void refreshWidgetsValues(QString frameType);
|
||||
virtual QString updateConfigObjectsFromWidgets();
|
||||
|
||||
void resetChannelboxesAndSliders();
|
||||
protected:
|
||||
void showEvent(QShowEvent *event);
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
@ -177,7 +177,7 @@ void OutputCalibrationPage::setupVehicle()
|
||||
m_wizardIndexes << 0 << 1 << 2 << 3 << 4 << 2 << 3 << 4 << 2 << 3 << 4 << 2 << 3 << 4;
|
||||
m_vehicleElementIds << "aileron" << "aileron-frame" << "aileron-motor" << "aileron-ail-left" << "aileron-ail-right" << "aileron-rudder" << "aileron-elevator";
|
||||
m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 2 << 2 << 3 << 3 << 3 << 4 << 4 << 4 << 5 << 5 << 5;
|
||||
m_channelIndex << 0 << 3 << 0 << 0 << 0 << 1 << 1 << 1 << 2 << 2 << 2 << 4 << 4 << 4;
|
||||
m_channelIndex << 0 << 2 << 0 << 0 << 0 << 1 << 1 << 1 << 3 << 3 << 3 << 4 << 4 << 4;
|
||||
|
||||
setupActuatorMinMaxAndNeutral(3, 3, 5);
|
||||
|
||||
@ -188,7 +188,7 @@ void OutputCalibrationPage::setupVehicle()
|
||||
m_wizardIndexes << 0 << 1 << 2 << 3 << 4 << 2 << 3 << 4;
|
||||
m_vehicleElementIds << "elevon" << "elevon-frame" << "elevon-motor" << "elevon-left" << "elevon-right";
|
||||
m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 2 << 2 << 3 << 3 << 3;
|
||||
m_channelIndex << 0 << 3 << 0 << 0 << 0 << 1 << 1 << 1;
|
||||
m_channelIndex << 0 << 2 << 0 << 0 << 0 << 1 << 1 << 1;
|
||||
|
||||
setupActuatorMinMaxAndNeutral(3, 3, 3);
|
||||
|
||||
|
@ -363,11 +363,7 @@ void VehicleConfigurationHelper::applyActuatorConfiguration()
|
||||
actSettings->setData(data);
|
||||
addModifiedObject(actSettings, tr("Writing actuator settings"));
|
||||
|
||||
// Set up model view image here?
|
||||
// loop through all the window instances and check which are of the type ModelViewGadget.
|
||||
// per m_thread on each instance setAcFileName(QString model_file_name) and then call reloadScene() on the same object.
|
||||
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
case VehicleConfigurationSource::VEHICLE_HELI:
|
||||
@ -1548,30 +1544,30 @@ void VehicleConfigurationHelper::setupElevon()
|
||||
mixerChannelSettings channels[10];
|
||||
GUIConfigDataUnion guiSettings = getGUIConfigData();
|
||||
|
||||
channels[0].type = MIXER_TYPE_MOTOR;
|
||||
channels[0].throttle1 = 100;
|
||||
channels[2].type = MIXER_TYPE_MOTOR;
|
||||
channels[2].throttle1 = 100;
|
||||
channels[2].throttle2 = 0;
|
||||
channels[2].roll = 0;
|
||||
channels[2].pitch = 0;
|
||||
channels[2].yaw = 0;
|
||||
|
||||
channels[0].type = MIXER_TYPE_SERVO;
|
||||
channels[0].throttle1 = 0;
|
||||
channels[0].throttle2 = 0;
|
||||
channels[0].roll = 0;
|
||||
channels[0].pitch = 0;
|
||||
channels[0].roll = -100;
|
||||
channels[0].pitch = 100;
|
||||
channels[0].yaw = 0;
|
||||
|
||||
channels[1].type = MIXER_TYPE_SERVO;
|
||||
channels[1].throttle1 = 0;
|
||||
channels[1].throttle2 = 0;
|
||||
channels[1].roll = -100;
|
||||
channels[1].pitch = 100;
|
||||
channels[1].roll = 100;
|
||||
channels[1].pitch = -100;
|
||||
channels[1].yaw = 0;
|
||||
|
||||
channels[2].type = MIXER_TYPE_SERVO;
|
||||
channels[2].throttle1 = 0;
|
||||
channels[2].throttle2 = 0;
|
||||
channels[2].roll = 100;
|
||||
channels[2].pitch = -100;
|
||||
channels[2].yaw = 0;
|
||||
|
||||
guiSettings.fixedwing.FixedWingThrottle = 1;
|
||||
guiSettings.fixedwing.FixedWingRoll1 = 2;
|
||||
guiSettings.fixedwing.FixedWingRoll2 = 3;
|
||||
guiSettings.fixedwing.FixedWingThrottle = 3;
|
||||
guiSettings.fixedwing.FixedWingPitch1 = 1;
|
||||
guiSettings.fixedwing.FixedWingPitch2 = 2;
|
||||
|
||||
applyMixerConfiguration(channels);
|
||||
applyMultiGUISettings(SystemSettings::AIRFRAMETYPE_FIXEDWINGELEVON, guiSettings);
|
||||
@ -1587,27 +1583,27 @@ void VehicleConfigurationHelper::setupAileron()
|
||||
mixerChannelSettings channels[10];
|
||||
GUIConfigDataUnion guiSettings = getGUIConfigData();
|
||||
|
||||
channels[0].type = MIXER_TYPE_MOTOR;
|
||||
channels[0].throttle1 = 100;
|
||||
channels[2].type = MIXER_TYPE_MOTOR;
|
||||
channels[2].throttle1 = 100;
|
||||
channels[2].throttle2 = 0;
|
||||
channels[2].roll = 0;
|
||||
channels[2].pitch = 0;
|
||||
channels[2].yaw = 0;
|
||||
|
||||
channels[0].type = MIXER_TYPE_SERVO;
|
||||
channels[0].throttle1 = 0;
|
||||
channels[0].throttle2 = 0;
|
||||
channels[0].roll = 0;
|
||||
channels[0].roll = -100;
|
||||
channels[0].pitch = 0;
|
||||
channels[0].yaw = 0;
|
||||
|
||||
channels[1].type = MIXER_TYPE_SERVO;
|
||||
channels[1].throttle1 = 0;
|
||||
channels[1].throttle2 = 0;
|
||||
channels[1].roll = -100;
|
||||
channels[1].roll = 100;
|
||||
channels[1].pitch = 0;
|
||||
channels[1].yaw = 0;
|
||||
|
||||
channels[2].type = MIXER_TYPE_SERVO;
|
||||
channels[2].throttle1 = 0;
|
||||
channels[2].throttle2 = 0;
|
||||
channels[2].roll = 100;
|
||||
channels[2].pitch = 0;
|
||||
channels[2].yaw = 0;
|
||||
|
||||
channels[3].type = MIXER_TYPE_SERVO;
|
||||
channels[3].throttle1 = 0;
|
||||
channels[3].throttle2 = 0;
|
||||
@ -1622,9 +1618,9 @@ void VehicleConfigurationHelper::setupAileron()
|
||||
channels[4].pitch = 0;
|
||||
channels[4].yaw = 100;
|
||||
|
||||
guiSettings.fixedwing.FixedWingThrottle = 1;
|
||||
guiSettings.fixedwing.FixedWingRoll1 = 2;
|
||||
guiSettings.fixedwing.FixedWingRoll2 = 3;
|
||||
guiSettings.fixedwing.FixedWingThrottle = 3;
|
||||
guiSettings.fixedwing.FixedWingRoll1 = 1;
|
||||
guiSettings.fixedwing.FixedWingRoll2 = 2;
|
||||
guiSettings.fixedwing.FixedWingPitch1 = 4;
|
||||
guiSettings.fixedwing.FixedWingYaw1 = 5;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user