mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-18 08:54:15 +01:00
Merge branch 'fix_input' into next
This commit is contained in:
commit
2050ce3fe1
@ -618,224 +618,6 @@ void ConfigInputWidget::restoreMdata()
|
||||
manualCommandObj->setMetadata(manualControlMdata);
|
||||
}
|
||||
|
||||
//void ConfigInputWidget::setupWizardWidget(int step)
|
||||
//{
|
||||
// if(step==wizardWelcome)
|
||||
// {
|
||||
// m_config->graphicsView->setVisible(false);
|
||||
// setTxMovement(nothing);
|
||||
// if(wizardStep==wizardChooseMode)
|
||||
// {
|
||||
// delete extraWidgets.at(0);
|
||||
// delete extraWidgets.at(1);
|
||||
// extraWidgets.clear();
|
||||
// }
|
||||
// manualSettingsData=manualSettingsObj->getData();
|
||||
// manualSettingsData.Arming=ManualControlSettings::ARMING_ALWAYSDISARMED;
|
||||
// manualSettingsObj->setData(manualSettingsData);
|
||||
// m_config->wzText->setText(tr("Welcome to the inputs configuration wizard.\n"
|
||||
// "Please follow the instructions on the screen and only move your controls when asked to.\n"
|
||||
// "Make sure you already configured your hardware settings on the proper tab and restarted your board.\n"
|
||||
// "At any time you can press 'back' to return to the previous screeen or 'Cancel' to cancel the wizard.\n"));
|
||||
// m_config->stackedWidget->setCurrentIndex(1);
|
||||
// m_config->wzBack->setEnabled(false);
|
||||
// wizardStep=wizardWelcome;
|
||||
// }
|
||||
// else if(step==wizardChooseMode)
|
||||
// {
|
||||
// m_config->graphicsView->setVisible(true);
|
||||
// setTxMovement(nothing);
|
||||
// if(wizardStep==wizardIdentifySticks)
|
||||
// {
|
||||
// disconnect(receiverActivityObj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(identifyControls()));
|
||||
// m_config->wzNext->setEnabled(true);
|
||||
// }
|
||||
// m_config->wzText->setText(tr("Please choose your transmiter type.\n"
|
||||
// "Mode 1 means your throttle stick is on the right\n"
|
||||
// "Mode 2 means your throttle stick is on the left\n"));
|
||||
// m_config->wzBack->setEnabled(true);
|
||||
// QRadioButton * mode1=new QRadioButton(tr("Mode 1"),this);
|
||||
// QRadioButton * mode2=new QRadioButton(tr("Mode 2"),this);
|
||||
// mode2->setChecked(true);
|
||||
// extraWidgets.clear();
|
||||
// extraWidgets.append(mode1);
|
||||
// extraWidgets.append(mode2);
|
||||
// m_config->checkBoxesLayout->layout()->addWidget(mode1);
|
||||
// m_config->checkBoxesLayout->layout()->addWidget(mode2);
|
||||
// wizardStep=wizardChooseMode;
|
||||
// }
|
||||
// else if(step==wizardChooseType)
|
||||
// {
|
||||
// if(wizardStep==wizardChooseMode)
|
||||
// {
|
||||
// QRadioButton * mode=qobject_cast<QRadioButton *>(extraWidgets.at(0));
|
||||
// if(mode->isChecked())
|
||||
// transmitterMode=mode1;
|
||||
// else
|
||||
// transmitterMode=mode2;
|
||||
// delete extraWidgets.at(0);
|
||||
// delete extraWidgets.at(1);
|
||||
// extraWidgets.clear();
|
||||
// }
|
||||
|
||||
// m_config->wzText->setText(tr("Please choose your transmiter mode.\n"
|
||||
// "Acro means normal transmitter\n"
|
||||
// "Heli means there is a collective pitch and throttle input\n"));
|
||||
// m_config->wzBack->setEnabled(true);
|
||||
// QRadioButton * typeAcro=new QRadioButton(tr("Acro"),this);
|
||||
// QRadioButton * typeHeli=new QRadioButton(tr("Heli"),this);
|
||||
// typeAcro->setChecked(true);
|
||||
// typeHeli->setChecked(false);
|
||||
// extraWidgets.clear();
|
||||
// extraWidgets.append(typeAcro);
|
||||
// extraWidgets.append(typeHeli);
|
||||
// m_config->checkBoxesLayout->layout()->addWidget(typeAcro);
|
||||
// m_config->checkBoxesLayout->layout()->addWidget(typeHeli);
|
||||
// wizardStep=wizardChooseType;
|
||||
// } else if(step==wizardIdentifySticks && !isSimple) {
|
||||
// usedChannels.clear();
|
||||
// if(wizardStep==wizardChooseType)
|
||||
// {
|
||||
// qDebug() << "Chosing type";
|
||||
// QRadioButton * type=qobject_cast<QRadioButton *>(extraWidgets.at(0));
|
||||
// if(type->isChecked())
|
||||
// transmitterType=acro;
|
||||
// else
|
||||
// transmitterType=heli;
|
||||
// qDebug() << "Checked: " << type->isChecked() << " " << "type is" << transmitterType;
|
||||
// delete extraWidgets.at(0);
|
||||
// delete extraWidgets.at(1);
|
||||
// extraWidgets.clear();
|
||||
// }
|
||||
// wizardStep=wizardIdentifySticks;
|
||||
// currentCommand=0;
|
||||
// getChannelFromStep(currentCommand);
|
||||
// manualSettingsData=manualSettingsObj->getData();
|
||||
// connect(receiverActivityObj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(identifyControls()));
|
||||
// m_config->wzNext->setEnabled(false);
|
||||
// }
|
||||
// else if(step==wizardIdentifyCenter || (isSimple && step==wizardIdentifySticks))
|
||||
// {
|
||||
// setTxMovement(centerAll);
|
||||
// if(wizardStep==wizardIdentifySticks)
|
||||
// disconnect(receiverActivityObj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(identifyControls()));
|
||||
// else
|
||||
// {
|
||||
// disconnect(manualCommandObj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(identifyLimits()));
|
||||
// manualSettingsObj->setData(manualSettingsData);
|
||||
// manualCommandObj->setMetadata(manualCommandObj->getDefaultMetadata());
|
||||
// }
|
||||
// wizardStep=wizardIdentifyCenter;
|
||||
// m_config->wzText->setText(QString(tr("Please center all control controls and press next when ready (if your FlightMode switch has only two positions, leave it on either position)")));
|
||||
// }
|
||||
// else if(step==wizardIdentifyLimits)
|
||||
// {
|
||||
// dimOtherControls(false);
|
||||
// setTxMovement(moveAll);
|
||||
// if(wizardStep==wizardIdentifyCenter)
|
||||
// {
|
||||
// wizardStep=wizardIdentifyLimits;
|
||||
// manualCommandData=manualCommandObj->getData();
|
||||
// manualSettingsData=manualSettingsObj->getData();
|
||||
// for(unsigned int i=0;i<ManualControlCommand::CHANNEL_NUMELEM;++i)
|
||||
// {
|
||||
// manualSettingsData.ChannelNeutral[i]=manualCommandData.Channel[i];
|
||||
// }
|
||||
// manualSettingsObj->setData(manualSettingsData);
|
||||
// }
|
||||
// if(wizardStep==wizardIdentifyInverted)
|
||||
// {
|
||||
// foreach(QWidget * wd,extraWidgets)
|
||||
// {
|
||||
// QCheckBox * cb=qobject_cast<QCheckBox *>(wd);
|
||||
// if(cb)
|
||||
// {
|
||||
// disconnect(cb,SIGNAL(toggled(bool)),this,SLOT(invertControls()));
|
||||
// delete cb;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// extraWidgets.clear();
|
||||
// disconnect(manualCommandObj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(moveSticks()));
|
||||
// wizardStep=wizardIdentifyLimits;
|
||||
// m_config->wzText->setText(QString(tr("Please move all controls to their maximum extents on both directions and press next when ready")));
|
||||
// UAVObject::Metadata mdata= manualCommandObj->getMetadata();
|
||||
// mdata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_PERIODIC;
|
||||
// mdata.flightTelemetryUpdatePeriod = 150;
|
||||
// manualCommandObj->setMetadata(mdata);
|
||||
// manualSettingsData=manualSettingsObj->getData();
|
||||
// for(uint i=0;i<ManualControlSettings::CHANNELMAX_NUMELEM;++i)
|
||||
// {
|
||||
// manualSettingsData.ChannelMin[i]=manualSettingsData.ChannelNeutral[i];
|
||||
// manualSettingsData.ChannelMax[i]=manualSettingsData.ChannelNeutral[i];
|
||||
// }
|
||||
// connect(manualCommandObj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(identifyLimits()));
|
||||
// }
|
||||
// else if(step==wizardIdentifyInverted)
|
||||
// {
|
||||
// dimOtherControls(true);
|
||||
// setTxMovement(nothing);
|
||||
// if(wizardStep==wizardIdentifyLimits)
|
||||
// {
|
||||
// disconnect(manualCommandObj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(identifyLimits()));
|
||||
// manualSettingsObj->setData(manualSettingsData);
|
||||
// }
|
||||
// extraWidgets.clear();
|
||||
// foreach(QString name,manualSettingsObj->getFields().at(0)->getElementNames())
|
||||
// {
|
||||
// if(!name.contains("Access") && !name.contains("Flight"))
|
||||
// {
|
||||
// QCheckBox * cb=new QCheckBox(name,this);
|
||||
// extraWidgets.append(cb);
|
||||
// m_config->checkBoxesLayout->layout()->addWidget(cb);
|
||||
// connect(cb,SIGNAL(toggled(bool)),this,SLOT(invertControls()));
|
||||
// }
|
||||
// }
|
||||
// connect(manualCommandObj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(moveSticks()));
|
||||
// wizardStep=wizardIdentifyInverted;
|
||||
// m_config->wzText->setText(QString(tr("Please check the picture below and check all the sticks which show an inverted movement and press next when ready")));
|
||||
// }
|
||||
// else if(step==wizardFinish)
|
||||
// {
|
||||
// foreach(QWidget * wd,extraWidgets)
|
||||
// {
|
||||
// QCheckBox * cb=qobject_cast<QCheckBox *>(wd);
|
||||
// if(cb)
|
||||
// {
|
||||
// disconnect(cb,SIGNAL(toggled(bool)),this,SLOT(invertControls()));
|
||||
// delete cb;
|
||||
// }
|
||||
// }
|
||||
// wizardStep=wizardFinish;
|
||||
// extraWidgets.clear();
|
||||
// m_config->wzText->setText(QString(tr("You have completed this wizard, please check below if the picture below mimics your sticks movement.\n"
|
||||
// "This new settings aren't saved to the board yet, after pressing next you will go to the initial screen where you can do that.")));
|
||||
|
||||
// }
|
||||
|
||||
// else if(step==wizardFinish+1)
|
||||
// {
|
||||
// setTxMovement(nothing);
|
||||
// manualCommandObj->setMetadata(manualCommandObj->getDefaultMetadata());
|
||||
// disconnect(manualCommandObj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(moveSticks()));
|
||||
// manualSettingsData=manualSettingsObj->getData();
|
||||
// manualSettingsData.ChannelNeutral[ManualControlSettings::CHANNELNEUTRAL_THROTTLE]=
|
||||
// manualSettingsData.ChannelMin[ManualControlSettings::CHANNELMIN_THROTTLE]+
|
||||
// ((manualSettingsData.ChannelMax[ManualControlSettings::CHANNELMAX_THROTTLE]-
|
||||
// manualSettingsData.ChannelMin[ManualControlSettings::CHANNELMIN_THROTTLE])*0.02);
|
||||
// if((abs(manualSettingsData.ChannelMax[ManualControlSettings::CHANNELMAX_FLIGHTMODE]-manualSettingsData.ChannelNeutral[ManualControlSettings::CHANNELNEUTRAL_FLIGHTMODE])<100) ||
|
||||
// (abs(manualSettingsData.ChannelMin[ManualControlSettings::CHANNELMIN_FLIGHTMODE]-manualSettingsData.ChannelNeutral[ManualControlSettings::CHANNELNEUTRAL_FLIGHTMODE])<100))
|
||||
// {
|
||||
// manualSettingsData.ChannelNeutral[ManualControlSettings::CHANNELNEUTRAL_FLIGHTMODE]=manualSettingsData.ChannelMin[ManualControlSettings::CHANNELMIN_FLIGHTMODE]+
|
||||
// (manualSettingsData.ChannelMax[ManualControlSettings::CHANNELMAX_FLIGHTMODE]-manualSettingsData.ChannelMin[ManualControlSettings::CHANNELMIN_FLIGHTMODE])/2;
|
||||
// }
|
||||
// manualSettingsObj->setData(manualSettingsData);
|
||||
// m_config->stackedWidget->setCurrentIndex(0);
|
||||
// wizardStep=wizardWelcome;
|
||||
// }
|
||||
|
||||
//}
|
||||
|
||||
/**
|
||||
* Set the display to indicate which channel the person should move
|
||||
*/
|
||||
@ -849,12 +631,16 @@ void ConfigInputWidget::setChannel(int newChan)
|
||||
m_config->wzText->setText(QString(tr("Please move each control once at a time according to the instructions and picture below.\n\n"
|
||||
"Move the %1 stick")).arg(manualSettingsObj->getField("ChannelGroups")->getElementNames().at(newChan)));
|
||||
|
||||
if(manualSettingsObj->getField("ChannelGroups")->getElementNames().at(newChan).contains("Accessory"))
|
||||
if(manualSettingsObj->getField("ChannelGroups")->getElementNames().at(newChan).contains("Accessory")) {
|
||||
m_config->wzNext->setEnabled(true);
|
||||
m_config->wzText->setText(m_config->wzText->text() + tr(" or click next to skip this channel."));
|
||||
} else
|
||||
m_config->wzNext->setEnabled(false);
|
||||
|
||||
setMoveFromCommand(newChan);
|
||||
|
||||
currentChannelNum = newChan;
|
||||
channelDetected = false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -907,6 +693,8 @@ void ConfigInputWidget::identifyControls()
|
||||
receiverActivityData=receiverActivityObj->getData();
|
||||
if(receiverActivityData.ActiveChannel==255)
|
||||
return;
|
||||
if(channelDetected)
|
||||
return;
|
||||
else
|
||||
{
|
||||
receiverActivityData=receiverActivityObj->getData();
|
||||
@ -918,6 +706,7 @@ void ConfigInputWidget::identifyControls()
|
||||
lastChannel.number=currentChannel.number;
|
||||
if(!usedChannels.contains(lastChannel) && debounce>1)
|
||||
{
|
||||
channelDetected = true;
|
||||
debounce=0;
|
||||
usedChannels.append(lastChannel);
|
||||
manualSettingsData=manualSettingsObj->getData();
|
||||
@ -932,7 +721,7 @@ void ConfigInputWidget::identifyControls()
|
||||
m_config->wzText->clear();
|
||||
setTxMovement(nothing);
|
||||
|
||||
QTimer::singleShot(300, this, SLOT(wzNext()));
|
||||
QTimer::singleShot(500, this, SLOT(wzNext()));
|
||||
}
|
||||
|
||||
void ConfigInputWidget::identifyLimits()
|
||||
@ -1368,6 +1157,8 @@ void ConfigInputWidget::updateCalibration()
|
||||
void ConfigInputWidget::simpleCalibration(bool enable)
|
||||
{
|
||||
if (enable) {
|
||||
m_config->configurationWizard->setEnabled(false);
|
||||
|
||||
QMessageBox msgBox;
|
||||
msgBox.setText(tr("Arming Settings are now set to Always Disarmed for your safety."));
|
||||
msgBox.setDetailedText(tr("You will have to reconfigure arming settings yourself afterwards."));
|
||||
@ -1392,6 +1183,8 @@ void ConfigInputWidget::simpleCalibration(bool enable)
|
||||
|
||||
connect(manualCommandObj, SIGNAL(objectUnpacked(UAVObject*)), this, SLOT(updateCalibration()));
|
||||
} else {
|
||||
m_config->configurationWizard->setEnabled(true);
|
||||
|
||||
manualCommandData = manualCommandObj->getData();
|
||||
manualSettingsData = manualSettingsObj->getData();
|
||||
|
||||
|
@ -81,6 +81,7 @@ private:
|
||||
}lastChannel;
|
||||
channelsStruct currentChannel;
|
||||
QList<channelsStruct> usedChannels;
|
||||
bool channelDetected;
|
||||
QEventLoop * loop;
|
||||
bool skipflag;
|
||||
|
||||
|
@ -252,6 +252,9 @@ void ConfigOutputWidget::runChannelTests(bool state)
|
||||
foreach (QSpinBox* box, outMax) {
|
||||
box->setEnabled(false);
|
||||
}
|
||||
foreach (QCheckBox* box, reversals) {
|
||||
box->setEnabled(false);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
@ -263,6 +266,9 @@ void ConfigOutputWidget::runChannelTests(bool state)
|
||||
foreach (QSpinBox* box, outMax) {
|
||||
box->setEnabled(true);
|
||||
}
|
||||
foreach (QCheckBox* box, reversals) {
|
||||
box->setEnabled(true);
|
||||
}
|
||||
|
||||
}
|
||||
obj->setMetadata(mdata);
|
||||
|
Loading…
x
Reference in New Issue
Block a user