1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-19 04:52:12 +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

View File

@ -558,6 +558,11 @@ void ConfigInputWidget::wzNext()
throttleError = false;
checkThrottleRange();
// Force flight mode number to be 1 if 2 CH ground vehicle was selected
if (transmitterType == ground) {
forceOneFlightMode();
}
manualSettingsObj->setData(manualSettingsData);
// move to Arming Settings tab
ui->stackedWidget->setCurrentIndex(0);
@ -698,7 +703,6 @@ void ConfigInputWidget::wizardSetUpStep(enum wizardSteps step)
if (transmitterType == ground) {
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.")));
connect(manualCommandObj, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(identifyCenters()));
}
break;
case wizardIdentifyLimits:
@ -933,12 +937,16 @@ void ConfigInputWidget::nextChannel()
void ConfigInputWidget::prevChannel()
{
QList <int> order;
if (transmitterType == heli) {
switch (transmitterType) {
case heli:
order = heliChannelOrder;
} else if (transmitterType == ground) {
break;
case ground:
order = groundChannelOrder;
} else {
break;
default:
order = acroChannelOrder;
break;
}
// No previous from unset channel or next state
@ -1048,19 +1056,6 @@ void ConfigInputWidget::identifyLimits()
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)
{
// 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>"
"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>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);
if (reply == QMessageBox::Yes) {
@ -1697,6 +1692,11 @@ void ConfigInputWidget::simpleCalibration(bool enable)
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++) {
if ((i == ManualControlSettings::CHANNELNUMBER_FLIGHTMODE) || (i == ManualControlSettings::CHANNELNUMBER_THROTTLE)) {
adjustSpecialNeutrals();
@ -1804,3 +1804,10 @@ void ConfigInputWidget::resetActuatorSettings()
actuatorSettingsObj->setData(actuatorSettingsData);
}
}
void ConfigInputWidget::forceOneFlightMode()
{
manualCommandData = manualCommandObj->getData();
manualSettingsData.FlightModeNumber = 1;
manualSettingsObj->setData(manualSettingsData);
}

View File

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

View File

@ -14,7 +14,7 @@
<item>
<widget class="QStackedWidget" name="pagesStack">
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="welcomePage">
<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>
<widget class="QLabel" name="typePageFooter">
<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 name="wordWrap">
<bool>true</bool>