1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-03-01 18:29:16 +01:00

1. Revise according to review results. 2. Force one flight mode if 2CH ground vehicle was confirmed.

This commit is contained in:
samguns 2015-03-19 15:06:22 +08:00
parent 30a40140be
commit f806a9d3f2
3 changed files with 28 additions and 21 deletions
ground/openpilotgcs/src/plugins/config

@ -558,6 +558,11 @@ void ConfigInputWidget::wzNext()
throttleError = false; throttleError = false;
checkThrottleRange(); checkThrottleRange();
// Force flight mode number to be 1 if 2 CH ground vehicle was selected
if (transmitterType == ground) {
forceOneFlightMode();
}
manualSettingsObj->setData(manualSettingsData); manualSettingsObj->setData(manualSettingsData);
// move to Arming Settings tab // move to Arming Settings tab
ui->stackedWidget->setCurrentIndex(0); ui->stackedWidget->setCurrentIndex(0);
@ -698,7 +703,6 @@ void ConfigInputWidget::wizardSetUpStep(enum wizardSteps step)
if (transmitterType == ground) { if (transmitterType == ground) {
wizardUi->identifyCenterInstructions->setText(QString(tr("Please center all controls and trims and press Next when ready.\n\n" wizardUi->identifyCenterInstructions->setText(QString(tr("Please center all controls and trims and press Next when ready.\n\n"
"For a ground vehicle, this center position will be used as neutral value of each channel."))); "For a ground vehicle, this center position will be used as neutral value of each channel.")));
connect(manualCommandObj, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(identifyCenters()));
} }
break; break;
case wizardIdentifyLimits: case wizardIdentifyLimits:
@ -933,12 +937,16 @@ void ConfigInputWidget::nextChannel()
void ConfigInputWidget::prevChannel() void ConfigInputWidget::prevChannel()
{ {
QList <int> order; QList <int> order;
if (transmitterType == heli) { switch (transmitterType) {
case heli:
order = heliChannelOrder; order = heliChannelOrder;
} else if (transmitterType == ground) { break;
case ground:
order = groundChannelOrder; order = groundChannelOrder;
} else { break;
default:
order = acroChannelOrder; order = acroChannelOrder;
break;
} }
// No previous from unset channel or next state // No previous from unset channel or next state
@ -1048,19 +1056,6 @@ void ConfigInputWidget::identifyLimits()
manualSettingsObj->setData(manualSettingsData); manualSettingsObj->setData(manualSettingsData);
} }
void ConfigInputWidget::identifyCenters()
{
if (transmitterType != ground) {
return;
}
manualCommandData = manualCommandObj->getData();
manualSettingsData.ChannelNeutral[ManualControlSettings::CHANNELNUMBER_THROTTLE] =
manualCommandData.Channel[ManualControlSettings::CHANNELNUMBER_THROTTLE];
manualSettingsObj->setData(manualSettingsData);
}
void ConfigInputWidget::setMoveFromCommand(int command) void ConfigInputWidget::setMoveFromCommand(int command)
{ {
// ManualControlSettings::ChannelNumberElem: // ManualControlSettings::ChannelNumberElem:
@ -1686,7 +1681,7 @@ void ConfigInputWidget::simpleCalibration(bool enable)
tr("<p>Are you configuring a transmitter for your <b>ground vehicle</b> with reversible motor<br>" tr("<p>Are you configuring a transmitter for your <b>ground vehicle</b> with reversible motor<br>"
"controlled by throttle stick?</p>" "controlled by throttle stick?</p>"
"<p>If so, please make sure you've centered throttle control and press <b>Yes</b> button. Otherwise, press No.</p>" "<p>If so, please make sure you've centered throttle control and press <b>Yes</b> button. Otherwise, press No.</p>"
"<p>Attention, if you press <b>Yes</b>, then the flight modes will be set to 1.</p>"), "<p>Attention, if you press <b>Yes</b>, then the <b>Flight Mode Count</b> will be set to 1.</p>"),
QMessageBox::Yes | QMessageBox::No); QMessageBox::Yes | QMessageBox::No);
if (reply == QMessageBox::Yes) { if (reply == QMessageBox::Yes) {
@ -1697,6 +1692,11 @@ void ConfigInputWidget::simpleCalibration(bool enable)
restoreMdataSingle(manualCommandObj, &manualControlMdata); restoreMdataSingle(manualCommandObj, &manualControlMdata);
// Force flight mode number to be 1 if 2 channel ground vehicle was confirmed
if (transmitterType == ground) {
forceOneFlightMode();
}
for (unsigned int i = 0; i < ManualControlCommand::CHANNEL_NUMELEM; i++) { for (unsigned int i = 0; i < ManualControlCommand::CHANNEL_NUMELEM; i++) {
if ((i == ManualControlSettings::CHANNELNUMBER_FLIGHTMODE) || (i == ManualControlSettings::CHANNELNUMBER_THROTTLE)) { if ((i == ManualControlSettings::CHANNELNUMBER_FLIGHTMODE) || (i == ManualControlSettings::CHANNELNUMBER_THROTTLE)) {
adjustSpecialNeutrals(); adjustSpecialNeutrals();
@ -1804,3 +1804,10 @@ void ConfigInputWidget::resetActuatorSettings()
actuatorSettingsObj->setData(actuatorSettingsData); actuatorSettingsObj->setData(actuatorSettingsData);
} }
} }
void ConfigInputWidget::forceOneFlightMode()
{
manualCommandData = manualCommandObj->getData();
manualSettingsData.FlightModeNumber = 1;
manualSettingsObj->setData(manualSettingsData);
}

@ -193,7 +193,6 @@ private slots:
void openHelp(); void openHelp();
void identifyControls(); void identifyControls();
void identifyLimits(); void identifyLimits();
void identifyCenters();
void moveTxControls(); void moveTxControls();
void moveSticks(); void moveSticks();
void dimOtherControls(bool value); void dimOtherControls(bool value);
@ -206,6 +205,7 @@ private slots:
void updateCalibration(); void updateCalibration();
void resetChannelSettings(); void resetChannelSettings();
void resetActuatorSettings(); void resetActuatorSettings();
void forceOneFlightMode();
protected: protected:
void resizeEvent(QResizeEvent *event); void resizeEvent(QResizeEvent *event);

@ -14,7 +14,7 @@
<item> <item>
<widget class="QStackedWidget" name="pagesStack"> <widget class="QStackedWidget" name="pagesStack">
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>0</number>
</property> </property>
<widget class="QWidget" name="welcomePage"> <widget class="QWidget" name="welcomePage">
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
@ -81,7 +81,7 @@ You can press 'back' at any time to return to the previous screen or press 'Canc
<item> <item>
<widget class="QLabel" name="typePageFooter"> <widget class="QLabel" name="typePageFooter">
<property name="text"> <property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If selecting the Helicopter option, please engage throttle hold now.&lt;/p&gt;&lt;p&gt;If selecting the Surface option, the flight mode will be set to be only one mode.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If selecting the Helicopter option, please engage throttle hold now.&lt;/p&gt;&lt;p&gt;If selecting the Surface option, the &lt;b&gt;Flight Mode Count&lt;/b&gt; will be set to be 1.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="wordWrap"> <property name="wordWrap">
<bool>true</bool> <bool>true</bool>