From 22e0b88a8f75d070ad0a1ba19990c48b3aaa6e5d Mon Sep 17 00:00:00 2001 From: samguns Date: Tue, 17 Mar 2015 15:51:06 +0800 Subject: [PATCH] OP-1781 Add UI stuff and basic definitions --- .../src/plugins/config/configinputwidget.cpp | 37 ++++++++++++++++++- .../src/plugins/config/configinputwidget.h | 3 +- .../src/plugins/config/input_wizard.ui | 11 +++++- 3 files changed, 46 insertions(+), 5 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp b/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp index 83de7fad6..6481259aa 100644 --- a/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp @@ -349,6 +349,12 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) : ManualControlSettings::CHANNELGROUPS_ACCESSORY1 << ManualControlSettings::CHANNELGROUPS_ACCESSORY2; + groundChannelOrder << ManualControlSettings::CHANNELGROUPS_THROTTLE << + ManualControlSettings::CHANNELGROUPS_YAW << + ManualControlSettings::CHANNELGROUPS_ACCESSORY0 << + ManualControlSettings::CHANNELGROUPS_ACCESSORY1 << + ManualControlSettings::CHANNELGROUPS_ACCESSORY2; + updateEnableControls(); } @@ -629,6 +635,8 @@ void ConfigInputWidget::wizardSetUpStep(enum wizardSteps step) wizardUi->wzBack->setEnabled(true); if (transmitterType == heli) { wizardUi->typeHeli->setChecked(true); + } else if (transmitterType == ground) { + wizardUi->typeGround->setChecked(true); } else { wizardUi->typeAcro->setChecked(true); } @@ -687,6 +695,9 @@ void ConfigInputWidget::wizardSetUpStep(enum wizardSteps step) case wizardIdentifyCenter: setTxMovement(centerAll); wizardUi->pagesStack->setCurrentWidget(wizardUi->identifyCenterPage); + if (transmitterType == ground) { + wizardUi->identifyCenterInstructions->setText(QString(tr("Please center all controls and trims and press Next when ready."))); + } break; case wizardIdentifyLimits: { @@ -752,6 +763,8 @@ void ConfigInputWidget::wizardTearDownStep(enum wizardSteps step) case wizardChooseType: if (wizardUi->typeAcro->isChecked()) { transmitterType = acro; + } else if (wizardUi->typeGround->isChecked()) { + transmitterType = ground; } else { transmitterType = heli; } @@ -885,7 +898,14 @@ void ConfigInputWidget::setChannel(int newChan) */ void ConfigInputWidget::nextChannel() { - QList order = (transmitterType == heli) ? heliChannelOrder : acroChannelOrder; + QList order; + if (transmitterType == heli) { + order = heliChannelOrder; + } else if (transmitterType == ground) { + order = groundChannelOrder; + } else { + order = acroChannelOrder; + } if (currentChannelNum == -1) { setChannel(order[0]); @@ -906,7 +926,14 @@ void ConfigInputWidget::nextChannel() */ void ConfigInputWidget::prevChannel() { - QList order = transmitterType == heli ? heliChannelOrder : acroChannelOrder; + QList order; + if (transmitterType == heli) { + order = heliChannelOrder; + } else if (transmitterType == ground) { + order = groundChannelOrder; + } else { + order = acroChannelOrder; + } // No previous from unset channel or next state if (currentChannelNum == -1) { @@ -1672,6 +1699,12 @@ void ConfigInputWidget::adjustSpecialNeutrals() manualSettingsData.ChannelMin[ManualControlSettings::CHANNELMIN_THROTTLE] + ((manualSettingsData.ChannelMax[ManualControlSettings::CHANNELMAX_THROTTLE] - manualSettingsData.ChannelMin[ManualControlSettings::CHANNELMIN_THROTTLE]) * 0.04); + + if (transmitterType == ground) { + manualSettingsData.ChannelNeutral[ManualControlSettings::CHANNELNEUTRAL_THROTTLE] = + (manualSettingsData.ChannelMax[ManualControlSettings::CHANNELMAX_THROTTLE] + + manualSettingsData.ChannelMin[ManualControlSettings::CHANNELMIN_THROTTLE]) / 2; + } } void ConfigInputWidget::checkThrottleRange() diff --git a/ground/openpilotgcs/src/plugins/config/configinputwidget.h b/ground/openpilotgcs/src/plugins/config/configinputwidget.h index 3c2a138d2..61e1d2385 100644 --- a/ground/openpilotgcs/src/plugins/config/configinputwidget.h +++ b/ground/openpilotgcs/src/plugins/config/configinputwidget.h @@ -62,7 +62,7 @@ public: enum txMode { mode1, mode2, mode3, mode4 }; enum txMovements { moveLeftVerticalStick, moveRightVerticalStick, moveLeftHorizontalStick, moveRightHorizontalStick, moveAccess0, moveAccess1, moveAccess2, moveFlightMode, centerAll, moveAll, nothing }; enum txMovementType { vertical, horizontal, jump, mix }; - enum txType { acro, heli }; + enum txType { acro, heli, ground }; void startInputWizard() { goToWizard(); @@ -111,6 +111,7 @@ private: int currentChannelNum; QList heliChannelOrder; QList acroChannelOrder; + QList groundChannelOrder; UAVObject::Metadata manualControlMdata; ManualControlCommand *manualCommandObj; diff --git a/ground/openpilotgcs/src/plugins/config/input_wizard.ui b/ground/openpilotgcs/src/plugins/config/input_wizard.ui index dcdfa541f..34b3b5945 100644 --- a/ground/openpilotgcs/src/plugins/config/input_wizard.ui +++ b/ground/openpilotgcs/src/plugins/config/input_wizard.ui @@ -14,7 +14,7 @@ - 0 + 1 @@ -64,6 +64,13 @@ You can press 'back' at any time to return to the previous screen or press 'Canc + + + + Ground vehicle: has at least two channels for throttle and steering (yaw) + + + @@ -89,7 +96,7 @@ You can press 'back' at any time to return to the previous screen or press 'Canc 20 - 40 + 23