mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
Resolves mixer/advanced tab switching issue;
semi-centralized channelNames; renames ConfigCcpmWidget
This commit is contained in:
parent
64688be0a1
commit
2db4f6b2b6
@ -1376,7 +1376,7 @@ margin:1px;</string>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="ConfigccpmWidget" name="widget_3" native="true"/>
|
||||
<widget class="ConfigCcpmWidget" name="widget_3" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
@ -2801,12 +2801,12 @@ p, li { white-space: pre-wrap; }
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;">
|
||||
</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||
<table border="0" style="-qt-table-type: root; margin-top:4px; margin-bottom:4px; margin-left:4px; margin-right:4px;">
|
||||
<tr>
|
||||
<td style="border: none;">
|
||||
<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt; font-weight:600; color:#ff0000;">SETTING UP FEED FORWARD IS DANGEROUS</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"></p>
|
||||
<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Ubuntu'; font-size:14pt; font-weight:600; color:#ff0000;">SETTING UP FEED FORWARD IS DANGEROUS</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt;"></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Lucida Grande'; font-size:13pt;">Beware: Feed Forward Tuning will launch all engines around mid-throttle, you have been warned!</span></p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Lucida Grande'; font-size:13pt;">Remove your props initially, and for fine-tuning, make sure your airframe is safely held in place. Wear glasses and protect your face and body.</span></p></td></tr></table></body></html></string>
|
||||
</property>
|
||||
@ -2910,7 +2910,7 @@ p, li { white-space: pre-wrap; }
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>ConfigccpmWidget</class>
|
||||
<class>ConfigCcpmWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>cfg_vehicletypes/configccpmwidget.h</header>
|
||||
<container>1</container>
|
||||
@ -3016,22 +3016,6 @@ p, li { white-space: pre-wrap; }
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>mrPitchMixLevel</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
<receiver>mrPitchMixValue</receiver>
|
||||
<slot>setNum(int)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>83</x>
|
||||
<y>228</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>82</x>
|
||||
<y>168</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>mrRollMixLevel</sender>
|
||||
<signal>valueChanged(int)</signal>
|
||||
|
@ -44,7 +44,7 @@
|
||||
#define Pi 3.14159265358979323846
|
||||
|
||||
|
||||
ConfigccpmWidget::ConfigccpmWidget(QWidget *parent) : VehicleConfig(parent)
|
||||
ConfigCcpmWidget::ConfigCcpmWidget(QWidget *parent) : VehicleConfig(parent)
|
||||
{
|
||||
int i;
|
||||
SwashLvlConfigurationInProgress=0;
|
||||
@ -143,20 +143,20 @@ 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(channels);
|
||||
// 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(channels);
|
||||
m_ccpm->ccpmTailChannel->addItems(channelNames);
|
||||
m_ccpm->ccpmTailChannel->setCurrentIndex(0);
|
||||
m_ccpm->ccpmServoWChannel->addItems(channels);
|
||||
m_ccpm->ccpmServoWChannel->addItems(channelNames);
|
||||
m_ccpm->ccpmServoWChannel->setCurrentIndex(0);
|
||||
m_ccpm->ccpmServoXChannel->addItems(channels);
|
||||
m_ccpm->ccpmServoXChannel->addItems(channelNames);
|
||||
m_ccpm->ccpmServoXChannel->setCurrentIndex(0);
|
||||
m_ccpm->ccpmServoYChannel->addItems(channels);
|
||||
m_ccpm->ccpmServoYChannel->addItems(channelNames);
|
||||
m_ccpm->ccpmServoYChannel->setCurrentIndex(0);
|
||||
m_ccpm->ccpmServoZChannel->addItems(channels);
|
||||
m_ccpm->ccpmServoZChannel->addItems(channelNames);
|
||||
m_ccpm->ccpmServoZChannel->setCurrentIndex(0);
|
||||
|
||||
QStringList Types;
|
||||
@ -222,16 +222,16 @@ ConfigccpmWidget::ConfigccpmWidget(QWidget *parent) : VehicleConfig(parent)
|
||||
ccpmSwashplateRedraw();
|
||||
}
|
||||
|
||||
ConfigccpmWidget::~ConfigccpmWidget()
|
||||
ConfigCcpmWidget::~ConfigCcpmWidget()
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
void ConfigccpmWidget::setupUI(QString frameType)
|
||||
void ConfigCcpmWidget::setupUI(QString frameType)
|
||||
{
|
||||
}
|
||||
|
||||
void ConfigccpmWidget::ResetActuators(GUIConfigDataUnion* configData)
|
||||
void ConfigCcpmWidget::ResetActuators(GUIConfigDataUnion* configData)
|
||||
{
|
||||
configData->heli.Throttle = 0;
|
||||
configData->heli.Tail = 0;
|
||||
@ -241,13 +241,13 @@ void ConfigccpmWidget::ResetActuators(GUIConfigDataUnion* configData)
|
||||
configData->heli.ServoIndexZ = 0;
|
||||
}
|
||||
|
||||
QStringList ConfigccpmWidget::getChannelDescriptions()
|
||||
QStringList ConfigCcpmWidget::getChannelDescriptions()
|
||||
{
|
||||
int i;
|
||||
QStringList channelDesc;
|
||||
|
||||
// init a channel_numelem list of channel desc defaults
|
||||
for (i=0; i < (int)(ConfigccpmWidget::CHANNEL_NUMELEM); i++)
|
||||
for (i=0; i < (int)(ConfigCcpmWidget::CHANNEL_NUMELEM); i++)
|
||||
{
|
||||
channelDesc.append(QString("-"));
|
||||
}
|
||||
@ -306,7 +306,7 @@ QStringList ConfigccpmWidget::getChannelDescriptions()
|
||||
return channelDesc;
|
||||
}
|
||||
|
||||
void ConfigccpmWidget::UpdateType()
|
||||
void ConfigCcpmWidget::UpdateType()
|
||||
{
|
||||
int TypeInt,SingleServoIndex,NumServosDefined;
|
||||
QString TypeText;
|
||||
@ -483,12 +483,12 @@ void ConfigccpmWidget::UpdateType()
|
||||
/**
|
||||
Resets a mixer curve
|
||||
*/
|
||||
void ConfigccpmWidget::resetMixer(MixerCurveWidget *mixer, int numElements)
|
||||
void ConfigCcpmWidget::resetMixer(MixerCurveWidget *mixer, int numElements)
|
||||
{
|
||||
mixer->initLinearCurve(numElements,(double)1);
|
||||
}
|
||||
|
||||
void ConfigccpmWidget::UpdateCurveWidgets()
|
||||
void ConfigCcpmWidget::UpdateCurveWidgets()
|
||||
{
|
||||
int NumCurvePoints,i,Changed;
|
||||
QList<double> curveValues;
|
||||
@ -522,7 +522,7 @@ void ConfigccpmWidget::UpdateCurveWidgets()
|
||||
if (Changed==1)m_ccpm->PitchCurve->setCurve(curveValues);
|
||||
}
|
||||
|
||||
void ConfigccpmWidget::updatePitchCurveValue(QList<double> curveValues0,double Value0)
|
||||
void ConfigCcpmWidget::updatePitchCurveValue(QList<double> curveValues0,double Value0)
|
||||
{
|
||||
Q_UNUSED(curveValues0);
|
||||
Q_UNUSED(Value0);
|
||||
@ -546,7 +546,7 @@ void ConfigccpmWidget::updatePitchCurveValue(QList<double> curveValues0,double V
|
||||
|
||||
}
|
||||
|
||||
void ConfigccpmWidget::updateThrottleCurveValue(QList<double> curveValues0,double Value0)
|
||||
void ConfigCcpmWidget::updateThrottleCurveValue(QList<double> curveValues0,double Value0)
|
||||
{
|
||||
Q_UNUSED(curveValues0);
|
||||
Q_UNUSED(Value0);
|
||||
@ -571,7 +571,7 @@ void ConfigccpmWidget::updateThrottleCurveValue(QList<double> curveValues0,doubl
|
||||
}
|
||||
|
||||
|
||||
void ConfigccpmWidget::UpdateCurveSettings()
|
||||
void ConfigCcpmWidget::UpdateCurveSettings()
|
||||
{
|
||||
int NumCurvePoints,i;
|
||||
double scale;
|
||||
@ -701,7 +701,7 @@ void ConfigccpmWidget::UpdateCurveSettings()
|
||||
UpdateCurveWidgets();
|
||||
|
||||
}
|
||||
void ConfigccpmWidget::GenerateCurve()
|
||||
void ConfigCcpmWidget::GenerateCurve()
|
||||
{
|
||||
int NumCurvePoints,CurveToGenerate,i;
|
||||
double value1, value2, value3, scale;
|
||||
@ -771,7 +771,7 @@ void ConfigccpmWidget::GenerateCurve()
|
||||
|
||||
}
|
||||
|
||||
void ConfigccpmWidget::ccpmSwashplateRedraw()
|
||||
void ConfigCcpmWidget::ccpmSwashplateRedraw()
|
||||
{
|
||||
double angle[CCPM_MAX_SWASH_SERVOS],CorrectionAngle,x,y,w,h,radius,CenterX,CenterY;
|
||||
int used[CCPM_MAX_SWASH_SERVOS],defined[CCPM_MAX_SWASH_SERVOS],i;
|
||||
@ -872,14 +872,14 @@ void ConfigccpmWidget::ccpmSwashplateRedraw()
|
||||
//m_ccpm->SwashplateImage->fitInView(SwashplateImg, Qt::KeepAspectRatio);
|
||||
}
|
||||
|
||||
void ConfigccpmWidget::ccpmSwashplateUpdate()
|
||||
void ConfigCcpmWidget::ccpmSwashplateUpdate()
|
||||
{
|
||||
ccpmSwashplateRedraw();
|
||||
SetUIComponentVisibilities();
|
||||
UpdateMixer();
|
||||
}
|
||||
|
||||
void ConfigccpmWidget::UpdateMixer()
|
||||
void ConfigCcpmWidget::UpdateMixer()
|
||||
{
|
||||
bool useCCPM;
|
||||
bool useCyclic;
|
||||
@ -995,7 +995,7 @@ void ConfigccpmWidget::UpdateMixer()
|
||||
}
|
||||
|
||||
}
|
||||
QString ConfigccpmWidget::updateConfigObjectsFromWidgets() //UpdateCCPMOptionsFromUI()
|
||||
QString ConfigCcpmWidget::updateConfigObjectsFromWidgets() //UpdateCCPMOptionsFromUI()
|
||||
{
|
||||
QString airframeType = "HeliCP";
|
||||
|
||||
@ -1061,7 +1061,7 @@ QString ConfigccpmWidget::updateConfigObjectsFromWidgets() //UpdateCCPMOptionsFr
|
||||
return airframeType;
|
||||
}
|
||||
|
||||
void ConfigccpmWidget::refreshWidgetsValues(QString frameType) //UpdateCCPMUIFromOptions()
|
||||
void ConfigCcpmWidget::refreshWidgetsValues(QString frameType) //UpdateCCPMUIFromOptions()
|
||||
{
|
||||
Q_UNUSED(frameType);
|
||||
|
||||
@ -1106,8 +1106,10 @@ void ConfigccpmWidget::refreshWidgetsValues(QString frameType) //UpdateCCPMUIFro
|
||||
}
|
||||
|
||||
|
||||
void ConfigccpmWidget::SetUIComponentVisibilities()
|
||||
void ConfigCcpmWidget::SetUIComponentVisibilities()
|
||||
{
|
||||
//mdl updateObjectsFromWidgets();
|
||||
|
||||
GUIConfigDataUnion config = GetConfigData();
|
||||
|
||||
//set which sliders are user...
|
||||
@ -1137,7 +1139,7 @@ void ConfigccpmWidget::SetUIComponentVisibilities()
|
||||
/**
|
||||
Request the current value of the SystemSettings which holds the ccpm type
|
||||
*/
|
||||
void ConfigccpmWidget::getMixer()
|
||||
void ConfigCcpmWidget::getMixer()
|
||||
{
|
||||
if (SwashLvlConfigurationInProgress)return;
|
||||
if (updatingToHardware)return;
|
||||
@ -1167,7 +1169,7 @@ void ConfigccpmWidget::getMixer()
|
||||
/**
|
||||
Sends the config to the board (ccpm type)
|
||||
*/
|
||||
void ConfigccpmWidget::setMixer()
|
||||
void ConfigCcpmWidget::setMixer()
|
||||
{
|
||||
int i,j;
|
||||
|
||||
@ -1242,7 +1244,7 @@ void ConfigccpmWidget::setMixer()
|
||||
/**
|
||||
Send ccpm type to the board and request saving to SD card
|
||||
*/
|
||||
void ConfigccpmWidget::saveccpmUpdate()
|
||||
void ConfigCcpmWidget::saveccpmUpdate()
|
||||
{
|
||||
if (SwashLvlConfigurationInProgress)return;
|
||||
ShowDisclaimer(0);
|
||||
@ -1254,7 +1256,7 @@ void ConfigccpmWidget::saveccpmUpdate()
|
||||
saveObjectToSD(obj);
|
||||
}
|
||||
|
||||
void ConfigccpmWidget::resizeEvent(QResizeEvent* event)
|
||||
void ConfigCcpmWidget::resizeEvent(QResizeEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
// Make the custom table columns autostretch:
|
||||
@ -1266,7 +1268,7 @@ void ConfigccpmWidget::resizeEvent(QResizeEvent* event)
|
||||
ccpmSwashplateRedraw();
|
||||
|
||||
}
|
||||
void ConfigccpmWidget::showEvent(QShowEvent *event)
|
||||
void ConfigCcpmWidget::showEvent(QShowEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
m_ccpm->ccpmAdvancedSettingsTable->resizeColumnsToContents();
|
||||
@ -1278,7 +1280,7 @@ void ConfigccpmWidget::showEvent(QShowEvent *event)
|
||||
}
|
||||
|
||||
|
||||
void ConfigccpmWidget::SwashLvlStartButtonPressed()
|
||||
void ConfigCcpmWidget::SwashLvlStartButtonPressed()
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
int i;
|
||||
@ -1377,7 +1379,7 @@ void ConfigccpmWidget::SwashLvlStartButtonPressed()
|
||||
|
||||
|
||||
}
|
||||
void ConfigccpmWidget::SwashLvlNextButtonPressed()
|
||||
void ConfigCcpmWidget::SwashLvlNextButtonPressed()
|
||||
{
|
||||
//ShowDisclaimer(2);
|
||||
SwashLvlState++;
|
||||
@ -1480,7 +1482,7 @@ void ConfigccpmWidget::SwashLvlNextButtonPressed()
|
||||
break;
|
||||
}
|
||||
}
|
||||
void ConfigccpmWidget::SwashLvlCancelButtonPressed()
|
||||
void ConfigCcpmWidget::SwashLvlCancelButtonPressed()
|
||||
{
|
||||
int i;
|
||||
SwashLvlState=0;
|
||||
@ -1528,7 +1530,7 @@ void ConfigccpmWidget::SwashLvlCancelButtonPressed()
|
||||
}
|
||||
|
||||
|
||||
void ConfigccpmWidget::SwashLvlFinishButtonPressed()
|
||||
void ConfigCcpmWidget::SwashLvlFinishButtonPressed()
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -1572,7 +1574,7 @@ void ConfigccpmWidget::SwashLvlFinishButtonPressed()
|
||||
|
||||
}
|
||||
|
||||
int ConfigccpmWidget::ShowDisclaimer(int messageID)
|
||||
int ConfigCcpmWidget::ShowDisclaimer(int messageID)
|
||||
{
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText("<font color=red><h1>Warning!!!</h2></font>");
|
||||
@ -1621,7 +1623,7 @@ int ConfigccpmWidget::ShowDisclaimer(int messageID)
|
||||
Toggles the channel testing mode by making the GCS take over
|
||||
the ActuatorCommand objects
|
||||
*/
|
||||
void ConfigccpmWidget::enableSwashplateLevellingControl(bool state)
|
||||
void ConfigCcpmWidget::enableSwashplateLevellingControl(bool state)
|
||||
{
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
||||
@ -1661,7 +1663,7 @@ void ConfigccpmWidget::enableSwashplateLevellingControl(bool state)
|
||||
Sets the swashplate level to a given value based on current settings for Max, Neutral and Min values.
|
||||
level ranges -1 to +1
|
||||
*/
|
||||
void ConfigccpmWidget::setSwashplateLevel(int percent)
|
||||
void ConfigCcpmWidget::setSwashplateLevel(int percent)
|
||||
{
|
||||
if (percent<0)return;// -1;
|
||||
if (percent>100)return;// -1;
|
||||
@ -1696,7 +1698,7 @@ return;
|
||||
}
|
||||
|
||||
|
||||
void ConfigccpmWidget::SwashLvlSpinBoxChanged(int value)
|
||||
void ConfigCcpmWidget::SwashLvlSpinBoxChanged(int value)
|
||||
{
|
||||
Q_UNUSED(value);
|
||||
int i;
|
||||
@ -1740,7 +1742,7 @@ void ConfigccpmWidget::SwashLvlSpinBoxChanged(int value)
|
||||
/**
|
||||
This function displays text and color formatting in order to help the user understand what channels have not yet been configured.
|
||||
*/
|
||||
void ConfigccpmWidget::throwConfigError(QString airframeType)
|
||||
void ConfigCcpmWidget::throwConfigError(QString airframeType)
|
||||
{
|
||||
Q_UNUSED(airframeType);
|
||||
|
||||
|
@ -52,13 +52,13 @@ typedef struct {
|
||||
} SwashplateServoSettingsStruct;
|
||||
|
||||
|
||||
class ConfigccpmWidget: public VehicleConfig
|
||||
class ConfigCcpmWidget: public VehicleConfig
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ConfigccpmWidget(QWidget *parent = 0);
|
||||
~ConfigccpmWidget();
|
||||
ConfigCcpmWidget(QWidget *parent = 0);
|
||||
~ConfigCcpmWidget();
|
||||
|
||||
friend class ConfigVehicleTypeWidget;
|
||||
|
||||
|
@ -52,6 +52,9 @@
|
||||
ConfigMultiRotorWidget::ConfigMultiRotorWidget(Ui_AircraftWidget *aircraft, QWidget *parent) : VehicleConfig(parent)
|
||||
{
|
||||
m_aircraft = aircraft;
|
||||
|
||||
//connect(m_aircraft->multirotorFrameType, SIGNAL(currentIndexChanged(QString)), this, SLOT(setupUI(QString)));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -66,17 +69,23 @@ ConfigMultiRotorWidget::~ConfigMultiRotorWidget()
|
||||
void ConfigMultiRotorWidget::setupUI(QString frameType)
|
||||
{
|
||||
Q_ASSERT(m_aircraft);
|
||||
Q_ASSERT(uiowner);
|
||||
Q_ASSERT(quad);
|
||||
|
||||
int i;
|
||||
|
||||
// set aircraftType to Multirotor, disable triyaw channel
|
||||
setComboCurrentIndex(m_aircraft->aircraftType, m_aircraft->aircraftType->findText("Multirotor"));
|
||||
m_aircraft->triYawChannelBox->setEnabled(false);
|
||||
|
||||
// disable all motor channel boxes
|
||||
for (int i=1; i <=8; i++) {
|
||||
QComboBox *combobox = qFindChild<QComboBox*>(this->parent(), "multiMotorChannelBox" + QString::number(i));
|
||||
if (combobox)
|
||||
for (i=1; i <=8; i++) {
|
||||
// do it manually so we can turn off any error decorations
|
||||
QComboBox *combobox = qFindChild<QComboBox*>(uiowner, "multiMotorChannelBox" + QString::number(i));
|
||||
if (combobox) {
|
||||
combobox->setEnabled(false);
|
||||
combobox->setItemData(0, 0, Qt::DecorationRole);
|
||||
}
|
||||
}
|
||||
|
||||
if (frameType == "Tri" || frameType == "Tricopter Y") {
|
||||
@ -84,10 +93,8 @@ void ConfigMultiRotorWidget::setupUI(QString frameType)
|
||||
quad->setElementId("tri");
|
||||
|
||||
//Enable all necessary motor channel boxes...
|
||||
for (int i=1; i <=3; i++) {
|
||||
QComboBox *combobox = qFindChild<QComboBox*>(this->parent(), "multiMotorChannelBox" + QString::number(i));
|
||||
if (combobox)
|
||||
combobox->setEnabled(true);
|
||||
for (i=1; i <=3; i++) {
|
||||
enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true);
|
||||
}
|
||||
|
||||
m_aircraft->triYawChannelBox->setEnabled(true);
|
||||
@ -97,10 +104,8 @@ void ConfigMultiRotorWidget::setupUI(QString frameType)
|
||||
quad->setElementId("quad-X");
|
||||
|
||||
//Enable all necessary motor channel boxes...
|
||||
for (int i=1; i <=4; i++) {
|
||||
QComboBox *combobox = qFindChild<QComboBox*>(this->parent(), "multiMotorChannelBox" + QString::number(i));
|
||||
if (combobox)
|
||||
combobox->setEnabled(true);
|
||||
for (i=1; i <=4; i++) {
|
||||
enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true);
|
||||
}
|
||||
|
||||
m_aircraft->mrRollMixLevel->setValue(50);
|
||||
@ -112,10 +117,8 @@ void ConfigMultiRotorWidget::setupUI(QString frameType)
|
||||
quad->setElementId("quad-plus");
|
||||
|
||||
//Enable all necessary motor channel boxes...
|
||||
for (int i=1; i <=4; i++) {
|
||||
QComboBox *combobox = qFindChild<QComboBox*>(this->parent(), "multiMotorChannelBox" + QString::number(i));
|
||||
if (combobox)
|
||||
combobox->setEnabled(true);
|
||||
for (i=1; i <=4; i++) {
|
||||
enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true);
|
||||
}
|
||||
|
||||
m_aircraft->mrRollMixLevel->setValue(100);
|
||||
@ -128,10 +131,8 @@ void ConfigMultiRotorWidget::setupUI(QString frameType)
|
||||
quad->setElementId("quad-hexa");
|
||||
|
||||
//Enable all necessary motor channel boxes...
|
||||
for (int i=1; i <=6; i++) {
|
||||
QComboBox *combobox = qFindChild<QComboBox*>(this->parent(), "multiMotorChannelBox" + QString::number(i));
|
||||
if (combobox)
|
||||
combobox->setEnabled(true);
|
||||
for (i=1; i <=6; i++) {
|
||||
enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true);
|
||||
}
|
||||
|
||||
m_aircraft->mrRollMixLevel->setValue(50);
|
||||
@ -143,10 +144,8 @@ void ConfigMultiRotorWidget::setupUI(QString frameType)
|
||||
quad->setElementId("quad-hexa-H");
|
||||
|
||||
//Enable all necessary motor channel boxes...
|
||||
for (int i=1; i <=6; i++) {
|
||||
QComboBox *combobox = qFindChild<QComboBox*>(this->parent(), "multiMotorChannelBox" + QString::number(i));
|
||||
if (combobox)
|
||||
combobox->setEnabled(true);
|
||||
for (i=1; i <=6; i++) {
|
||||
enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true);
|
||||
}
|
||||
|
||||
m_aircraft->mrRollMixLevel->setValue(33);
|
||||
@ -160,10 +159,8 @@ void ConfigMultiRotorWidget::setupUI(QString frameType)
|
||||
quad->setElementId("hexa-coax");
|
||||
|
||||
//Enable all necessary motor channel boxes...
|
||||
for (int i=1; i <=6; i++) {
|
||||
QComboBox *combobox = qFindChild<QComboBox*>(this->parent(), "multiMotorChannelBox" + QString::number(i));
|
||||
if (combobox)
|
||||
combobox->setEnabled(true);
|
||||
for (i=1; i <=6; i++) {
|
||||
enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true);
|
||||
}
|
||||
|
||||
m_aircraft->mrRollMixLevel->setValue(100);
|
||||
@ -177,10 +174,8 @@ void ConfigMultiRotorWidget::setupUI(QString frameType)
|
||||
quad->setElementId("quad-octo");
|
||||
|
||||
//Enable all necessary motor channel boxes
|
||||
for (int i=1; i <=8; i++) {
|
||||
QComboBox *combobox = qFindChild<QComboBox*>(this->parent(), "multiMotorChannelBox" + QString::number(i));
|
||||
if (combobox)
|
||||
combobox->setEnabled(true);
|
||||
for (i=1; i <=8; i++) {
|
||||
enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true);
|
||||
}
|
||||
|
||||
m_aircraft->mrRollMixLevel->setValue(33);
|
||||
@ -193,10 +188,8 @@ void ConfigMultiRotorWidget::setupUI(QString frameType)
|
||||
quad->setElementId("quad-octo-v");
|
||||
|
||||
//Enable all necessary motor channel boxes
|
||||
for (int i=1; i <=8; i++) {
|
||||
QComboBox *combobox = qFindChild<QComboBox*>(this->parent(), "multiMotorChannelBox" + QString::number(i));
|
||||
if (combobox)
|
||||
combobox->setEnabled(true);
|
||||
for (i=1; i <=8; i++) {
|
||||
enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true);
|
||||
}
|
||||
|
||||
m_aircraft->mrRollMixLevel->setValue(25);
|
||||
@ -210,10 +203,8 @@ void ConfigMultiRotorWidget::setupUI(QString frameType)
|
||||
quad->setElementId("octo-coax-P");
|
||||
|
||||
//Enable all necessary motor channel boxes
|
||||
for (int i=1; i <=8; i++) {
|
||||
QComboBox *combobox = qFindChild<QComboBox*>(this->parent(), "multiMotorChannelBox" + QString::number(i));
|
||||
if (combobox)
|
||||
combobox->setEnabled(true);
|
||||
for (int i=1; i <=8; i++) {
|
||||
enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true);
|
||||
}
|
||||
|
||||
m_aircraft->mrRollMixLevel->setValue(100);
|
||||
@ -227,10 +218,8 @@ void ConfigMultiRotorWidget::setupUI(QString frameType)
|
||||
quad->setElementId("octo-coax-X");
|
||||
|
||||
//Enable all necessary motor channel boxes
|
||||
for (int i=1; i <=8; i++) {
|
||||
QComboBox *combobox = qFindChild<QComboBox*>(this->parent(), "multiMotorChannelBox" + QString::number(i));
|
||||
if (combobox)
|
||||
combobox->setEnabled(true);
|
||||
for (int i=1; i <=8; i++) {
|
||||
enableComboBox(uiowner, QString("multiMotorChannelBox%0").arg(i), true);
|
||||
}
|
||||
|
||||
m_aircraft->mrRollMixLevel->setValue(50);
|
||||
@ -1118,34 +1107,24 @@ bool ConfigMultiRotorWidget::setupMultiRotorMixer(double mixerFactors[8][3])
|
||||
This function displays text and color formatting in order to help the user understand what channels have not yet been configured.
|
||||
*/
|
||||
void ConfigMultiRotorWidget::throwConfigError(int numMotors)
|
||||
{
|
||||
{
|
||||
//Initialize configuration error flag
|
||||
bool error=false;
|
||||
|
||||
//Iterate through all instances of multiMotorChannelBox
|
||||
for (int i=0; i<numMotors; i++) {
|
||||
//Fine widgets with text "multiMotorChannelBox.x", where x is an integer
|
||||
QComboBox *combobox = qFindChild<QComboBox*>(this, "multiMotorChannelBox" + QString::number(i+1));
|
||||
if (combobox){ //if QLabel exists
|
||||
// QLabel *label = qFindChild<QLabel*>(this, "MotorOutputLabel" + QString::number(i+1));
|
||||
|
||||
if (combobox->currentText() == "None") {
|
||||
|
||||
// label->setText("<font color='red'>" + label->text() + "</font>");
|
||||
|
||||
QComboBox *combobox = qFindChild<QComboBox*>(uiowner, "multiMotorChannelBox" + QString::number(i+1));
|
||||
if (combobox){
|
||||
if (combobox->currentText() == "None") {
|
||||
int size = combobox->style()->pixelMetric(QStyle::PM_SmallIconSize);
|
||||
QPixmap pixmap(size,size);
|
||||
pixmap.fill(QColor("red"));
|
||||
combobox->setItemData(0, pixmap, Qt::DecorationRole);//Set color palettes
|
||||
// combobox->setStyleSheet("QComboBox { color: red}");
|
||||
combobox->setItemData(0, pixmap, Qt::DecorationRole);//Set color palettes
|
||||
error=true;
|
||||
|
||||
}
|
||||
else {
|
||||
combobox->setItemData(0, 0, Qt::DecorationRole);//Reset color palettes
|
||||
// combobox->setStyleSheet("color: black;");
|
||||
// QTextEdit* htmlText=new QTextEdit(label->text()); // htmlText is any QString with html tags.
|
||||
// label->setText(htmlText->toPlainText());
|
||||
combobox->setItemData(0, 0, Qt::DecorationRole);//Reset color palettes
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -53,6 +53,7 @@ public:
|
||||
private:
|
||||
Ui_AircraftWidget *m_aircraft;
|
||||
|
||||
QWidget *uiowner;
|
||||
QGraphicsSvgItem *quad;
|
||||
|
||||
bool setupQuad(bool pLayout);
|
||||
@ -74,6 +75,8 @@ private slots:
|
||||
|
||||
protected:
|
||||
|
||||
signals:
|
||||
void configurationChanged();
|
||||
|
||||
};
|
||||
|
||||
|
@ -36,9 +36,12 @@
|
||||
|
||||
VehicleConfig::VehicleConfig(QWidget *parent) : ConfigTaskWidget(parent)
|
||||
{
|
||||
//Generate lists of mixerTypeNames, mixerVectorNames, channelNames
|
||||
channelNames << "None";
|
||||
for (int i = 0; i < (int)(VehicleConfig::CHANNEL_NUMELEM); i++) {
|
||||
mixerTypes << QString("Mixer%1Type").arg(i+1);
|
||||
mixerVectors << QString("Mixer%1Vector").arg(i+1);
|
||||
channelNames << QString("Channel%1").arg(i+1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -119,6 +122,17 @@ void VehicleConfig::setComboCurrentIndex(QComboBox* box, int index)
|
||||
box->setCurrentIndex(index);
|
||||
}
|
||||
|
||||
/**
|
||||
Helper function:
|
||||
enables/disables the named combobox within supplied uiowner
|
||||
*/
|
||||
void VehicleConfig::enableComboBox(QWidget* owner, QString boxName, bool enable)
|
||||
{
|
||||
QComboBox* box = qFindChild<QComboBox*>(owner, boxName);
|
||||
if (box)
|
||||
box->setEnabled(enable);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Reset the contents of a field
|
||||
|
@ -115,10 +115,12 @@ class VehicleConfig: public ConfigTaskWidget
|
||||
static void SetConfigData(GUIConfigDataUnion configData);
|
||||
static void resetField(UAVObjectField * field);
|
||||
static void setComboCurrentIndex(QComboBox* box, int index);
|
||||
static void enableComboBox(QWidget* owner, QString boxName, bool enable);
|
||||
|
||||
virtual void ResetActuators(GUIConfigDataUnion* configData);
|
||||
virtual QStringList getChannelDescriptions();
|
||||
|
||||
QStringList channelNames;
|
||||
QStringList mixerTypes;
|
||||
QStringList mixerVectors;
|
||||
|
||||
|
@ -106,13 +106,12 @@ ConfigVehicleTypeWidget::ConfigVehicleTypeWidget(QWidget *parent) : ConfigTaskWi
|
||||
ffTuningInProgress = false;
|
||||
ffTuningPhase = false;
|
||||
|
||||
//Generate list of channels
|
||||
QStringList channels;
|
||||
channels << "None";
|
||||
//Generate lists of mixerTypeNames, mixerVectorNames, channelNames
|
||||
channelNames << "None";
|
||||
for (int i = 0; i < ActuatorSettings::CHANNELADDR_NUMELEM; i++) {
|
||||
mixerTypes << QString("Mixer%1Type").arg(i+1);
|
||||
mixerVectors << QString("Mixer%1Vector").arg(i+1);
|
||||
channels << QString("Channel%1").arg(i+1);
|
||||
channelNames << QString("Channel%1").arg(i+1);
|
||||
}
|
||||
|
||||
QStringList airframeTypes;
|
||||
@ -142,7 +141,7 @@ ConfigVehicleTypeWidget::ConfigVehicleTypeWidget(QWidget *parent) : ConfigTaskWi
|
||||
// The upshot of this is that ALL new ComboBox widgets for selecting the output channel must have "ChannelBox" in their name
|
||||
foreach(QComboBox *combobox, this->findChildren<QComboBox*>(QRegExp("\\S+ChannelBo\\S+")))//FOR WHATEVER REASON, THIS DOES NOT WORK WITH ChannelBox. ChannelBo is sufficiently accurate
|
||||
{
|
||||
combobox->addItems(channels);
|
||||
combobox->addItems(channelNames);
|
||||
}
|
||||
|
||||
// Setup the Multirotor picture in the Quad settings interface
|
||||
@ -173,19 +172,27 @@ ConfigVehicleTypeWidget::ConfigVehicleTypeWidget(QWidget *parent) : ConfigTaskWi
|
||||
m_aircraft->customMixerTable->setItemDelegateForRow(i, sbd);
|
||||
}
|
||||
|
||||
m_multirotor = new ConfigMultiRotorWidget(m_aircraft, this);
|
||||
// create and setup a MultiRotor config widget
|
||||
m_multirotor = new ConfigMultiRotorWidget(m_aircraft);
|
||||
m_multirotor->quad = quad;
|
||||
m_multirotor->uiowner = this;
|
||||
m_multirotor->setupUI(m_aircraft->multirotorFrameType->currentText());
|
||||
|
||||
m_groundvehicle = new ConfigGroundVehicleWidget(m_aircraft, this);
|
||||
// create and setup a GroundVehicle config widget
|
||||
m_groundvehicle = new ConfigGroundVehicleWidget(m_aircraft);
|
||||
m_groundvehicle->setupUI(m_aircraft->groundVehicleType->currentText() );
|
||||
|
||||
m_fixedwing = new ConfigFixedWingWidget(m_aircraft, this);
|
||||
// create and setup a FixedWing config widget
|
||||
m_fixedwing = new ConfigFixedWingWidget(m_aircraft);
|
||||
m_fixedwing->setupUI(m_aircraft->fixedWingType->currentText() );
|
||||
|
||||
m_heli = m_aircraft->widget_3;// new ConfigccpmWidget(this);
|
||||
// create and setup a Helicopter config widget
|
||||
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)));
|
||||
|
||||
@ -238,6 +245,11 @@ ConfigVehicleTypeWidget::~ConfigVehicleTypeWidget()
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
/**
|
||||
Static function to get currently assigned channelDescriptions
|
||||
for all known vehicle types; instantiates the appropriate object
|
||||
then asks it to supply channel descs
|
||||
*/
|
||||
QStringList ConfigVehicleTypeWidget::getChannelDescriptions()
|
||||
{
|
||||
int i;
|
||||
@ -267,7 +279,7 @@ QStringList ConfigVehicleTypeWidget::getChannelDescriptions()
|
||||
// helicp
|
||||
case SystemSettings::AIRFRAMETYPE_HELICP:
|
||||
{
|
||||
ConfigccpmWidget* heli = new ConfigccpmWidget();
|
||||
ConfigCcpmWidget* heli = new ConfigCcpmWidget();
|
||||
channelDesc = heli->getChannelDescriptions();
|
||||
}
|
||||
break;
|
||||
@ -402,7 +414,6 @@ void ConfigVehicleTypeWidget::toggleRudder2(int index)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////
|
||||
/// Feed Forward Testing
|
||||
/////////////////////////////////////////////////////////
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
private:
|
||||
Ui_AircraftWidget *m_aircraft;
|
||||
|
||||
ConfigccpmWidget *m_heli;
|
||||
ConfigCcpmWidget *m_heli;
|
||||
ConfigFixedWingWidget *m_fixedwing;
|
||||
ConfigMultiRotorWidget *m_multirotor;
|
||||
ConfigGroundVehicleWidget *m_groundvehicle;
|
||||
@ -70,9 +70,10 @@ private:
|
||||
|
||||
//void setMixerChannel(int channelNumber, bool channelIsMotor, QList<double> vector);
|
||||
|
||||
|
||||
QStringList channelNames;
|
||||
QStringList mixerTypes;
|
||||
QStringList mixerVectors;
|
||||
|
||||
QGraphicsSvgItem *quad;
|
||||
bool ffTuningInProgress;
|
||||
bool ffTuningPhase;
|
||||
@ -85,7 +86,6 @@ private slots:
|
||||
|
||||
void setComboCurrentIndex(QComboBox* box, int index);
|
||||
|
||||
|
||||
void setupAirframeUI(QString type);
|
||||
|
||||
void toggleAileron2(int index);
|
||||
|
Loading…
Reference in New Issue
Block a user