diff --git a/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp b/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp index 5c5da9c6f..769c25066 100644 --- a/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp @@ -48,7 +48,7 @@ #include #include -ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(parent), wasItMe(false) +ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(parent) { ui = new Ui_OutputWidget(); ui->setupUi(this); @@ -100,13 +100,6 @@ ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(paren disconnect(this, SLOT(refreshWidgetsValues(UAVObject *))); - UAVObjectManager *objManager = pm->getObject(); - UAVObject *obj = objManager->getObject(QString("ActuatorCommand")); - if (UAVObject::GetGcsTelemetryUpdateMode(obj->getMetadata()) == UAVObject::UPDATEMODE_ONCHANGE) { - this->setEnabled(false); - } - connect(obj, SIGNAL(objectUpdated(UAVObject *)), this, SLOT(disableIfNotMe(UAVObject *))); - refreshWidgetsValues(); updateEnableControls(); } @@ -178,7 +171,6 @@ void ConfigOutputWidget::runChannelTests(bool state) ActuatorCommand *obj = ActuatorCommand::GetInstance(getObjectManager()); UAVObject::Metadata mdata = obj->getMetadata(); if (state) { - wasItMe = true; accInitialData = mdata; UAVObject::SetFlightAccess(mdata, UAVObject::ACCESS_READONLY); UAVObject::SetFlightTelemetryUpdateMode(mdata, UAVObject::UPDATEMODE_ONCHANGE); @@ -186,8 +178,7 @@ void ConfigOutputWidget::runChannelTests(bool state) UAVObject::SetGcsTelemetryUpdateMode(mdata, UAVObject::UPDATEMODE_ONCHANGE); mdata.gcsTelemetryUpdatePeriod = 100; } else { - wasItMe = false; - mdata = accInitialData; // Restore metadata + mdata = accInitialData; // Restore metadata } obj->setMetadata(mdata); obj->updated(); @@ -425,14 +416,3 @@ void ConfigOutputWidget::stopTests() { ui->channelOutTest->setChecked(false); } - -void ConfigOutputWidget::disableIfNotMe(UAVObject *obj) -{ - if (UAVObject::GetGcsTelemetryUpdateMode(obj->getMetadata()) == UAVObject::UPDATEMODE_ONCHANGE) { - if (!wasItMe) { - this->setEnabled(false); - } - } else { - this->setEnabled(true); - } -} diff --git a/ground/openpilotgcs/src/plugins/config/configoutputwidget.h b/ground/openpilotgcs/src/plugins/config/configoutputwidget.h index 3105b25d9..bb1d37c27 100644 --- a/ground/openpilotgcs/src/plugins/config/configoutputwidget.h +++ b/ground/openpilotgcs/src/plugins/config/configoutputwidget.h @@ -67,11 +67,8 @@ private: UAVObject::Metadata accInitialData; - bool wasItMe; - private slots: void stopTests(); - void disableIfNotMe(UAVObject *obj); virtual void refreshWidgetsValues(UAVObject *obj = NULL); void updateObjectsFromWidgets(); void runChannelTests(bool state); diff --git a/ground/openpilotgcs/src/plugins/setupwizard/connectiondiagram.cpp b/ground/openpilotgcs/src/plugins/setupwizard/connectiondiagram.cpp index 227d851bb..469beaa40 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/connectiondiagram.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/connectiondiagram.cpp @@ -148,64 +148,24 @@ void ConnectionDiagram::setupGraphicsScene() break; } + QString prefix = ""; + if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_NANO) { + prefix = "nano-"; + } switch (m_configSource->getInputType()) { case VehicleConfigurationSource::INPUT_PWM: - if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_NANO) { - elementsToShow << "pwm-nano"; - } else { - elementsToShow << "pwm"; - } + elementsToShow << QString("%1pwm").arg(prefix); break; case VehicleConfigurationSource::INPUT_PPM: - if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_NANO) { - elementsToShow << "ppm-nano"; - } else { - elementsToShow << "ppm"; - } + elementsToShow << QString("%1ppm").arg(prefix); break; case VehicleConfigurationSource::INPUT_SBUS: - if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_NANO) { - elementsToShow << "sbus-nano"; - } else { - elementsToShow << "sbus"; - } + elementsToShow << QString("%1sbus").arg(prefix); break; case VehicleConfigurationSource::INPUT_DSMX10: case VehicleConfigurationSource::INPUT_DSMX11: case VehicleConfigurationSource::INPUT_DSM2: - if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_NANO) { - elementsToShow << "satellite-nano"; - } else { - elementsToShow << "satellite"; - } - break; - default: - break; - } - - switch (m_configSource->getGpsType()) { - case VehicleConfigurationSource::GPS_DISABLED: - break; - case VehicleConfigurationSource::GPS_NMEA: - if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_NANO) { - elementsToShow << "nano-generic-nmea"; - } else if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_REVO) { - elementsToShow << "generic-nmea"; - } - break; - case VehicleConfigurationSource::GPS_PLATINUM: - if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_NANO) { - elementsToShow << "nano-OPGPS-v9"; - } else if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_REVO) { - elementsToShow << "OPGPS-v9"; - } - break; - case VehicleConfigurationSource::GPS_UBX: - if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_NANO) { - elementsToShow << "nano-OPGPS-v8-ublox"; - } else if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_REVO) { - elementsToShow << "OPGPS-v8-ublox"; - } + elementsToShow << QString("%1satellite").arg(prefix); break; default: break; @@ -215,24 +175,35 @@ void ConnectionDiagram::setupGraphicsScene() m_configSource->getAirspeedType() != VehicleConfigurationSource::AIRSPEED_ESTIMATE) { switch (m_configSource->getAirspeedType()) { case VehicleConfigurationSource::AIRSPEED_EAGLETREE: - if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_NANO) { - elementsToShow << "nano-eagletree-speed-sensor"; - } else if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_REVO) { - elementsToShow << "eagletree-speed-sensor"; - } + elementsToShow << QString("%1eagletree-speed-sensor").arg(prefix); break; case VehicleConfigurationSource::AIRSPEED_MS4525: - if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_NANO) { - elementsToShow << "nano-ms4525-speed-sensor"; - } else if (m_configSource->getControllerType() == VehicleConfigurationSource::CONTROLLER_REVO) { - elementsToShow << "ms4525-speed-sensor"; - } + elementsToShow << QString("%1ms4525-speed-sensor").arg(prefix); break; default: break; } } + if (m_configSource->getInputType() == VehicleConfigurationSource::INPUT_SBUS) { + prefix = QString("flexi-%1").arg(prefix); + } + switch (m_configSource->getGpsType()) { + case VehicleConfigurationSource::GPS_DISABLED: + break; + case VehicleConfigurationSource::GPS_NMEA: + elementsToShow << QString("%1generic-nmea").arg(prefix); + break; + case VehicleConfigurationSource::GPS_PLATINUM: + elementsToShow << QString("%1OPGPS-v9").arg(prefix); + break; + case VehicleConfigurationSource::GPS_UBX: + elementsToShow << QString("%1OPGPS-v8-ublox").arg(prefix); + break; + default: + break; + } + setupGraphicsSceneItems(elementsToShow); fitInView(); qDebug() << "Scene complete"; diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/esccalibrationpage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/esccalibrationpage.cpp index 3428fb794..270a3ddef 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/esccalibrationpage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/esccalibrationpage.cpp @@ -41,6 +41,10 @@ EscCalibrationPage::EscCalibrationPage(SetupWizard *wizard, QWidget *parent) : { ui->setupUi(this); connect(ui->startStopButton, SIGNAL(clicked()), this, SLOT(startStopButtonClicked())); + + connect(ui->securityCheckBox1, SIGNAL(toggled(bool)), this, SLOT(securityCheckBoxesToggled())); + connect(ui->securityCheckBox2, SIGNAL(toggled(bool)), this, SLOT(securityCheckBoxesToggled())); + connect(ui->securityCheckBox3, SIGNAL(toggled(bool)), this, SLOT(securityCheckBoxesToggled())); } EscCalibrationPage::~EscCalibrationPage() @@ -59,9 +63,19 @@ void EscCalibrationPage::enableButtons(bool enable) getWizard()->button(QWizard::CancelButton)->setEnabled(enable); getWizard()->button(QWizard::BackButton)->setEnabled(enable); getWizard()->button(QWizard::CustomButton1)->setEnabled(enable); + ui->securityCheckBox1->setEnabled(enable); + ui->securityCheckBox2->setEnabled(enable); + ui->securityCheckBox3->setEnabled(enable); QApplication::processEvents(); } +void EscCalibrationPage::resetAllSecurityCheckboxes() +{ + ui->securityCheckBox1->setChecked(false); + ui->securityCheckBox2->setChecked(false); + ui->securityCheckBox3->setChecked(false); +} + void EscCalibrationPage::startStopButtonClicked() { if (!m_isCalibrating) { @@ -74,7 +88,7 @@ void EscCalibrationPage::startStopButtonClicked() MixerSettings *mSettings = MixerSettings::GetInstance(uavoManager); Q_ASSERT(mSettings); QString mixerTypePattern = "Mixer%1Type"; - for (int i = 0; i < ActuatorSettings::CHANNELADDR_NUMELEM; i++) { + for (quint32 i = 0; i < ActuatorSettings::CHANNELADDR_NUMELEM; i++) { UAVObjectField *field = mSettings->getField(mixerTypePattern.arg(i + 1)); Q_ASSERT(field); if (field->getValue().toString() == field->getOptions().at(VehicleConfigurationHelper::MIXER_TYPE_MOTOR)) { @@ -95,8 +109,21 @@ void EscCalibrationPage::startStopButtonClicked() } m_outputs.clear(); m_isCalibrating = false; + resetAllSecurityCheckboxes(); ui->startStopButton->setText(tr("Start")); - ui->startStopButton->setEnabled(true); enableButtons(true); } } + +void EscCalibrationPage::securityCheckBoxesToggled() +{ + ui->startStopButton->setEnabled(ui->securityCheckBox1->isChecked() && + ui->securityCheckBox2->isChecked() && + ui->securityCheckBox3->isChecked()); +} + + +void EscCalibrationPage::initializePage() +{ + resetAllSecurityCheckboxes(); +} diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/esccalibrationpage.h b/ground/openpilotgcs/src/plugins/setupwizard/pages/esccalibrationpage.h index 6f4657fab..5aca966c3 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/esccalibrationpage.h +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/esccalibrationpage.h @@ -43,14 +43,17 @@ public: explicit EscCalibrationPage(SetupWizard *wizard, QWidget *parent = 0); ~EscCalibrationPage(); bool validatePage(); + void initializePage(); private slots: void startStopButtonClicked(); + void securityCheckBoxesToggled(); void enableButtons(bool enable); + void resetAllSecurityCheckboxes(); private: - const int LOW_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS = 1000; - const int HIGH_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS = 2000; + static const int LOW_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS = 1000; + static const int HIGH_PWM_OUTPUT_PULSE_LENGTH_MICROSECONDS = 1900; Ui::EscCalibrationPage *ui; bool m_isCalibrating; diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/esccalibrationpage.ui b/ground/openpilotgcs/src/plugins/setupwizard/pages/esccalibrationpage.ui index a431ed0cd..c22be3413 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/esccalibrationpage.ui +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/esccalibrationpage.ui @@ -17,7 +17,7 @@ - <html><head/><body><p align="center"><span style=" font-size:12pt; font-weight:600;">OpenPilot ESC Calibration Procedure</span></p><p><span style=" font-size:10pt;">As you have selected to use a MultiRotor and Fast / Flashed ESCs, we need to calibrate the endpoints of these ESCs so they can see the full throttle range sent from the flight controller. </span></p><p><span style=" font-size:10pt;">This part of the wizard will tell you to connect the battery to your aircraft, before doing so you absolutely </span><span style=" font-size:10pt; font-weight:600; color:#f30f1d;">must remove the propellers from all motors</span><span style=" font-size:10pt;">. </span></p><p><span style=" font-size:10pt;">The steps to perform this calibration are as follows:</span></p><p><span style=" font-size:10pt;">1. Press the Start button on this page <br/>2. Connect the battery to your airframe<br/>3. Wait for ESC calibration beep(s)<br/>4. Press the Stop button on this page<br/>5. Wait for ESC confirmation beep(s)<br/>6. Disconnect battery</span></p><p><span style=" font-size:10pt;">When ready push the start button below.</span></p></body></html> + <html><head/><body><p align="center"><span style=" font-size:12pt; font-weight:600;">OpenPilot ESC Calibration Procedure</span></p><p><span style=" font-size:10pt;">As you have selected to use a MultiRotor and Fast / Flashed ESCs, we need to calibrate the endpoints of these ESCs so they can see the full throttle range sent from the flight controller. </span></p><p><span style=" font-size:10pt;">This part of the wizard will tell you to connect the battery to your aircraft, before doing so you absolutely </span><span style=" font-size:10pt; font-weight:600; color:#f30f1d;">must remove the propellers from all motors</span><span style=" font-size:10pt;">. </span></p><p><span style=" font-size:10pt;">The steps to perform this calibration are as follows:</span></p><p><span style=" font-size:10pt;">1. Confirm all safety questions<br/>2. Press the Start button when it becomes enabled<br/>3. Connect the battery to your airframe<br/>4. Wait for ESC calibration beep(s)<br/>5. Press the Stop button<br/>6. Wait for ESC confirmation beep(s)<br/>7. Disconnect battery</span></p></body></html> Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop @@ -43,6 +43,27 @@ + + + + I have removed ALL propellers from ALL motors of my vehicle. + + + + + + + The vehicle is NOT powered by any external power source but USB + + + + + + + I confirm I have read and understood the above instructions in full + + + @@ -63,6 +84,9 @@ + + false + 0 @@ -104,6 +128,12 @@ + + securityCheckBox1 + securityCheckBox2 + securityCheckBox3 + startStopButton + diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp index a13f97127..051fbb45f 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp @@ -75,7 +75,7 @@ void OutputCalibrationPage::setupActuatorMinMaxAndNeutral(int motorChannelStart, // Set to motor safe values m_actuatorSettings[servoid].channelMin = 1000; m_actuatorSettings[servoid].channelNeutral = 1000; - m_actuatorSettings[servoid].channelMax = 2000; + m_actuatorSettings[servoid].channelMax = 1900; } else if (servoid < totalUsedChannels) { // Set to servo safe values m_actuatorSettings[servoid].channelMin = 1500; @@ -217,9 +217,6 @@ void OutputCalibrationPage::setupVehicle() break; } - VehicleConfigurationHelper helper(getWizard()); - helper.setupVehicle(false); - if (m_calibrationUtil) { delete m_calibrationUtil; m_calibrationUtil = 0; diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/summarypage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/summarypage.cpp index 884c94eb9..b7fbeb292 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/summarypage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/summarypage.cpp @@ -45,6 +45,10 @@ SummaryPage::~SummaryPage() bool SummaryPage::validatePage() { + // Save settings so far. + VehicleConfigurationHelper helper(getWizard()); + + helper.setupVehicle(false); return true; } diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/summarypage.ui b/ground/openpilotgcs/src/plugins/setupwizard/pages/summarypage.ui index 5e46b1a45..2a29a32fd 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/summarypage.ui +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/summarypage.ui @@ -20,13 +20,13 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8pt; font-weight:400; font-style:normal;"> -<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">OpenPilot Configuration Summary</span></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:12pt; font-weight:600;"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">The first part of this wizard is now complete. All information required to create a basic OpenPilot controller configuration for a specific vehicle has been collected.</span></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">Below is a summary of the configuration and a button that links to a diagram illustrating how to connect required hardware and the OpenPilot Controller with the current configuration.</span></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:10pt;"><br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:10pt;">The following steps require that your OpenPilot controller is connected according to the diagram, remians connected to the computer by USB, and that you have a battery ready but </span><span style=" font-size:10pt; font-weight:600;">do not</span><span style=" font-size:10pt;"> connect it right now, you will be told when to in later steps of this wizard.</span></p></body></html> +</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> +<p align="center" style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:12pt; font-weight:600;">OpenPilot Configuration Summary</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:12pt; font-weight:600;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:10pt;">The first part of this wizard is now complete. All information required to create a basic OpenPilot controller configuration for a specific vehicle has been collected.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:10pt;">Below is a summary of the configuration and a button that links to a diagram illustrating how to connect required hardware and the OpenPilot Controller with the current configuration.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'MS Shell Dlg 2'; font-size:10pt;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:10pt;">The following steps require that your OpenPilot controller is connected according to the diagram, remains connected to the computer by USB, and that you have a battery ready but </span><span style=" font-family:'MS Shell Dlg 2'; font-size:10pt; font-weight:600;">do not</span><span style=" font-family:'MS Shell Dlg 2'; font-size:10pt;"> connect it right now, you will be told when to in later steps of this wizard.</span></p></body></html> Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop diff --git a/ground/openpilotgcs/src/plugins/setupwizard/resources/connection-diagrams.svg b/ground/openpilotgcs/src/plugins/setupwizard/resources/connection-diagrams.svg index 6e42f8ac6..1267ac796 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/resources/connection-diagrams.svg +++ b/ground/openpilotgcs/src/plugins/setupwizard/resources/connection-diagrams.svg @@ -15,7 +15,7 @@ height="1074.8231" width="1398.5884" version="1.1" - inkscape:version="0.48.5 r10040" + inkscape:version="0.48.4 r9939" sodipodi:docname="connection-diagrams.svg">