mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-15 07:29:15 +01:00
VehicleConfig Bugfix/tweek: change getChannelDescs to static in all airframes;
avoids entire widget creation just to get channel descs.
This commit is contained in:
parent
b95290a32f
commit
c3057dc72e
@ -88,7 +88,7 @@ private:
|
||||
bool updatingToHardware;
|
||||
|
||||
virtual void ResetActuators(GUIConfigDataUnion* configData);
|
||||
virtual QStringList getChannelDescriptions();
|
||||
static QStringList getChannelDescriptions();
|
||||
|
||||
QString updateConfigObjects();
|
||||
private slots:
|
||||
|
@ -57,7 +57,7 @@ private:
|
||||
bool setupFrameVtail(QString airframeType);
|
||||
|
||||
virtual void ResetActuators(GUIConfigDataUnion* configData);
|
||||
virtual QStringList getChannelDescriptions();
|
||||
static QStringList getChannelDescriptions();
|
||||
|
||||
private slots:
|
||||
virtual void setupUI(QString airframeType);
|
||||
|
@ -57,7 +57,7 @@ private:
|
||||
bool setupGroundVehicleMotorcycle(QString airframeType);
|
||||
|
||||
virtual void ResetActuators(GUIConfigDataUnion* configData);
|
||||
virtual QStringList getChannelDescriptions();
|
||||
static QStringList getChannelDescriptions();
|
||||
|
||||
private slots:
|
||||
virtual void setupUI(QString airframeType);
|
||||
|
@ -65,7 +65,7 @@ private:
|
||||
void setupQuadMotor(int channel, double roll, double pitch, double yaw);
|
||||
|
||||
virtual void ResetActuators(GUIConfigDataUnion* configData);
|
||||
virtual QStringList getChannelDescriptions();
|
||||
static QStringList getChannelDescriptions();
|
||||
|
||||
private slots:
|
||||
virtual void setupUI(QString airframeType);
|
||||
|
@ -113,17 +113,6 @@ void VehicleConfig::SetConfigData(GUIConfigDataUnion configData) {
|
||||
void VehicleConfig::ResetActuators(GUIConfigDataUnion* configData)
|
||||
{
|
||||
}
|
||||
QStringList VehicleConfig::getChannelDescriptions()
|
||||
{
|
||||
QStringList channelDesc;
|
||||
|
||||
// init a channel_numelem list of channel desc defaults
|
||||
for (int i=0; i < (int)(VehicleConfig::CHANNEL_NUMELEM); i++)
|
||||
{
|
||||
channelDesc.append(QString("-"));
|
||||
}
|
||||
return channelDesc;
|
||||
}
|
||||
|
||||
/**
|
||||
Helper function:
|
||||
|
@ -138,7 +138,6 @@ class VehicleConfig: public ConfigTaskWidget
|
||||
double getCurveMin(QList<double>* curve);
|
||||
double getCurveMax(QList<double>* curve);
|
||||
virtual void ResetActuators(GUIConfigDataUnion* configData);
|
||||
virtual QStringList getChannelDescriptions();
|
||||
|
||||
QStringList channelNames;
|
||||
QStringList mixerTypes;
|
||||
|
@ -120,7 +120,7 @@ ConfigVehicleTypeWidget::ConfigVehicleTypeWidget(QWidget *parent) : ConfigTaskWi
|
||||
airframeTypes << "Fixed Wing" << "Multirotor" << "Helicopter" << "Ground" << "Custom";
|
||||
m_aircraft->aircraftType->addItems(airframeTypes);
|
||||
|
||||
m_aircraft->aircraftType->setCurrentIndex(0); //Set default vehicle to Fixed Wing
|
||||
m_aircraft->aircraftType->setCurrentIndex(0); //Set default vehicle to Fixedwing
|
||||
m_aircraft->airframesWidget->setCurrentIndex(0); // Force the tab index to match
|
||||
|
||||
QStringList fixedWingTypes;
|
||||
@ -138,7 +138,7 @@ ConfigVehicleTypeWidget::ConfigVehicleTypeWidget(QWidget *parent) : ConfigTaskWi
|
||||
"Hexacopter" << "Hexacopter X" << "Hexacopter Y6" <<
|
||||
"Octocopter" << "Octocopter V" << "Octo Coax +" << "Octo Coax X" ;
|
||||
m_aircraft->multirotorFrameType->addItems(multiRotorTypes);
|
||||
m_aircraft->multirotorFrameType->setCurrentIndex(1); //Set default model to "Quad +"
|
||||
m_aircraft->multirotorFrameType->setCurrentIndex(2); //Set default model to "Quad X"
|
||||
|
||||
|
||||
//NEW STYLE: Loop through the widgets looking for all widgets that have "ChannelBox" in their name
|
||||
@ -194,9 +194,6 @@ ConfigVehicleTypeWidget::ConfigVehicleTypeWidget(QWidget *parent) : ConfigTaskWi
|
||||
m_heli = m_aircraft->widget_3;
|
||||
m_heli->setupUI(QString("HeliCP"));
|
||||
|
||||
// initialize the ui to show the mixersettings tab
|
||||
//mdl m_aircraft->tabWidget->setCurrentIndex(0);
|
||||
|
||||
//Connect aircraft type selection dropbox to callback function
|
||||
connect(m_aircraft->aircraftType, SIGNAL(currentIndexChanged(int)), this, SLOT(switchAirframeType(int)));
|
||||
|
||||
@ -255,16 +252,14 @@ QStringList ConfigVehicleTypeWidget::getChannelDescriptions()
|
||||
case SystemSettings::AIRFRAMETYPE_FIXEDWINGELEVON:
|
||||
case SystemSettings::AIRFRAMETYPE_FIXEDWINGVTAIL:
|
||||
{
|
||||
QPointer<ConfigFixedWingWidget> fixedwing = new ConfigFixedWingWidget();
|
||||
channelDesc = fixedwing->getChannelDescriptions();
|
||||
channelDesc = ConfigFixedWingWidget::getChannelDescriptions();
|
||||
}
|
||||
break;
|
||||
|
||||
// helicp
|
||||
case SystemSettings::AIRFRAMETYPE_HELICP:
|
||||
{
|
||||
QPointer<ConfigCcpmWidget> heli = new ConfigCcpmWidget();
|
||||
channelDesc = heli->getChannelDescriptions();
|
||||
channelDesc = ConfigCcpmWidget::getChannelDescriptions();
|
||||
}
|
||||
break;
|
||||
|
||||
@ -281,8 +276,7 @@ QStringList ConfigVehicleTypeWidget::getChannelDescriptions()
|
||||
case SystemSettings::AIRFRAMETYPE_HEXACOAX:
|
||||
case SystemSettings::AIRFRAMETYPE_HEXA:
|
||||
{
|
||||
QPointer<ConfigMultiRotorWidget> multi = new ConfigMultiRotorWidget();
|
||||
channelDesc = multi->getChannelDescriptions();
|
||||
channelDesc = ConfigMultiRotorWidget::getChannelDescriptions();
|
||||
}
|
||||
break;
|
||||
|
||||
@ -291,8 +285,7 @@ QStringList ConfigVehicleTypeWidget::getChannelDescriptions()
|
||||
case SystemSettings::AIRFRAMETYPE_GROUNDVEHICLEDIFFERENTIAL:
|
||||
case SystemSettings::AIRFRAMETYPE_GROUNDVEHICLEMOTORCYCLE:
|
||||
{
|
||||
QPointer<ConfigGroundVehicleWidget> ground = new ConfigGroundVehicleWidget();
|
||||
channelDesc = ground->getChannelDescriptions();
|
||||
channelDesc = ConfigGroundVehicleWidget::getChannelDescriptions();
|
||||
}
|
||||
break;
|
||||
|
||||
@ -460,15 +453,6 @@ void ConfigVehicleTypeWidget::enableFFTest()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Resets a mixer curve
|
||||
*/
|
||||
void ConfigVehicleTypeWidget::resetMixer(MixerCurveWidget *mixer, int numElements, double maxvalue)
|
||||
{
|
||||
// Setup all Throttle1 curves for all types of airframes
|
||||
mixer->initLinearCurve((quint32)numElements,maxvalue);
|
||||
}
|
||||
|
||||
/**************************
|
||||
* Aircraft settings
|
||||
**************************/
|
||||
|
@ -67,7 +67,6 @@ private:
|
||||
void updateCustomAirframeUI();
|
||||
void addToDirtyMonitor();
|
||||
void resetField(UAVObjectField * field);
|
||||
void resetMixer (MixerCurveWidget *mixer, int numElements, double maxvalue);
|
||||
|
||||
//void setMixerChannel(int channelNumber, bool channelIsMotor, QList<double> vector);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user