mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
Bugfix: update ccpm swash mix slider visibility via ui instead of stored config;
sliders now appear/disappear as user selects link checkboxes
This commit is contained in:
parent
b5ac4306d3
commit
94df1847fc
@ -143,9 +143,6 @@ ConfigCcpmWidget::ConfigCcpmWidget(QWidget *parent) : VehicleConfig(parent)
|
||||
UAVObjectField * curve2source = mixerSettings->getField("Curve2Source");
|
||||
Q_ASSERT(curve2source);
|
||||
|
||||
// QStringList channels;
|
||||
// channels << "None" << "Channel1" << "Channel2" << "Channel3" << "Channel4" <<
|
||||
// "Channel5" << "Channel6" << "Channel7" << "Channel8";
|
||||
m_ccpm->ccpmEngineChannel->addItems(channelNames);
|
||||
m_ccpm->ccpmEngineChannel->setCurrentIndex(0);
|
||||
m_ccpm->ccpmTailChannel->addItems(channelNames);
|
||||
@ -203,9 +200,6 @@ ConfigCcpmWidget::ConfigCcpmWidget(QWidget *parent) : VehicleConfig(parent)
|
||||
connect(m_ccpm->CurveSettings, SIGNAL(cellChanged (int, int)), this, SLOT(UpdateCurveWidgets()));
|
||||
connect(m_ccpm->TabObject, SIGNAL(currentChanged ( QWidget * )), this, SLOT(UpdateType()));
|
||||
|
||||
// connect(m_ccpm->SwashLvlSwashplateImage, SIGNAL(valueChanged(double)), this, SLOT(ccpmSwashplateRedraw()));
|
||||
|
||||
|
||||
connect(m_ccpm->PitchCurve, SIGNAL(curveUpdated(QList<double>,double)), this, SLOT(updatePitchCurveValue(QList<double>,double)));
|
||||
connect(m_ccpm->ThrottleCurve, SIGNAL(curveUpdated(QList<double>,double)), this, SLOT(updateThrottleCurveValue(QList<double>,double)));
|
||||
|
||||
@ -214,6 +208,7 @@ ConfigCcpmWidget::ConfigCcpmWidget(QWidget *parent) : VehicleConfig(parent)
|
||||
connect(m_ccpm->SwashLvlCancelButton, SIGNAL(clicked()), this, SLOT(SwashLvlCancelButtonPressed()));
|
||||
connect(m_ccpm->SwashLvlFinishButton, SIGNAL(clicked()), this, SLOT(SwashLvlFinishButtonPressed()));
|
||||
|
||||
connect(m_ccpm->ccpmCollectivePassthrough, SIGNAL(clicked()),this, SLOT(SetUIComponentVisibilities()));
|
||||
connect(m_ccpm->ccpmLinkCyclic, SIGNAL(clicked()), this, SLOT(SetUIComponentVisibilities()));
|
||||
connect(m_ccpm->ccpmLinkRoll, SIGNAL(clicked()), this, SLOT(SetUIComponentVisibilities()));
|
||||
|
||||
@ -889,8 +884,6 @@ void ConfigCcpmWidget::UpdateMixer()
|
||||
|
||||
throwConfigError(QString("HeliCP"));
|
||||
|
||||
//updateConfigObjectsFromWidgets();
|
||||
|
||||
GUIConfigDataUnion config = GetConfigData();
|
||||
|
||||
useCCPM = !(config.heli.ccpmCollectivePassthroughState || !config.heli.ccpmLinkCyclicState);
|
||||
@ -995,14 +988,14 @@ void ConfigCcpmWidget::UpdateMixer()
|
||||
}
|
||||
|
||||
}
|
||||
QString ConfigCcpmWidget::updateConfigObjectsFromWidgets() //UpdateCCPMOptionsFromUI()
|
||||
QString ConfigCcpmWidget::updateConfigObjects()
|
||||
{
|
||||
QString airframeType = "HeliCP";
|
||||
|
||||
bool useCCPM;
|
||||
bool useCyclic;
|
||||
|
||||
if (updatingFromHardware) return airframeType;
|
||||
if (updatingFromHardware == TRUE) return airframeType;
|
||||
|
||||
updatingFromHardware = TRUE;
|
||||
|
||||
@ -1055,9 +1048,16 @@ QString ConfigCcpmWidget::updateConfigObjectsFromWidgets() //UpdateCCPMOptionsFr
|
||||
|
||||
SetConfigData(config);
|
||||
|
||||
updatingFromHardware = FALSE;
|
||||
return airframeType;
|
||||
}
|
||||
|
||||
QString ConfigCcpmWidget::updateConfigObjectsFromWidgets() //UpdateCCPMOptionsFromUI()
|
||||
{
|
||||
QString airframeType = updateConfigObjects();
|
||||
|
||||
setMixer();
|
||||
|
||||
updatingFromHardware = FALSE;
|
||||
return airframeType;
|
||||
}
|
||||
|
||||
@ -1108,20 +1108,19 @@ void ConfigCcpmWidget::refreshWidgetsValues(QString frameType) //UpdateCCPMUIFro
|
||||
|
||||
void ConfigCcpmWidget::SetUIComponentVisibilities()
|
||||
{
|
||||
//mdl updateObjectsFromWidgets();
|
||||
|
||||
GUIConfigDataUnion config = GetConfigData();
|
||||
|
||||
//set which sliders are user...
|
||||
m_ccpm->ccpmRevoMixingBox->setVisible(0);
|
||||
|
||||
m_ccpm->ccpmPitchMixingBox->setVisible(!config.heli.ccpmCollectivePassthroughState && config.heli.ccpmLinkCyclicState);
|
||||
m_ccpm->ccpmCollectiveScalingBox->setVisible(config.heli.ccpmCollectivePassthroughState || !config.heli.ccpmLinkCyclicState);
|
||||
m_ccpm->ccpmPitchMixingBox->setVisible(!m_ccpm->ccpmCollectivePassthrough->isChecked() &&
|
||||
m_ccpm->ccpmLinkCyclic->isChecked());
|
||||
|
||||
m_ccpm->ccpmLinkCyclic->setVisible(!config.heli.ccpmCollectivePassthroughState);
|
||||
m_ccpm->ccpmCollectiveScalingBox->setVisible(m_ccpm->ccpmCollectivePassthrough->isChecked() || !m_ccpm->ccpmLinkCyclic->isChecked());
|
||||
|
||||
m_ccpm->ccpmCyclicScalingBox->setVisible((config.heli.ccpmCollectivePassthroughState || !config.heli.ccpmLinkCyclicState) && config.heli.ccpmLinkRollState);
|
||||
if (!config.heli.ccpmCollectivePassthroughState && config.heli.ccpmLinkCyclicState)
|
||||
m_ccpm->ccpmLinkCyclic->setVisible(!m_ccpm->ccpmCollectivePassthrough->isChecked());
|
||||
|
||||
m_ccpm->ccpmCyclicScalingBox->setVisible((m_ccpm->ccpmCollectivePassthrough->isChecked() || !m_ccpm->ccpmLinkCyclic->isChecked()) &&
|
||||
m_ccpm->ccpmLinkRoll->isChecked());
|
||||
|
||||
if (!m_ccpm->ccpmCollectivePassthrough->checkState() && m_ccpm->ccpmLinkCyclic->isChecked())
|
||||
{
|
||||
m_ccpm->ccpmPitchScalingBox->setVisible(0);
|
||||
m_ccpm->ccpmRollScalingBox->setVisible(0);
|
||||
@ -1130,11 +1129,10 @@ void ConfigCcpmWidget::SetUIComponentVisibilities()
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ccpm->ccpmPitchScalingBox->setVisible(!config.heli.ccpmLinkRollState);
|
||||
m_ccpm->ccpmRollScalingBox->setVisible(!config.heli.ccpmLinkRollState);
|
||||
m_ccpm->ccpmPitchScalingBox->setVisible(!m_ccpm->ccpmLinkRoll->isChecked());
|
||||
m_ccpm->ccpmRollScalingBox->setVisible(!m_ccpm->ccpmLinkRoll->isChecked());
|
||||
m_ccpm->ccpmLinkRoll->setVisible(1);
|
||||
}
|
||||
|
||||
}
|
||||
/**
|
||||
Request the current value of the SystemSettings which holds the ccpm type
|
||||
@ -1174,6 +1172,8 @@ void ConfigCcpmWidget::setMixer()
|
||||
int i,j;
|
||||
|
||||
if (SwashLvlConfigurationInProgress)return;
|
||||
if (updatingToHardware == TRUE) return;
|
||||
|
||||
updatingToHardware=TRUE;
|
||||
|
||||
MixerSettings * mixerSettings = MixerSettings::GetInstance(getObjectManager());
|
||||
@ -1234,7 +1234,7 @@ void ConfigCcpmWidget::setMixer()
|
||||
//mapping of collective input to curve 2...
|
||||
//MixerSettings.Curve2Source = Throttle,Roll,Pitch,Yaw,Accessory0,Accessory1,Accessory2,Accessory3,Accessory4,Accessory5
|
||||
//check if we are using throttle or directly from a channel...
|
||||
if (GetConfigData().heli.ccpmCollectivePassthroughState)
|
||||
if (m_ccpm->ccpmCollectivePassthrough->isChecked())
|
||||
mixerSettingsData.Curve2Source = MixerSettings::CURVE2SOURCE_COLLECTIVE;
|
||||
else
|
||||
mixerSettingsData.Curve2Source = MixerSettings::CURVE2SOURCE_THROTTLE;
|
||||
|
@ -90,6 +90,7 @@ private:
|
||||
virtual void ResetActuators(GUIConfigDataUnion* configData);
|
||||
virtual QStringList getChannelDescriptions();
|
||||
|
||||
QString updateConfigObjects();
|
||||
private slots:
|
||||
virtual void setupUI(QString airframeType);
|
||||
virtual void refreshWidgetsValues(QString frameType);
|
||||
|
Loading…
Reference in New Issue
Block a user