This process will start by downloading the current configuration from the GCS to the OP hardware and will adjust your configuration at various stages.
The final state of your system should match the current configuration in the GCS config gadget.
Please ensure all ccpm settings in the GCS are correct before continuing.
If this process is interrupted, then the state of your OP board may not match the GCS configuration.
After completing this process, please check all settings before attempting to fly.
Please disconnect your motor to ensure it will not spin up.
Using adjustment of:
Using adjustment of:
Using adjustment of:
Adjust the slider to the right over it's full range and observe the swashplate motion. It should remain level over the entire range of travel."); break; case 5: //levelling complete //check verify status as complete m_ccpm->SwashLvlStepList->item(3)->setCheckState(Qt::Checked); //issue user instructions - m_ccpm->SwashLvlStepInstruction->setText("levelling complete"); + m_ccpm->SwashLvlStepInstruction->setText("
Press the Finish button to save these settings to the SD card
Press the cancel button to return to the pre-levelling settings");
//disable position slider
m_ccpm->SwashLvlPositionSlider->setEnabled(false);
m_ccpm->SwashLvlPositionSpinBox->setEnabled(false);
@@ -1414,7 +1414,7 @@ void ConfigccpmWidget::SwashLvlNextButtonPressed()
m_ccpm->SwashLvlStartButton->setEnabled(false);
m_ccpm->SwashLvlNextButton->setEnabled(false);
- m_ccpm->SwashLvlCancelButton->setEnabled(false);
+ m_ccpm->SwashLvlCancelButton->setEnabled(true);
m_ccpm->SwashLvlFinishButton->setEnabled(true);
default:
@@ -1428,24 +1428,55 @@ void ConfigccpmWidget::SwashLvlNextButtonPressed()
}
void ConfigccpmWidget::SwashLvlCancelButtonPressed()
{
+ int i;
SwashLvlState=0;
+
+ UAVObjectField* MinField;
+ UAVObjectField* NeutralField;
+ UAVObjectField* MaxField;
+
m_ccpm->SwashLvlStartButton->setEnabled(true);
m_ccpm->SwashLvlNextButton->setEnabled(false);
m_ccpm->SwashLvlCancelButton->setEnabled(false);
m_ccpm->SwashLvlFinishButton->setEnabled(false);
+ m_ccpm->SwashLvlStepList->item(0)->setCheckState(Qt::Unchecked);
+ m_ccpm->SwashLvlStepList->item(1)->setCheckState(Qt::Unchecked);
+ m_ccpm->SwashLvlStepList->item(2)->setCheckState(Qt::Unchecked);
+ m_ccpm->SwashLvlStepList->item(3)->setCheckState(Qt::Unchecked);
+
//restore old Actuator Settings
+ ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
+ UAVObjectManager *objManager = pm->getObject Previous settings have been restored.");
+
}
void ConfigccpmWidget::SwashLvlFinishButtonPressed()
{
int i;
- ShowDisclaimer(0);
- ShowDisclaimer(2);
UAVObjectField* MinField;
UAVObjectField* NeutralField;
@@ -1480,17 +1511,23 @@ void ConfigccpmWidget::SwashLvlFinishButtonPressed()
//restore Flight control of ActuatorCommand
enableSwashplateLevellingControl(false);
+
+ m_ccpm->SwashLvlStepInstruction->setText(" New settings have been saved to the SD card");
+
+ ShowDisclaimer(0);
+ //ShowDisclaimer(2);
+
}
int ConfigccpmWidget::ShowDisclaimer(int messageID)
{
QMessageBox msgBox;
- msgBox.setText("Warning!!!");
+ msgBox.setText(" Please double check all settings before attempting flight!");
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.setIcon(QMessageBox::Information);
@@ -1499,7 +1536,7 @@ int ConfigccpmWidget::ShowDisclaimer(int messageID)
break;
case 1:
// Not Tested disclaimer
- msgBox.setInformativeText("The CCPM mixer code has not been used to fly a helicopter!\n\nUse it at your own risk!\n\nDo you wish to continue?");
+ msgBox.setInformativeText(" Use it at your own risk! Do you wish to continue?");
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Cancel);
msgBox.setIcon(QMessageBox::Warning);
@@ -1512,7 +1549,7 @@ int ConfigccpmWidget::ShowDisclaimer(int messageID)
break;
case 2:
// DO NOT use
- msgBox.setInformativeText("The CCPM swashplate levelling code is NOT complete!\n\nDO NOT use it for flight!");
+ msgBox.setInformativeText(" DO NOT use it for flight!");
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.setIcon(QMessageBox::Critical);
@@ -1547,11 +1584,23 @@ void ConfigccpmWidget::enableSwashplateLevellingControl(bool state)
mdata.gcsTelemetryUpdateMode = UAVObject::UPDATEMODE_ONCHANGE;
mdata.gcsTelemetryUpdatePeriod = 100;
SwashLvlConfigurationInProgress=1;
+ connect(qApp, SIGNAL(focusChanged(QWidget*,QWidget*)),this, SLOT(FocusChanged(QWidget*,QWidget*)));
+ m_ccpm->TabObject->setTabEnabled(0,0);
+ m_ccpm->TabObject->setTabEnabled(2,0);
+ m_ccpm->TabObject->setTabEnabled(3,0);
+ m_ccpm->ccpmType->setEnabled(0);
}
else
{
mdata = SwashLvlaccInitialData; // Restore metadata
SwashLvlConfigurationInProgress=0;
+
+ disconnect(qApp, SIGNAL(focusChanged(QWidget*,QWidget*)),this, SLOT(FocusChanged(QWidget*,QWidget*)));
+ m_ccpm->TabObject->setTabEnabled(0,1);
+ m_ccpm->TabObject->setTabEnabled(2,1);
+ m_ccpm->TabObject->setTabEnabled(3,1);
+ m_ccpm->ccpmType->setEnabled(1);
+
}
obj->setMetadata(mdata);
@@ -1658,3 +1707,33 @@ void ConfigccpmWidget::SwashLvlSpinBoxChanged(int value)
return;
}
+
+void ConfigccpmWidget::FocusChanged(QWidget *oldFocus, QWidget *newFocus)
+{
+ if (SwashLvlConfigurationInProgress!=1) return;
+ QMessageBox msgBox;
+ int ret;
+ msgBox.setText(" Do you want to continue the levelling routine?");
+ msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
+ msgBox.setDefaultButton(QMessageBox::Yes);
+ msgBox.setIcon(QMessageBox::Information);
+ ret = msgBox.exec();
+
+ if (ret == QMessageBox::Yes)
+ {
+
+ //m_ccpm->TabObject->setCurrentIndex(1);
+ //m_ccpm->SwashPlateLevel->setFocus(Qt::MouseFocusReason);
+ //m_ccpm->SwashLvlInstructionsBox->setFocus(Qt::MouseFocusReason);
+ oldFocus->setFocus(Qt::MouseFocusReason);
+ }
+ if (ret == QMessageBox::No)
+ {
+ SwashLvlCancelButtonPressed();
+ }
+ }
+}
diff --git a/ground/openpilotgcs/src/plugins/config/configccpmwidget.h b/ground/openpilotgcs/src/plugins/config/configccpmwidget.h
index bbf863498..21b4e1b38 100644
--- a/ground/openpilotgcs/src/plugins/config/configccpmwidget.h
+++ b/ground/openpilotgcs/src/plugins/config/configccpmwidget.h
@@ -106,7 +106,7 @@ private:
void enableSwashplateLevellingControl(bool state);
void setSwashplateLevel(int percent);
void SwashLvlSpinBoxChanged(int value);
-
+ void FocusChanged(QWidget *oldFocus, QWidget *newFocus);
public slots:
void requestccpmUpdate();
void sendccpmUpdate();
Levelling Cancelled
Levelling Completed
Warning!!!
");
int ret;
switch (messageID) {
case 0:
// Basic disclaimer
- msgBox.setInformativeText("This code has many configurations.\n\nPlease double check all settings before attempting flight!");
+ msgBox.setInformativeText("This code has many configurations.
The CCPM mixer code has not been used to fly a helicopter!
The CCPM swashplate levelling code is NOT complete!
Warning!!!
");
+
+ if ((this->isAncestorOf(oldFocus))&&(!this->isAncestorOf(newFocus)))
+ {
+ msgBox.setInformativeText("You are in the middle of the levelling routine
Changing focus will cancel all levelling and return the OP hardware to the state it was in before levelling began.