1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-19 04:52:12 +01:00

OP-1781 Add UI stuff and basic definitions

This commit is contained in:
samguns 2015-03-17 15:51:06 +08:00
parent 5c9b6fac29
commit 22e0b88a8f
3 changed files with 46 additions and 5 deletions

View File

@ -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 <int> order = (transmitterType == heli) ? heliChannelOrder : acroChannelOrder;
QList <int> 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 <int> order = transmitterType == heli ? heliChannelOrder : acroChannelOrder;
QList <int> 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()

View File

@ -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<int> heliChannelOrder;
QList<int> acroChannelOrder;
QList<int> groundChannelOrder;
UAVObject::Metadata manualControlMdata;
ManualControlCommand *manualCommandObj;

View File

@ -14,7 +14,7 @@
<item>
<widget class="QStackedWidget" name="pagesStack">
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="welcomePage">
<layout class="QGridLayout" name="gridLayout">
@ -64,6 +64,13 @@ You can press 'back' at any time to return to the previous screen or press 'Canc
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="typeGround">
<property name="text">
<string>Ground vehicle: has at least two channels for throttle and steering (yaw)</string>
</property>
</widget>
</item>
<item>
<widget class="QRadioButton" name="typeHeli">
<property name="text">
@ -89,7 +96,7 @@ You can press 'back' at any time to return to the previous screen or press 'Canc
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
<height>23</height>
</size>
</property>
</spacer>