From ae5dbc3096d27d2ce4f83c466099cf27641d4b51 Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Thu, 19 Feb 2015 17:13:56 +0100 Subject: [PATCH 01/68] OP-1734 Change mixer values : Vtail and FixedWing rudder --- .../config/cfg_vehicletypes/configfixedwingwidget.cpp | 6 +++--- .../plugins/setupwizard/vehicleconfigurationhelper.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.cpp b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.cpp index 84378e342..0640c639b 100644 --- a/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/cfg_vehicletypes/configfixedwingwidget.cpp @@ -358,7 +358,7 @@ bool ConfigFixedWingWidget::setupFrameFixedWing(QString airframeType) // rudder channel = m_aircraft->fwRudder1ChannelBox->currentIndex() - 1; setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO); - setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, 127); + setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, -127); // ailerons channel = m_aircraft->fwAileron1ChannelBox->currentIndex() - 1; @@ -542,13 +542,13 @@ bool ConfigFixedWingWidget::setupFrameVtail(QString airframeType) // First Vtail servo setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO); setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH, -pitch); - setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, yaw); + setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, -yaw); // Second Vtail servo channel = m_aircraft->fwElevator2ChannelBox->currentIndex() - 1; setMixerType(mixer, channel, VehicleConfig::MIXERTYPE_SERVO); setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_PITCH, pitch); - setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, yaw); + setMixerVectorValue(mixer, channel, VehicleConfig::MIXERVECTOR_YAW, -yaw); } m_aircraft->fwStatusLabel->setText("Mixer generated"); diff --git a/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp b/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp index a13d8b5a6..083a8185b 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/vehicleconfigurationhelper.cpp @@ -1896,7 +1896,7 @@ void VehicleConfigurationHelper::setupDualAileron() channels[3].throttle2 = 0; channels[3].roll = 0; channels[3].pitch = 0; - channels[3].yaw = 100; + channels[3].yaw = -100; guiSettings.fixedwing.FixedWingThrottle = 3; guiSettings.fixedwing.FixedWingRoll1 = 1; @@ -1948,7 +1948,7 @@ void VehicleConfigurationHelper::setupAileron() channels[3].throttle2 = 0; channels[3].roll = 0; channels[3].pitch = 0; - channels[3].yaw = 100; + channels[3].yaw = -100; guiSettings.fixedwing.FixedWingThrottle = 3; guiSettings.fixedwing.FixedWingRoll1 = 1; @@ -1999,7 +1999,7 @@ void VehicleConfigurationHelper::setupVtail() channels[1].throttle2 = 0; channels[1].roll = 0; channels[1].pitch = 100; - channels[1].yaw = 100; + channels[1].yaw = -100; // Left Vtail Servo (Chan 4) channels[3].type = MIXER_TYPE_SERVO; @@ -2007,7 +2007,7 @@ void VehicleConfigurationHelper::setupVtail() channels[3].throttle2 = 0; channels[3].roll = 0; channels[3].pitch = -100; - channels[3].yaw = 100; + channels[3].yaw = -100; guiSettings.fixedwing.FixedWingThrottle = 3; guiSettings.fixedwing.FixedWingRoll1 = 1; From 3d10d33ac3fd02bbc026dcfc7071a8f673150814 Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Thu, 19 Feb 2015 17:44:55 +0100 Subject: [PATCH 02/68] OP-1734 Rename elements for FW single servo to 'aileronsingle' --- .../pages/outputcalibrationpage.cpp | 2 +- .../resources/fixedwing-shapes-wizard.svg | 28 +++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp index fb4775aa9..c66ae4dc4 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp @@ -205,7 +205,7 @@ void OutputCalibrationPage::setupVehicle() case SetupWizard::FIXED_WING_AILERON: loadSVGFile(FIXEDWING_SVG_FILE); m_wizardIndexes << 0 << 1 << 2 << 2 << 2; - m_vehicleElementIds << "aileron-single" << "ail2-frame" << "ail2-motor" << "ail2-aileron" << "ail2-elevator" << "ail2-rudder"; + m_vehicleElementIds << "singleaileron" << "singleaileron-frame" << "singleaileron-motor" << "singleaileron-aileron" << "singleaileron-elevator" << "singleaileron-rudder"; m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4; m_channelIndex << 0 << 2 << 0 << 1 << 3; diff --git a/ground/openpilotgcs/src/plugins/setupwizard/resources/fixedwing-shapes-wizard.svg b/ground/openpilotgcs/src/plugins/setupwizard/resources/fixedwing-shapes-wizard.svg index c75382518..fead94710 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/resources/fixedwing-shapes-wizard.svg +++ b/ground/openpilotgcs/src/plugins/setupwizard/resources/fixedwing-shapes-wizard.svg @@ -23,7 +23,7 @@ sodipodi:docname="fixedwing-shapes-wizard.svg">image/svg+xml Date: Thu, 19 Feb 2015 18:23:33 +0100 Subject: [PATCH 03/68] OP-1734 Better highlight on every element --- .../resources/fixedwing-shapes-wizard.svg | 2730 +++++++++-------- 1 file changed, 1419 insertions(+), 1311 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/setupwizard/resources/fixedwing-shapes-wizard.svg b/ground/openpilotgcs/src/plugins/setupwizard/resources/fixedwing-shapes-wizard.svg index fead94710..3f1be7a54 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/resources/fixedwing-shapes-wizard.svg +++ b/ground/openpilotgcs/src/plugins/setupwizard/resources/fixedwing-shapes-wizard.svg @@ -261,33 +261,6 @@ y1="476.28711" x2="68.297401" y2="476.28711" />6 + + + + +4 +6 - - - - -4 -4 + x="239.17444" + y="352.68146">4 Date: Fri, 20 Feb 2015 01:26:06 +0100 Subject: [PATCH 04/68] OP-1734 Ground vehicle and FixedWing Wizard : Add arrows Up/Down and Left/Right, tell user for servo movement --- .../pages/outputcalibrationpage.cpp | 85 + .../setupwizard/pages/outputcalibrationpage.h | 2 + .../resources/fixedwing-shapes-wizard.svg | 5199 +++++++++-------- .../resources/ground-shapes-wizard.svg | 126 +- 4 files changed, 2987 insertions(+), 2425 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp index c66ae4dc4..b411d2d01 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp @@ -281,6 +281,7 @@ void OutputCalibrationPage::setupVehicle() void OutputCalibrationPage::setupVehicleItems() { m_vehicleItems.clear(); + m_arrowsItems.clear(); m_vehicleBoundsItem = new QGraphicsSvgItem(); m_vehicleBoundsItem->setSharedRenderer(m_vehicleRenderer); m_vehicleBoundsItem->setElementId(m_vehicleElementIds[0]); @@ -302,6 +303,47 @@ void OutputCalibrationPage::setupVehicleItems() m_vehicleScene->addItem(item); m_vehicleItems << item; + + bool addArrows = false; + + if ((m_vehicleElementIds[i].contains("left")) || (m_vehicleElementIds[i].contains("right")) + || (m_vehicleElementIds[i].contains("elevator")) || (m_vehicleElementIds[i].contains("rudder")) + || (m_vehicleElementIds[i].contains("steering")) || (m_vehicleElementIds[i] == "singleaileron-aileron")) { + addArrows = true; + } + + if (addArrows) { + QString arrowUp = "-up"; // right if rudder / steering + QString arrowDown = "-down"; // left + + QGraphicsSvgItem *itemUp = new QGraphicsSvgItem(); + + itemUp->setSharedRenderer(m_vehicleRenderer); + QString elementUp = m_vehicleElementIds[i] + arrowUp; + qDebug() << "############### Add " << elementUp; + itemUp->setElementId(elementUp); + itemUp->setZValue(i+10); + itemUp->setOpacity(0); + + QRectF itemBounds = m_vehicleRenderer->boundsOnElement(elementUp); + itemUp->setPos(itemBounds.x() - parentBounds.x(), itemBounds.y() - parentBounds.y()); + m_vehicleScene->addItem(itemUp); + + m_arrowsItems << itemUp; + + QGraphicsSvgItem *itemDown = new QGraphicsSvgItem(); + itemDown->setSharedRenderer(m_vehicleRenderer); + QString elementDown = m_vehicleElementIds[i] + arrowDown; + itemDown->setElementId(elementDown); + itemDown->setZValue(i+10); + itemDown->setOpacity(0); + + itemBounds = m_vehicleRenderer->boundsOnElement(elementDown); + itemDown->setPos(itemBounds.x() - parentBounds.x(), itemBounds.y() - parentBounds.y()); + m_vehicleScene->addItem(itemDown); + + m_arrowsItems << itemDown; + } } } @@ -323,6 +365,26 @@ void OutputCalibrationPage::setupVehicleHighlightedPart() } } +void OutputCalibrationPage::showElementMovement(bool isUp, float value) +{ + QString highlightedItemName = m_vehicleItems[m_currentWizardIndex]->elementId(); + qDebug() << "+++++" << highlightedItemName; + + for (int i = 0; i < m_arrowsItems.size(); i++) { + QString upItemName = highlightedItemName + "-up"; + QString downItemName = highlightedItemName + "-down"; + if (m_arrowsItems[i]->elementId() == upItemName) { + QGraphicsSvgItem *itemUp = m_arrowsItems[i]; + itemUp->setOpacity(isUp ? value : 0); + } + if (m_arrowsItems[i]->elementId() == downItemName) { + QGraphicsSvgItem *itemDown = m_arrowsItems[i]; + itemDown->setOpacity(isUp ? 0 : value); + } + qDebug() << "***** " << i << " ****** " << m_arrowsItems[i]->elementId(); + } +} + void OutputCalibrationPage::setWizardPage() { qDebug() << "Wizard index: " << m_currentWizardIndex; @@ -366,6 +428,9 @@ void OutputCalibrationPage::setWizardPage() } } setupVehicleHighlightedPart(); + // Hide arrows + showElementMovement(true, 0); + showElementMovement(false, 0); } void OutputCalibrationPage::initializePage() @@ -414,6 +479,8 @@ void OutputCalibrationPage::customBackClicked() } else { getWizard()->back(); } + + } quint16 OutputCalibrationPage::getCurrentChannel() @@ -479,6 +546,9 @@ void OutputCalibrationPage::enableServoSliders(bool enabled) ui->servoMinAngleSlider->setEnabled(enabled); ui->servoMaxAngleSlider->setEnabled(enabled); ui->reverseCheckbox->setEnabled(!enabled); + // Hide arrows + showElementMovement(true, 0); + showElementMovement(false, 0); } bool OutputCalibrationPage::checkAlarms() @@ -567,6 +637,21 @@ void OutputCalibrationPage::on_servoCenterAngleSlider_valueChanged(int position) ui->servoMaxAngleSlider->setValue(value); } } + + quint16 minValue = (ui->reverseCheckbox->isChecked()) ? ui->servoMaxAngleSlider->value() : ui->servoMinAngleSlider->value(); + quint16 maxValue = (ui->reverseCheckbox->isChecked()) ? ui->servoMinAngleSlider->value() : ui->servoMaxAngleSlider->value(); + quint16 range = maxValue - minValue; + // Reset arows + showElementMovement(true, 0); + showElementMovement(false, 0); + + // 20% "Dead band" : no arrow display + if (value < minValue + (range * 0.40)) { + showElementMovement((ui->reverseCheckbox->isChecked() ? true : false), 1.0); + } else if (value > maxValue - (range * 0.40)) { + showElementMovement((ui->reverseCheckbox->isChecked() ? false : true), 1.0); + } + debugLogChannelValues(); } diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h index 3691a1d0a..7326d04f0 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h @@ -76,6 +76,7 @@ private: void startWizard(); void setupVehicleItems(); void setupVehicleHighlightedPart(); + void showElementMovement(bool isUp, float value); void setWizardPage(); void enableButtons(bool enable); void enableServoSliders(bool enabled); @@ -93,6 +94,7 @@ private: QList m_vehicleElementIds; QList m_vehicleItems; + QList m_arrowsItems; QList m_vehicleHighlightElementIndexes; QList m_channelIndex; QList m_wizardIndexes; diff --git a/ground/openpilotgcs/src/plugins/setupwizard/resources/fixedwing-shapes-wizard.svg b/ground/openpilotgcs/src/plugins/setupwizard/resources/fixedwing-shapes-wizard.svg index 3f1be7a54..eada74c14 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/resources/fixedwing-shapes-wizard.svg +++ b/ground/openpilotgcs/src/plugins/setupwizard/resources/fixedwing-shapes-wizard.svg @@ -1059,7 +1059,18 @@ offset="0" />6 - - - -4 - + + + +4 + + + + +4 +6 + - - - -4 -6 - \ No newline at end of file + style="color:#000000;fill:#1bb81b;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:0.5;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" + d="M 532.375,1477.2188 L 532.375,1527.5938 L 520.0625,1526.5938 L 542.78125,1553.5938 L 565.5,1526.5938 L 553.1875,1527.5938 L 553.1875,1477.2188 L 532.375,1477.2188 z M 536,1481.0312 L 549.5625,1481.0312 L 549.5625,1485.125 C 549.56248,1486.1593 549.42144,1486.9455 549.1875,1487.4688 C 548.9597,1487.9979 548.57918,1488.4633 548.03125,1488.9062 C 547.48331,1489.3495 546.78047,1489.7163 545.90625,1489.9688 C 545.03201,1490.2208 543.95528,1490.3438 542.65625,1490.3438 C 541.4865,1490.3438 540.46182,1490.2022 539.59375,1489.9375 C 538.73183,1489.6727 538.03609,1489.3438 537.53125,1488.9375 C 537.02642,1488.5311 536.63357,1488.0471 536.375,1487.4688 C 536.12258,1486.8962 536,1486.155 536,1485.25 L 536,1481.0312 z M 538.28125,1483.2812 L 538.28125,1484.9375 C 538.28125,1485.6579 538.36455,1486.1799 538.5,1486.5 C 538.63544,1486.8263 538.82285,1487.1094 539.09375,1487.3125 C 539.37079,1487.5218 539.81521,1487.677 540.40625,1487.8125 C 540.99727,1487.9479 541.78341,1488.0313 542.75,1488.0312 C 543.75351,1488.0312 544.54627,1487.9541 545.125,1487.8125 C 545.70371,1487.6771 546.13629,1487.4517 546.46875,1487.1562 C 546.8012,1486.8672 547.02032,1486.512 547.125,1486.0938 C 547.20502,1485.7798 547.24999,1485.1801 547.25,1484.2812 L 547.25,1483.2812 L 538.28125,1483.2812 z M 542.6875,1491.7812 C 544.30051,1491.7812 545.64703,1492.026 546.6875,1492.5 C 547.7341,1492.9802 548.48899,1493.6054 549,1494.375 C 549.51098,1495.1446 549.78123,1496.0916 549.78125,1497.1875 C 549.78123,1498.7758 549.18157,1500.0651 547.96875,1501.0625 C 546.75589,1502.066 545.02222,1502.5625 542.78125,1502.5625 C 540.51563,1502.5625 538.74315,1502.0274 537.46875,1500.9688 C 536.3421,1500.0391 535.78125,1498.782 535.78125,1497.1875 C 535.78125,1495.5806 536.32316,1494.3047 537.4375,1493.375 C 538.7119,1492.3161 540.46498,1491.7813 542.6875,1491.7812 z M 542.78125,1494.0938 C 541.22364,1494.0938 540.06313,1494.409 539.28125,1495 C 538.50552,1495.591 538.125,1496.3133 538.125,1497.1875 C 538.125,1498.0679 538.51168,1498.7963 539.28125,1499.375 C 540.05697,1499.9538 541.24304,1500.25 542.84375,1500.25 C 544.41366,1500.25 545.56139,1499.9726 546.3125,1499.4062 C 547.06359,1498.8463 547.43748,1498.0987 547.4375,1497.1875 C 547.43748,1496.2763 547.06975,1495.5411 546.3125,1494.9688 C 545.55524,1494.3962 544.36963,1494.0937 542.78125,1494.0938 z M 549.5625,1503.2188 L 549.5625,1505.5312 L 540.25,1507.1875 L 549.5625,1509.2188 L 549.5625,1511.9062 L 540.09375,1513.8438 L 549.5625,1515.5625 L 549.5625,1517.8125 L 536,1515.0938 L 536,1512.7188 L 546.125,1510.5 L 536,1508.3125 L 536,1505.875 L 549.5625,1503.2188 z M 536,1518.9688 L 549.5625,1518.9688 L 549.5625,1521.1562 L 540.5,1525.6875 L 549.5625,1525.6875 L 549.5625,1527.7812 L 536,1527.7812 L 536,1525.5312 L 544.84375,1521.0625 L 536,1521.0625 L 536,1518.9688 z" + transform="translate(-4.0383118e-6,0)" + id="path12868" /> \ No newline at end of file diff --git a/ground/openpilotgcs/src/plugins/setupwizard/resources/ground-shapes-wizard.svg b/ground/openpilotgcs/src/plugins/setupwizard/resources/ground-shapes-wizard.svg index 0c8b13289..907718a25 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/resources/ground-shapes-wizard.svg +++ b/ground/openpilotgcs/src/plugins/setupwizard/resources/ground-shapes-wizard.svg @@ -26,7 +26,7 @@ inkscape:export-ydpi="70.479134">image/svg+xml Date: Fri, 20 Feb 2015 03:17:18 +0100 Subject: [PATCH 05/68] OP-1734 Add opacity fading - Remove debug code - Uncrustify --- .../pages/outputcalibrationpage.cpp | 51 ++++++++++--------- .../setupwizard/pages/outputcalibrationpage.h | 2 +- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp index b411d2d01..e90084cec 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp @@ -304,12 +304,12 @@ void OutputCalibrationPage::setupVehicleItems() m_vehicleScene->addItem(item); m_vehicleItems << item; - bool addArrows = false; + bool addArrows = false; if ((m_vehicleElementIds[i].contains("left")) || (m_vehicleElementIds[i].contains("right")) - || (m_vehicleElementIds[i].contains("elevator")) || (m_vehicleElementIds[i].contains("rudder")) + || (m_vehicleElementIds[i].contains("elevator")) || (m_vehicleElementIds[i].contains("rudder")) || (m_vehicleElementIds[i].contains("steering")) || (m_vehicleElementIds[i] == "singleaileron-aileron")) { - addArrows = true; + addArrows = true; } if (addArrows) { @@ -320,9 +320,8 @@ void OutputCalibrationPage::setupVehicleItems() itemUp->setSharedRenderer(m_vehicleRenderer); QString elementUp = m_vehicleElementIds[i] + arrowUp; - qDebug() << "############### Add " << elementUp; itemUp->setElementId(elementUp); - itemUp->setZValue(i+10); + itemUp->setZValue(i + 10); itemUp->setOpacity(0); QRectF itemBounds = m_vehicleRenderer->boundsOnElement(elementUp); @@ -335,7 +334,7 @@ void OutputCalibrationPage::setupVehicleItems() itemDown->setSharedRenderer(m_vehicleRenderer); QString elementDown = m_vehicleElementIds[i] + arrowDown; itemDown->setElementId(elementDown); - itemDown->setZValue(i+10); + itemDown->setZValue(i + 10); itemDown->setOpacity(0); itemBounds = m_vehicleRenderer->boundsOnElement(elementDown); @@ -365,23 +364,21 @@ void OutputCalibrationPage::setupVehicleHighlightedPart() } } -void OutputCalibrationPage::showElementMovement(bool isUp, float value) +void OutputCalibrationPage::showElementMovement(bool isUp, qreal value) { QString highlightedItemName = m_vehicleItems[m_currentWizardIndex]->elementId(); - qDebug() << "+++++" << highlightedItemName; for (int i = 0; i < m_arrowsItems.size(); i++) { - QString upItemName = highlightedItemName + "-up"; + QString upItemName = highlightedItemName + "-up"; QString downItemName = highlightedItemName + "-down"; if (m_arrowsItems[i]->elementId() == upItemName) { - QGraphicsSvgItem *itemUp = m_arrowsItems[i]; - itemUp->setOpacity(isUp ? value : 0); + QGraphicsSvgItem *itemUp = m_arrowsItems[i]; + itemUp->setOpacity(isUp ? value : 0); } if (m_arrowsItems[i]->elementId() == downItemName) { - QGraphicsSvgItem *itemDown = m_arrowsItems[i]; - itemDown->setOpacity(isUp ? 0 : value); + QGraphicsSvgItem *itemDown = m_arrowsItems[i]; + itemDown->setOpacity(isUp ? 0 : value); } - qDebug() << "***** " << i << " ****** " << m_arrowsItems[i]->elementId(); } } @@ -428,7 +425,7 @@ void OutputCalibrationPage::setWizardPage() } } setupVehicleHighlightedPart(); - // Hide arrows + // Hide arrows showElementMovement(true, 0); showElementMovement(false, 0); } @@ -479,8 +476,6 @@ void OutputCalibrationPage::customBackClicked() } else { getWizard()->back(); } - - } quint16 OutputCalibrationPage::getCurrentChannel() @@ -546,7 +541,7 @@ void OutputCalibrationPage::enableServoSliders(bool enabled) ui->servoMinAngleSlider->setEnabled(enabled); ui->servoMaxAngleSlider->setEnabled(enabled); ui->reverseCheckbox->setEnabled(!enabled); - // Hide arrows + // Hide arrows showElementMovement(true, 0); showElementMovement(false, 0); } @@ -640,17 +635,23 @@ void OutputCalibrationPage::on_servoCenterAngleSlider_valueChanged(int position) quint16 minValue = (ui->reverseCheckbox->isChecked()) ? ui->servoMaxAngleSlider->value() : ui->servoMinAngleSlider->value(); quint16 maxValue = (ui->reverseCheckbox->isChecked()) ? ui->servoMinAngleSlider->value() : ui->servoMaxAngleSlider->value(); - quint16 range = maxValue - minValue; + quint16 range = maxValue - minValue; // Reset arows showElementMovement(true, 0); showElementMovement(false, 0); - // 20% "Dead band" : no arrow display - if (value < minValue + (range * 0.40)) { - showElementMovement((ui->reverseCheckbox->isChecked() ? true : false), 1.0); - } else if (value > maxValue - (range * 0.40)) { - showElementMovement((ui->reverseCheckbox->isChecked() ? false : true), 1.0); - } + // 30% "Dead band" : no arrow display + quint16 limitLow = minValue + (range * 0.35); + quint16 limitHigh = maxValue - (range * 0.35); + quint16 middle = minValue + (range / 2); + qreal arrowOpacity = 0; + if (value < limitLow) { + arrowOpacity = double(middle - value) / double(middle - minValue); + showElementMovement((ui->reverseCheckbox->isChecked() ? true : false), arrowOpacity); + } else if (value > limitHigh) { + arrowOpacity = double(value - middle) / double(maxValue - middle); + showElementMovement((ui->reverseCheckbox->isChecked() ? false : true), arrowOpacity); + } debugLogChannelValues(); } diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h index 7326d04f0..cc1de2564 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h @@ -76,7 +76,7 @@ private: void startWizard(); void setupVehicleItems(); void setupVehicleHighlightedPart(); - void showElementMovement(bool isUp, float value); + void showElementMovement(bool isUp, qreal value); void setWizardPage(); void enableButtons(bool enable); void enableServoSliders(bool enabled); From 1792991012b6fd0f257508d18ca50db24211db1d Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Fri, 20 Feb 2015 12:16:59 +0100 Subject: [PATCH 06/68] OP-1734 Display min/max servo values --- .../src/plugins/setupwizard/pages/outputcalibrationpage.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp index e90084cec..6ddfdbd6e 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp @@ -662,6 +662,7 @@ void OutputCalibrationPage::on_servoMinAngleSlider_valueChanged(int position) quint16 value = ui->servoMinAngleSlider->value(); m_calibrationUtil->setChannelOutputValue(value); m_actuatorSettings[getCurrentChannel()].channelMin = value; + ui->servoPWMValue->setText(tr("Output value : %1 µs (Min)").arg(value)); // Adjust neutral and max if (ui->reverseCheckbox->isChecked()) { @@ -688,6 +689,7 @@ void OutputCalibrationPage::on_servoMaxAngleSlider_valueChanged(int position) quint16 value = ui->servoMaxAngleSlider->value(); m_calibrationUtil->setChannelOutputValue(value); m_actuatorSettings[getCurrentChannel()].channelMax = value; + ui->servoPWMValue->setText(tr("Output value : %1 µs (Max)").arg(value)); // Adjust neutral and min if (ui->reverseCheckbox->isChecked()) { From 518059a6b1807a4e5a7ac8bdda778dc53c55fa60 Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Fri, 20 Feb 2015 16:39:19 +0100 Subject: [PATCH 07/68] OP-1734 replace double with qreal --- .../src/plugins/setupwizard/pages/outputcalibrationpage.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp index 6ddfdbd6e..d1fb9104f 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp @@ -646,10 +646,10 @@ void OutputCalibrationPage::on_servoCenterAngleSlider_valueChanged(int position) quint16 middle = minValue + (range / 2); qreal arrowOpacity = 0; if (value < limitLow) { - arrowOpacity = double(middle - value) / double(middle - minValue); + arrowOpacity = (qreal)(middle - value) / (qreal)(middle - minValue); showElementMovement((ui->reverseCheckbox->isChecked() ? true : false), arrowOpacity); } else if (value > limitHigh) { - arrowOpacity = double(value - middle) / double(maxValue - middle); + arrowOpacity = (qreal)(value - middle) / (qreal)(maxValue - middle); showElementMovement((ui->reverseCheckbox->isChecked() ? false : true), arrowOpacity); } From 89f4bf56a841e75a1f9ad378011f590fc5ea712e Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Fri, 20 Feb 2015 16:54:16 +0100 Subject: [PATCH 08/68] OP-1734 Review changes --- .../src/plugins/setupwizard/pages/outputcalibrationpage.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp index d1fb9104f..05853d12d 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp @@ -647,10 +647,10 @@ void OutputCalibrationPage::on_servoCenterAngleSlider_valueChanged(int position) qreal arrowOpacity = 0; if (value < limitLow) { arrowOpacity = (qreal)(middle - value) / (qreal)(middle - minValue); - showElementMovement((ui->reverseCheckbox->isChecked() ? true : false), arrowOpacity); + showElementMovement(ui->reverseCheckbox->isChecked(), arrowOpacity); } else if (value > limitHigh) { arrowOpacity = (qreal)(value - middle) / (qreal)(maxValue - middle); - showElementMovement((ui->reverseCheckbox->isChecked() ? false : true), arrowOpacity); + showElementMovement(!ui->reverseCheckbox->isChecked(), arrowOpacity); } debugLogChannelValues(); From f0cab73fdde5953a5eeb8099829316b2c0209a3b Mon Sep 17 00:00:00 2001 From: James Duley Date: Mon, 23 Feb 2015 15:33:14 +1300 Subject: [PATCH 09/68] OP-1736 make package label meaningful --- make/scripts/version-info.py | 40 +++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/make/scripts/version-info.py b/make/scripts/version-info.py index 889925700..82ebb48d8 100644 --- a/make/scripts/version-info.py +++ b/make/scripts/version-info.py @@ -68,12 +68,15 @@ class Repo: if self._rc == 0: self._time = self._out - def _get_tag(self): + def _get_last_tag(self): """Get and store git tag for the HEAD commit""" - self._tag = None - self._exec('describe --tags --exact-match HEAD') + self._last_tag = None + self._num_commits_past_tag = None + self._exec('describe --tags --long') if self._rc == 0: - self._tag = self._out.strip(' \t\n\r') + descriptions = self._out.rsplit('-', 2) + self._last_tag = descriptions[-3] + self._num_commits_past_tag = descriptions[-2] def _get_branch(self): """Get and store current branch containing the HEAD commit""" @@ -102,7 +105,8 @@ class Repo: self._hash = json_data['hash'] self._origin = json_data['origin'] self._time = json_data['time'] - self._tag = json_data['tag'] + self._last_tag = json_data['last_tag'] + self._num_commits_past_tag = json_data['num_commits_past_tag'] self._branch = json_data['branch'] self._dirty = json_data['dirty'] @@ -119,14 +123,15 @@ class Repo: self._hash = self._out.strip(' \t\n\r') self._get_origin() self._get_time() - self._get_tag() + self._get_last_tag() self._get_branch() self._get_dirty() else: self._hash = None self._origin = None self._time = None - self._tag = None + self._last_tag = None + self._num_commits_past_tag = None self._branch = None self._dirty = None @@ -160,10 +165,10 @@ class Repo: def tag(self, none = None): """Return git tag for the HEAD commit or given string if none""" - if self._tag == None: + if self._last_tag == None or self._num_commits_past_tag != 0: return none else: - return self._tag + return self._last_tag def branch(self, none = None): """Return git branch containing the HEAD or given string if none""" @@ -180,22 +185,22 @@ class Repo: return clean def label(self): - """Return package label (tag if defined, or date-hash if no tag)""" + """Return package label (similar to git describe)""" try: - if self._tag == None: - return ''.join([self.time('%Y%m%d'), "-", self.hash(8, 'untagged'), self.dirty()]) + if self._num_commits_past_tag == 0: + return self._last_tag + self.dirty() else: - return ''.join([self.tag(''), self.dirty()]) + return self._last_tag + "+r" + self._num_commits_past_tag + "-g" + self.hash(7, '') + self.dirty() except: return None def revision(self): """Return full revison string (tag if defined, or branch:hash date time if no tag)""" try: - if self._tag == None: - return ''.join([self.branch('no-branch'), ":", self.hash(8, 'no-hash'), self.dirty(), self.time(' %Y%m%d %H:%M')]) + if self._num_commits_past_tag == 0: + return self.tag('') + self.dirty() else: - return ''.join([self.tag(''), self.dirty()]) + return self.branch('no-branch') + ":" + self.hash(8, 'no-hash') + self.dirty() + self.time(' %Y%m%d %H:%M') except: return None @@ -220,7 +225,8 @@ class Repo: json_data['hash'] = self._hash json_data['origin'] = self._origin json_data['time'] = self._time - json_data['tag'] = self._tag + json_data['last_tag'] = self._last_tag + json_data['num_commits_past_tag'] = self._num_commits_past_tag json_data['branch'] = self._branch json_data['dirty'] = self._dirty From 3cb1357069942b420578d4c00fee933cc8c5b8c2 Mon Sep 17 00:00:00 2001 From: m_thread Date: Sat, 28 Feb 2015 14:07:47 +0100 Subject: [PATCH 10/68] OP-1756 Added checkbox to ui file. --- .../pages/outputcalibrationpage.ui | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.ui b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.ui index 202b766a2..d1b590cf1 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.ui +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.ui @@ -53,7 +53,7 @@ - 2 + 1 @@ -123,6 +123,26 @@ p, li { white-space: pre-wrap; } + + + + Calibrate all motor outputs at the same time + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + From 662f1fb3f320777e4dc0156d17106ce646dac74e Mon Sep 17 00:00:00 2001 From: m_thread Date: Sun, 1 Mar 2015 12:12:50 +0100 Subject: [PATCH 11/68] OP-1756 Added handling for svg item highlight when calibrating all motors. --- .../pages/outputcalibrationpage.cpp | 26 ++++++++++++++++++- .../setupwizard/pages/outputcalibrationpage.h | 2 ++ .../pages/outputcalibrationpage.ui | 2 +- 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp index fb4775aa9..10c4252cb 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp @@ -43,6 +43,8 @@ OutputCalibrationPage::OutputCalibrationPage(SetupWizard *wizard, QWidget *paren qDebug() << "calling output calibration page"; m_vehicleRenderer = new QSvgRenderer(); + connect(ui->calibrateAllMotors, SIGNAL(toggled(bool)), this, SLOT(calibrateAllMotorsChanged())); + // move the code that was here to setupVehicle() so we can determine which image to use. m_vehicleScene = new QGraphicsScene(this); ui->vehicleView->setScene(m_vehicleScene); @@ -308,6 +310,7 @@ void OutputCalibrationPage::setupVehicleItems() void OutputCalibrationPage::startWizard() { ui->calibrationStack->setCurrentIndex(m_wizardIndexes[0]); + enableAllMotorsCheckBox(true); setupVehicleHighlightedPart(); } @@ -319,7 +322,11 @@ void OutputCalibrationPage::setupVehicleHighlightedPart() for (int i = 0; i < m_vehicleItems.size(); i++) { QGraphicsSvgItem *item = m_vehicleItems[i]; - item->setOpacity((highlightedIndex == i) ? highlightOpaque : dimOpaque); + if (highlightedIndex == i || (ui->calibrateAllMotors->isChecked() && m_wizardIndexes[m_currentWizardIndex] == 1)) { + item->setOpacity(highlightOpaque); + } else { + item->setOpacity(dimOpaque); + } } } @@ -421,12 +428,24 @@ quint16 OutputCalibrationPage::getCurrentChannel() return m_channelIndex[m_currentWizardIndex]; } +void OutputCalibrationPage::enableAllMotorsCheckBox(bool enable) +{ + if (getWizard()->getVehicleType() == SetupWizard::VEHICLE_MULTI) { + ui->calibrateAllMotors->setVisible(true); + ui->calibrateAllMotors->setEnabled(enable); + } else { + ui->calibrateAllMotors->setChecked(false); + ui->calibrateAllMotors->setVisible(false); + } +} + void OutputCalibrationPage::enableButtons(bool enable) { getWizard()->button(QWizard::NextButton)->setEnabled(enable); getWizard()->button(QWizard::CustomButton1)->setEnabled(enable); getWizard()->button(QWizard::CancelButton)->setEnabled(enable); getWizard()->button(QWizard::BackButton)->setEnabled(enable); + enableAllMotorsCheckBox(enable); QApplication::processEvents(); } @@ -651,6 +670,11 @@ void OutputCalibrationPage::on_reverseCheckbox_toggled(bool checked) } } +void OutputCalibrationPage::on_calibrateAllMotors_toggled(bool checked) +{ + setupVehicleHighlightedPart(); +} + void OutputCalibrationPage::resetOutputCalibrationUtil() { if (m_calibrationUtil) { diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h index 3691a1d0a..fdbb81928 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h @@ -70,6 +70,7 @@ private slots: void on_servoMinAngleSlider_valueChanged(int position); void on_servoMaxAngleSlider_valueChanged(int position); void on_reverseCheckbox_toggled(bool checked); + void on_calibrateAllMotors_toggled(bool checked); private: void setupVehicle(); @@ -83,6 +84,7 @@ private: bool checkAlarms(); void debugLogChannelValues(); quint16 getCurrentChannel(); + void enableAllMotorsCheckBox(bool enable); Ui::OutputCalibrationPage *ui; QSvgRenderer *m_vehicleRenderer; diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.ui b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.ui index d1b590cf1..f8bb50966 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.ui +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.ui @@ -124,7 +124,7 @@ p, li { white-space: pre-wrap; } - + Calibrate all motor outputs at the same time From 8d6070d674b3152be8be0305740e88769d5b498c Mon Sep 17 00:00:00 2001 From: m_thread Date: Sun, 1 Mar 2015 12:31:57 +0100 Subject: [PATCH 12/68] OP-1756 Added information of the types of the svg elements to be able to enable correctly. --- .../pages/outputcalibrationpage.cpp | 20 ++++++++++++++++++- .../setupwizard/pages/outputcalibrationpage.h | 2 ++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp index 10c4252cb..1b82c5aa0 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp @@ -114,6 +114,7 @@ void OutputCalibrationPage::setupVehicle() m_actuatorSettings = getWizard()->getActuatorSettings(); m_wizardIndexes.clear(); m_vehicleElementIds.clear(); + m_vehicleElementTypes.clear(); m_vehicleHighlightElementIndexes.clear(); m_channelIndex.clear(); m_currentWizardIndex = 0; @@ -133,6 +134,9 @@ void OutputCalibrationPage::setupVehicle() // All element ids to load from the svg file and manage. m_vehicleElementIds << "tri" << "tri-frame" << "tri-m1" << "tri-m2" << "tri-m3" << "tri-s1"; + // The type of each element. + m_vehicleElementTypes << FULL << FRAME << MOTOR << MOTOR << MOTOR << SERVO; + // The index of the elementId to highlight ( not dim ) for each step // this is the index in the m_vehicleElementIds - 1. m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4; @@ -148,6 +152,7 @@ void OutputCalibrationPage::setupVehicle() loadSVGFile(MULTI_SVG_FILE); m_wizardIndexes << 0 << 1 << 1 << 1 << 1; m_vehicleElementIds << "quad-x" << "quad-x-frame" << "quad-x-m1" << "quad-x-m2" << "quad-x-m3" << "quad-x-m4"; + m_vehicleElementTypes << FULL << FRAME << MOTOR << MOTOR << MOTOR << MOTOR; m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4; m_channelIndex << 0 << 0 << 1 << 2 << 3; setupActuatorMinMaxAndNeutral(0, 3, 4); @@ -156,6 +161,7 @@ void OutputCalibrationPage::setupVehicle() loadSVGFile(MULTI_SVG_FILE); m_wizardIndexes << 0 << 1 << 1 << 1 << 1; m_vehicleElementIds << "quad-p" << "quad-p-frame" << "quad-p-m1" << "quad-p-m2" << "quad-p-m3" << "quad-p-m4"; + m_vehicleElementTypes << FULL << FRAME << MOTOR << MOTOR << MOTOR << MOTOR; m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4; m_channelIndex << 0 << 0 << 1 << 2 << 3; setupActuatorMinMaxAndNeutral(0, 3, 4); @@ -164,6 +170,7 @@ void OutputCalibrationPage::setupVehicle() loadSVGFile(MULTI_SVG_FILE); m_wizardIndexes << 0 << 1 << 1 << 1 << 1 << 1 << 1; m_vehicleElementIds << "hexa" << "hexa-frame" << "hexa-m1" << "hexa-m2" << "hexa-m3" << "hexa-m4" << "hexa-m5" << "hexa-m6"; + m_vehicleElementTypes << FULL << FRAME << MOTOR << MOTOR << MOTOR << MOTOR << MOTOR << MOTOR; m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4 << 5 << 6; m_channelIndex << 0 << 0 << 1 << 2 << 3 << 4 << 5; setupActuatorMinMaxAndNeutral(0, 5, 6); @@ -172,6 +179,7 @@ void OutputCalibrationPage::setupVehicle() loadSVGFile(MULTI_SVG_FILE); m_wizardIndexes << 0 << 1 << 1 << 1 << 1 << 1 << 1; m_vehicleElementIds << "hexa-y6" << "hexa-y6-frame" << "hexa-y6-m2" << "hexa-y6-m1" << "hexa-y6-m4" << "hexa-y6-m3" << "hexa-y6-m6" << "hexa-y6-m5"; + m_vehicleElementTypes << FULL << FRAME << MOTOR << MOTOR << MOTOR << MOTOR << MOTOR << MOTOR; m_vehicleHighlightElementIndexes << 0 << 2 << 1 << 4 << 3 << 6 << 5; m_channelIndex << 0 << 0 << 1 << 2 << 3 << 4 << 5; setupActuatorMinMaxAndNeutral(0, 5, 6); @@ -180,6 +188,7 @@ void OutputCalibrationPage::setupVehicle() loadSVGFile(MULTI_SVG_FILE); m_wizardIndexes << 0 << 1 << 1 << 1 << 1 << 1 << 1; m_vehicleElementIds << "hexa-h" << "hexa-h-frame" << "hexa-h-m1" << "hexa-h-m2" << "hexa-h-m3" << "hexa-h-m4" << "hexa-h-m5" << "hexa-h-m6"; + m_vehicleElementTypes << FULL << FRAME << MOTOR << MOTOR << MOTOR << MOTOR << MOTOR << MOTOR; m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4 << 5 << 6; m_channelIndex << 0 << 0 << 1 << 2 << 3 << 4 << 5; setupActuatorMinMaxAndNeutral(0, 5, 6); @@ -188,6 +197,7 @@ void OutputCalibrationPage::setupVehicle() loadSVGFile(MULTI_SVG_FILE); m_wizardIndexes << 0 << 1 << 1 << 1 << 1 << 1 << 1; m_vehicleElementIds << "hexa-x" << "hexa-x-frame" << "hexa-x-m1" << "hexa-x-m2" << "hexa-x-m3" << "hexa-x-m4" << "hexa-x-m5" << "hexa-x-m6"; + m_vehicleElementTypes << FULL << FRAME << MOTOR << MOTOR << MOTOR << MOTOR << MOTOR << MOTOR; m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4 << 5 << 6; m_channelIndex << 0 << 0 << 1 << 2 << 3 << 4 << 5; setupActuatorMinMaxAndNeutral(0, 5, 6); @@ -197,6 +207,7 @@ void OutputCalibrationPage::setupVehicle() loadSVGFile(FIXEDWING_SVG_FILE); m_wizardIndexes << 0 << 1 << 2 << 2 << 2 << 2; m_vehicleElementIds << "aileron" << "aileron-frame" << "aileron-motor" << "aileron-ail-left" << "aileron-ail-right" << "aileron-elevator" << "aileron-rudder"; + m_vehicleElementTypes << FULL << FRAME << MOTOR << SERVO << SERVO << SERVO << SERVO; m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4 << 5; m_channelIndex << 0 << 2 << 0 << 5 << 1 << 3; @@ -208,6 +219,7 @@ void OutputCalibrationPage::setupVehicle() loadSVGFile(FIXEDWING_SVG_FILE); m_wizardIndexes << 0 << 1 << 2 << 2 << 2; m_vehicleElementIds << "aileron-single" << "ail2-frame" << "ail2-motor" << "ail2-aileron" << "ail2-elevator" << "ail2-rudder"; + m_vehicleElementTypes << FULL << FRAME << MOTOR << SERVO << SERVO << SERVO; m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4; m_channelIndex << 0 << 2 << 0 << 1 << 3; @@ -219,6 +231,7 @@ void OutputCalibrationPage::setupVehicle() loadSVGFile(FIXEDWING_SVG_FILE); m_wizardIndexes << 0 << 1 << 2 << 2; m_vehicleElementIds << "elevon" << "elevon-frame" << "elevon-motor" << "elevon-left" << "elevon-right"; + m_vehicleElementTypes << FULL << FRAME << MOTOR << SERVO << SERVO; m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3; m_channelIndex << 0 << 2 << 0 << 1; @@ -230,6 +243,7 @@ void OutputCalibrationPage::setupVehicle() loadSVGFile(FIXEDWING_SVG_FILE); m_wizardIndexes << 0 << 1 << 2 << 2 << 2 << 2; m_vehicleElementIds << "vtail" << "vtail-frame" << "vtail-motor" << "vtail-ail-left" << "vtail-ail-right" << "vtail-rudder-left" << "vtail-rudder-right"; + m_vehicleElementTypes << FULL << FRAME << MOTOR << SERVO << SERVO << SERVO << SERVO; m_vehicleHighlightElementIndexes << 0 << 1 << 2 << 3 << 4 << 5; m_channelIndex << 0 << 2 << 0 << 5 << 3 << 1; @@ -243,6 +257,7 @@ void OutputCalibrationPage::setupVehicle() loadSVGFile(GROUND_SVG_FILE); m_wizardIndexes << 0 << 1 << 2; m_vehicleElementIds << "car" << "car-frame" << "car-motor" << "car-steering"; + m_vehicleElementTypes << FULL << FRAME << MOTOR << SERVO; m_vehicleHighlightElementIndexes << 0 << 1 << 2; m_channelIndex << 0 << 1 << 0; @@ -254,6 +269,7 @@ void OutputCalibrationPage::setupVehicle() loadSVGFile(GROUND_SVG_FILE); m_wizardIndexes << 0 << 1 << 1; m_vehicleElementIds << "tank" << "tank-frame" << "tank-left-motor" << "tank-right-motor"; + m_vehicleElementTypes << FULL << FRAME << MOTOR << MOTOR; m_vehicleHighlightElementIndexes << 0 << 1 << 2; m_channelIndex << 0 << 0 << 1; @@ -265,6 +281,7 @@ void OutputCalibrationPage::setupVehicle() loadSVGFile(GROUND_SVG_FILE); m_wizardIndexes << 0 << 1 << 2; m_vehicleElementIds << "motorbike" << "motorbike-frame" << "motorbike-motor" << "motorbike-steering"; + m_vehicleElementTypes << FULL << FRAME << MOTOR << SERVO; m_vehicleHighlightElementIndexes << 0 << 1 << 2; m_channelIndex << 0 << 1 << 0; @@ -322,7 +339,7 @@ void OutputCalibrationPage::setupVehicleHighlightedPart() for (int i = 0; i < m_vehicleItems.size(); i++) { QGraphicsSvgItem *item = m_vehicleItems[i]; - if (highlightedIndex == i || (ui->calibrateAllMotors->isChecked() && m_wizardIndexes[m_currentWizardIndex] == 1)) { + if (highlightedIndex == i || (ui->calibrateAllMotors->isChecked() && m_vehicleElementTypes[i] == MOTOR)) { item->setOpacity(highlightOpaque); } else { item->setOpacity(dimOpaque); @@ -672,6 +689,7 @@ void OutputCalibrationPage::on_reverseCheckbox_toggled(bool checked) void OutputCalibrationPage::on_calibrateAllMotors_toggled(bool checked) { + Q_UNUSED(checked); setupVehicleHighlightedPart(); } diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h index fdbb81928..ea1ab15a4 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h @@ -73,6 +73,7 @@ private slots: void on_calibrateAllMotors_toggled(bool checked); private: + enum ElementType{ FULL, FRAME, MOTOR, SERVO }; void setupVehicle(); void startWizard(); void setupVehicleItems(); @@ -94,6 +95,7 @@ private: qint16 m_currentWizardIndex; QList m_vehicleElementIds; + QList m_vehicleElementTypes; QList m_vehicleItems; QList m_vehicleHighlightElementIndexes; QList m_channelIndex; From f2c80d7d0673051411e0b1e46d6f8b8aaf1e4e8d Mon Sep 17 00:00:00 2001 From: m_thread Date: Sun, 1 Mar 2015 17:45:19 +0100 Subject: [PATCH 13/68] OP-1756 Added code to properly handle next and back when calibrating all motors at the same time. --- .../pages/outputcalibrationpage.cpp | 26 ++++++++++++++++--- .../setupwizard/pages/outputcalibrationpage.h | 2 +- .../src/plugins/setupwizard/setupwizard.cpp | 3 +++ 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp index 1b82c5aa0..634fa6b8b 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp @@ -339,7 +339,7 @@ void OutputCalibrationPage::setupVehicleHighlightedPart() for (int i = 0; i < m_vehicleItems.size(); i++) { QGraphicsSvgItem *item = m_vehicleItems[i]; - if (highlightedIndex == i || (ui->calibrateAllMotors->isChecked() && m_vehicleElementTypes[i] == MOTOR)) { + if (highlightedIndex == i || (ui->calibrateAllMotors->isChecked() && m_vehicleElementTypes[i + 1] == MOTOR)) { item->setOpacity(highlightOpaque); } else { item->setOpacity(dimOpaque); @@ -402,11 +402,21 @@ void OutputCalibrationPage::initializePage() bool OutputCalibrationPage::validatePage() { + if (!isFinished()) { + m_currentWizardIndex++; + if (ui->calibrateAllMotors->isChecked() && + m_currentWizardIndex > 0 && + m_wizardIndexes[m_currentWizardIndex - 1] == 1) { + while (!isFinished() && m_wizardIndexes[m_currentWizardIndex] == 1) { + m_currentWizardIndex++; + } + } + } + if (isFinished()) { getWizard()->setActuatorSettings(m_actuatorSettings); return true; } else { - m_currentWizardIndex++; setWizardPage(); return false; } @@ -432,8 +442,18 @@ void OutputCalibrationPage::resizeEvent(QResizeEvent *event) void OutputCalibrationPage::customBackClicked() { - if (m_currentWizardIndex > 0) { + if (m_currentWizardIndex >= 0) { m_currentWizardIndex--; + if (ui->calibrateAllMotors->isChecked()) { + while (m_currentWizardIndex > 0 && + m_wizardIndexes[m_currentWizardIndex] == 1 && + m_wizardIndexes[m_currentWizardIndex - 1] == 1) { + m_currentWizardIndex--; + } + } + } + + if (m_currentWizardIndex >= 0) { setWizardPage(); } else { getWizard()->back(); diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h index ea1ab15a4..53f4ec033 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h @@ -49,7 +49,7 @@ public: bool isFinished() { - return m_currentWizardIndex >= m_wizardIndexes.size() - 1; + return m_currentWizardIndex >= m_wizardIndexes.size(); } void loadSVGFile(QString file); diff --git a/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp b/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp index 2deacf968..7dded3653 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp @@ -489,6 +489,9 @@ void SetupWizard::customBackClicked() static_cast(currentPage())->customBackClicked(); } else { back(); + if (currentId() == PAGE_OUTPUT_CALIBRATION) { + static_cast(currentPage())->customBackClicked(); + } } } From 404643943339763a645053c5cabe6296e7c7809a Mon Sep 17 00:00:00 2001 From: m_thread Date: Sun, 1 Mar 2015 22:48:35 +0100 Subject: [PATCH 14/68] OP-1756 Added code to set the actuator command for multiple channels at the same time from calibration. --- .../setupwizard/outputcalibrationutil.cpp | 2 +- .../setupwizard/outputcalibrationutil.h | 2 +- .../pages/outputcalibrationpage.cpp | 153 ++++++++++++------ .../setupwizard/pages/outputcalibrationpage.h | 5 +- 4 files changed, 105 insertions(+), 57 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/setupwizard/outputcalibrationutil.cpp b/ground/openpilotgcs/src/plugins/setupwizard/outputcalibrationutil.cpp index 5369bf845..8cdd16883 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/outputcalibrationutil.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/outputcalibrationutil.cpp @@ -100,7 +100,7 @@ void OutputCalibrationUtil::startChannelOutput(quint16 channel, quint16 safeValu startChannelOutput(channels, safeValue); } -void OutputCalibrationUtil::startChannelOutput(QList channels, quint16 safeValue) +void OutputCalibrationUtil::startChannelOutput(QList &channels, quint16 safeValue) { if (c_prepared) { m_outputChannels = channels; diff --git a/ground/openpilotgcs/src/plugins/setupwizard/outputcalibrationutil.h b/ground/openpilotgcs/src/plugins/setupwizard/outputcalibrationutil.h index 45e800bc6..6f6e722a8 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/outputcalibrationutil.h +++ b/ground/openpilotgcs/src/plugins/setupwizard/outputcalibrationutil.h @@ -44,7 +44,7 @@ public: public slots: void startChannelOutput(quint16 channel, quint16 safeValue); - void startChannelOutput(QList channels, quint16 safeValue); + void startChannelOutput(QList &channels, quint16 safeValue); void stopChannelOutput(); void setChannelOutputValue(quint16 value); diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp index 634fa6b8b..fc7e08655 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp @@ -357,7 +357,9 @@ void OutputCalibrationPage::setWizardPage() qDebug() << "Current page: " << currentPageIndex; ui->calibrationStack->setCurrentIndex(currentPageIndex); - int currentChannel = getCurrentChannel(); + QList currentChannels; + getCurrentChannels(currentChannels); + int currentChannel = currentChannels[0]; qDebug() << "Current channel: " << currentChannel + 1; if (currentChannel >= 0) { if (currentPageIndex == 1) { @@ -460,9 +462,17 @@ void OutputCalibrationPage::customBackClicked() } } -quint16 OutputCalibrationPage::getCurrentChannel() +void OutputCalibrationPage::getCurrentChannels(QList &channels) { - return m_channelIndex[m_currentWizardIndex]; + if (ui->calibrateAllMotors->isChecked()) { + for(int i = 1; i < m_channelIndex.size(); i++) { + if (m_vehicleElementTypes[i + 1] == MOTOR) { + channels << m_channelIndex[i]; + } + } + } else { + channels << m_channelIndex[m_currentWizardIndex]; + } } void OutputCalibrationPage::enableAllMotorsCheckBox(bool enable) @@ -490,35 +500,43 @@ void OutputCalibrationPage::on_motorNeutralButton_toggled(bool checked) { ui->motorNeutralButton->setText(checked ? tr("Stop") : tr("Start")); ui->motorNeutralSlider->setEnabled(checked); - quint16 channel = getCurrentChannel(); - quint16 safeValue = m_actuatorSettings[channel].channelMin; - if (m_actuatorSettings[channel].isReversableMotor) { - safeValue = m_actuatorSettings[channel].channelNeutral; + QList currentChannels; + getCurrentChannels(currentChannels); + quint16 currentChannel = currentChannels[0]; + + quint16 safeValue = m_actuatorSettings[currentChannel].channelMin; + + if (m_actuatorSettings[currentChannel].isReversableMotor) { + safeValue = m_actuatorSettings[currentChannel].channelNeutral; } - onStartButtonToggle(ui->motorNeutralButton, channel, m_actuatorSettings[channel].channelNeutral, safeValue, ui->motorNeutralSlider); + onStartButtonToggle(ui->motorNeutralButton, currentChannels, m_actuatorSettings[currentChannel].channelNeutral, safeValue, ui->motorNeutralSlider); } -void OutputCalibrationPage::onStartButtonToggle(QAbstractButton *button, quint16 channel, quint16 value, quint16 safeValue, QSlider *slider) +void OutputCalibrationPage::onStartButtonToggle(QAbstractButton *button, QList &channels, + quint16 value, quint16 safeValue, QSlider *slider) { if (button->isChecked()) { + // Start calibration if (checkAlarms()) { enableButtons(false); enableServoSliders(true); - m_calibrationUtil->startChannelOutput(channel, safeValue); + m_calibrationUtil->startChannelOutput(channels, safeValue); slider->setValue(value); m_calibrationUtil->setChannelOutputValue(value); } else { button->setChecked(false); } } else { - // Servos and ReversableMotors - m_calibrationUtil->startChannelOutput(channel, m_actuatorSettings[channel].channelNeutral); - - // Normal motor + // Stop calibration + quint16 channel = channels[0]; if ((button == ui->motorNeutralButton) && !m_actuatorSettings[channel].isReversableMotor) { - m_calibrationUtil->startChannelOutput(channel, m_actuatorSettings[channel].channelMin); + // Normal motor + m_calibrationUtil->startChannelOutput(channels, m_actuatorSettings[channel].channelMin); + } else { + // Servos and ReversableMotors + m_calibrationUtil->startChannelOutput(channels, m_actuatorSettings[channel].channelNeutral); } m_calibrationUtil->stopChannelOutput(); @@ -570,11 +588,13 @@ bool OutputCalibrationPage::checkAlarms() void OutputCalibrationPage::debugLogChannelValues() { - quint16 channel = getCurrentChannel(); + QList currentChannels; + getCurrentChannels(currentChannels); + quint16 currentChannel = currentChannels[0]; - qDebug() << "ChannelMin : " << m_actuatorSettings[channel].channelMin; - qDebug() << "ChannelNeutral: " << m_actuatorSettings[channel].channelNeutral; - qDebug() << "ChannelMax : " << m_actuatorSettings[channel].channelMax; + qDebug() << "ChannelMin : " << m_actuatorSettings[currentChannel].channelMin; + qDebug() << "ChannelNeutral: " << m_actuatorSettings[currentChannel].channelNeutral; + qDebug() << "ChannelMax : " << m_actuatorSettings[currentChannel].channelMax; } void OutputCalibrationPage::on_motorNeutralSlider_valueChanged(int value) @@ -585,7 +605,12 @@ void OutputCalibrationPage::on_motorNeutralSlider_valueChanged(int value) if (ui->motorNeutralButton->isChecked()) { quint16 value = ui->motorNeutralSlider->value(); m_calibrationUtil->setChannelOutputValue(value); - m_actuatorSettings[getCurrentChannel()].channelNeutral = value; + + QList currentChannels; + getCurrentChannels(currentChannels); + foreach(quint16 channel, currentChannels) { + m_actuatorSettings[channel].channelNeutral = value; + } debugLogChannelValues(); } } @@ -593,9 +618,13 @@ void OutputCalibrationPage::on_motorNeutralSlider_valueChanged(int value) void OutputCalibrationPage::on_servoButton_toggled(bool checked) { ui->servoButton->setText(checked ? tr("Stop") : tr("Start")); - quint16 channel = getCurrentChannel(); - quint16 safeValue = m_actuatorSettings[channel].channelNeutral; - onStartButtonToggle(ui->servoButton, channel, safeValue, safeValue, ui->servoCenterAngleSlider); + + QList currentChannels; + getCurrentChannels(currentChannels); + quint16 currentChannel = currentChannels[0]; + + quint16 safeValue = m_actuatorSettings[currentChannel].channelNeutral; + onStartButtonToggle(ui->servoButton, currentChannels, safeValue, safeValue, ui->servoCenterAngleSlider); } void OutputCalibrationPage::on_servoCenterAngleSlider_valueChanged(int position) @@ -603,23 +632,27 @@ void OutputCalibrationPage::on_servoCenterAngleSlider_valueChanged(int position) Q_UNUSED(position); quint16 value = ui->servoCenterAngleSlider->value(); m_calibrationUtil->setChannelOutputValue(value); - quint16 channel = getCurrentChannel(); - m_actuatorSettings[channel].channelNeutral = value; + + QList currentChannels; + getCurrentChannels(currentChannels); + quint16 currentChannel = currentChannels[0]; + + m_actuatorSettings[currentChannel].channelNeutral = value; ui->servoPWMValue->setText(tr("Output value : %1 µs").arg(value)); // Adjust min and max if (ui->reverseCheckbox->isChecked()) { - if (value >= m_actuatorSettings[channel].channelMin) { + if (value >= m_actuatorSettings[currentChannel].channelMin) { ui->servoMinAngleSlider->setValue(value); } - if (value <= m_actuatorSettings[channel].channelMax) { + if (value <= m_actuatorSettings[currentChannel].channelMax) { ui->servoMaxAngleSlider->setValue(value); } } else { - if (value <= m_actuatorSettings[channel].channelMin) { + if (value <= m_actuatorSettings[currentChannel].channelMin) { ui->servoMinAngleSlider->setValue(value); } - if (value >= m_actuatorSettings[channel].channelMax) { + if (value >= m_actuatorSettings[currentChannel].channelMax) { ui->servoMaxAngleSlider->setValue(value); } } @@ -631,21 +664,26 @@ void OutputCalibrationPage::on_servoMinAngleSlider_valueChanged(int position) Q_UNUSED(position); quint16 value = ui->servoMinAngleSlider->value(); m_calibrationUtil->setChannelOutputValue(value); - m_actuatorSettings[getCurrentChannel()].channelMin = value; + + QList currentChannels; + getCurrentChannels(currentChannels); + quint16 currentChannel = currentChannels[0]; + + m_actuatorSettings[currentChannel].channelMin = value; // Adjust neutral and max if (ui->reverseCheckbox->isChecked()) { - if (value <= m_actuatorSettings[getCurrentChannel()].channelNeutral) { + if (value <= m_actuatorSettings[currentChannel].channelNeutral) { ui->servoCenterAngleSlider->setValue(value); } - if (value <= m_actuatorSettings[getCurrentChannel()].channelMax) { + if (value <= m_actuatorSettings[currentChannel].channelMax) { ui->servoMaxAngleSlider->setValue(value); } } else { - if (value >= m_actuatorSettings[getCurrentChannel()].channelNeutral) { + if (value >= m_actuatorSettings[currentChannel].channelNeutral) { ui->servoCenterAngleSlider->setValue(value); } - if (value >= m_actuatorSettings[getCurrentChannel()].channelMax) { + if (value >= m_actuatorSettings[currentChannel].channelMax) { ui->servoMaxAngleSlider->setValue(value); } } @@ -657,21 +695,26 @@ void OutputCalibrationPage::on_servoMaxAngleSlider_valueChanged(int position) Q_UNUSED(position); quint16 value = ui->servoMaxAngleSlider->value(); m_calibrationUtil->setChannelOutputValue(value); - m_actuatorSettings[getCurrentChannel()].channelMax = value; + + QList currentChannels; + getCurrentChannels(currentChannels); + quint16 currentChannel = currentChannels[0]; + + m_actuatorSettings[currentChannel].channelMax = value; // Adjust neutral and min if (ui->reverseCheckbox->isChecked()) { - if (value >= m_actuatorSettings[getCurrentChannel()].channelNeutral) { + if (value >= m_actuatorSettings[currentChannel].channelNeutral) { ui->servoCenterAngleSlider->setValue(value); } - if (value >= m_actuatorSettings[getCurrentChannel()].channelMin) { + if (value >= m_actuatorSettings[currentChannel].channelMin) { ui->servoMinAngleSlider->setValue(value); } } else { - if (value <= m_actuatorSettings[getCurrentChannel()].channelNeutral) { + if (value <= m_actuatorSettings[currentChannel].channelNeutral) { ui->servoCenterAngleSlider->setValue(value); } - if (value <= m_actuatorSettings[getCurrentChannel()].channelMin) { + if (value <= m_actuatorSettings[currentChannel].channelMin) { ui->servoMinAngleSlider->setValue(value); } } @@ -680,14 +723,18 @@ void OutputCalibrationPage::on_servoMaxAngleSlider_valueChanged(int position) void OutputCalibrationPage::on_reverseCheckbox_toggled(bool checked) { - if (checked && m_actuatorSettings[getCurrentChannel()].channelMax > m_actuatorSettings[getCurrentChannel()].channelMin) { - quint16 oldMax = m_actuatorSettings[getCurrentChannel()].channelMax; - m_actuatorSettings[getCurrentChannel()].channelMax = m_actuatorSettings[getCurrentChannel()].channelMin; - m_actuatorSettings[getCurrentChannel()].channelMin = oldMax; - } else if (!checked && m_actuatorSettings[getCurrentChannel()].channelMax < m_actuatorSettings[getCurrentChannel()].channelMin) { - quint16 oldMax = m_actuatorSettings[getCurrentChannel()].channelMax; - m_actuatorSettings[getCurrentChannel()].channelMax = m_actuatorSettings[getCurrentChannel()].channelMin; - m_actuatorSettings[getCurrentChannel()].channelMin = oldMax; + QList currentChannels; + getCurrentChannels(currentChannels); + quint16 currentChannel = currentChannels[0]; + + if (checked && m_actuatorSettings[currentChannel].channelMax > m_actuatorSettings[currentChannel].channelMin) { + quint16 oldMax = m_actuatorSettings[currentChannel].channelMax; + m_actuatorSettings[currentChannel].channelMax = m_actuatorSettings[currentChannel].channelMin; + m_actuatorSettings[currentChannel].channelMin = oldMax; + } else if (!checked && m_actuatorSettings[currentChannel].channelMax < m_actuatorSettings[currentChannel].channelMin) { + quint16 oldMax = m_actuatorSettings[currentChannel].channelMax; + m_actuatorSettings[currentChannel].channelMax = m_actuatorSettings[currentChannel].channelMin; + m_actuatorSettings[currentChannel].channelMin = oldMax; } ui->servoCenterAngleSlider->setInvertedAppearance(checked); ui->servoCenterAngleSlider->setInvertedControls(checked); @@ -697,13 +744,13 @@ void OutputCalibrationPage::on_reverseCheckbox_toggled(bool checked) ui->servoMaxAngleSlider->setInvertedControls(checked); if (ui->reverseCheckbox->isChecked()) { - ui->servoMaxAngleSlider->setValue(m_actuatorSettings[getCurrentChannel()].channelMax); - ui->servoCenterAngleSlider->setValue(m_actuatorSettings[getCurrentChannel()].channelNeutral); - ui->servoMinAngleSlider->setValue(m_actuatorSettings[getCurrentChannel()].channelMin); + ui->servoMaxAngleSlider->setValue(m_actuatorSettings[currentChannel].channelMax); + ui->servoCenterAngleSlider->setValue(m_actuatorSettings[currentChannel].channelNeutral); + ui->servoMinAngleSlider->setValue(m_actuatorSettings[currentChannel].channelMin); } else { - ui->servoMinAngleSlider->setValue(m_actuatorSettings[getCurrentChannel()].channelMin); - ui->servoCenterAngleSlider->setValue(m_actuatorSettings[getCurrentChannel()].channelNeutral); - ui->servoMaxAngleSlider->setValue(m_actuatorSettings[getCurrentChannel()].channelMax); + ui->servoMinAngleSlider->setValue(m_actuatorSettings[currentChannel].channelMin); + ui->servoCenterAngleSlider->setValue(m_actuatorSettings[currentChannel].channelNeutral); + ui->servoMaxAngleSlider->setValue(m_actuatorSettings[currentChannel].channelMax); } } diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h index 53f4ec033..c574b70e8 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h @@ -81,10 +81,11 @@ private: void setWizardPage(); void enableButtons(bool enable); void enableServoSliders(bool enabled); - void onStartButtonToggle(QAbstractButton *button, quint16 channel, quint16 value, quint16 safeValue, QSlider *slider); + void onStartButtonToggle(QAbstractButton *button, QList &channels, + quint16 value, quint16 safeValue, QSlider *slider); bool checkAlarms(); void debugLogChannelValues(); - quint16 getCurrentChannel(); + void getCurrentChannels(QList &channels); void enableAllMotorsCheckBox(bool enable); Ui::OutputCalibrationPage *ui; From 1c4a8612113b198f234fec8ab2c6272dab773793 Mon Sep 17 00:00:00 2001 From: m_thread Date: Sun, 1 Mar 2015 22:49:53 +0100 Subject: [PATCH 15/68] OP-1756 Uncrustify --- .../src/plugins/setupwizard/connectiondiagram.cpp | 2 +- .../setupwizard/pages/outputcalibrationpage.cpp | 10 +++++----- .../plugins/setupwizard/pages/outputcalibrationpage.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/setupwizard/connectiondiagram.cpp b/ground/openpilotgcs/src/plugins/setupwizard/connectiondiagram.cpp index d20c95397..04c240f59 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/connectiondiagram.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/connectiondiagram.cpp @@ -168,7 +168,7 @@ void ConnectionDiagram::setupGraphicsScene() case VehicleConfigurationSource::CONTROLLER_CC3D: prefix = "cc-"; if (m_configSource->getEscType() == VehicleConfigurationSource::ESC_ONESHOT || - m_configSource->getEscType() == VehicleConfigurationSource::ESC_RAPID) { + m_configSource->getEscType() == VehicleConfigurationSource::ESC_RAPID) { suffix = "-oneshot"; } break; diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp index fc7e08655..970231dfc 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp @@ -46,7 +46,7 @@ OutputCalibrationPage::OutputCalibrationPage(SetupWizard *wizard, QWidget *paren connect(ui->calibrateAllMotors, SIGNAL(toggled(bool)), this, SLOT(calibrateAllMotorsChanged())); // move the code that was here to setupVehicle() so we can determine which image to use. - m_vehicleScene = new QGraphicsScene(this); + m_vehicleScene = new QGraphicsScene(this); ui->vehicleView->setScene(m_vehicleScene); } @@ -407,8 +407,8 @@ bool OutputCalibrationPage::validatePage() if (!isFinished()) { m_currentWizardIndex++; if (ui->calibrateAllMotors->isChecked() && - m_currentWizardIndex > 0 && - m_wizardIndexes[m_currentWizardIndex - 1] == 1) { + m_currentWizardIndex > 0 && + m_wizardIndexes[m_currentWizardIndex - 1] == 1) { while (!isFinished() && m_wizardIndexes[m_currentWizardIndex] == 1) { m_currentWizardIndex++; } @@ -465,7 +465,7 @@ void OutputCalibrationPage::customBackClicked() void OutputCalibrationPage::getCurrentChannels(QList &channels) { if (ui->calibrateAllMotors->isChecked()) { - for(int i = 1; i < m_channelIndex.size(); i++) { + for (int i = 1; i < m_channelIndex.size(); i++) { if (m_vehicleElementTypes[i + 1] == MOTOR) { channels << m_channelIndex[i]; } @@ -630,7 +630,7 @@ void OutputCalibrationPage::on_servoButton_toggled(bool checked) void OutputCalibrationPage::on_servoCenterAngleSlider_valueChanged(int position) { Q_UNUSED(position); - quint16 value = ui->servoCenterAngleSlider->value(); + quint16 value = ui->servoCenterAngleSlider->value(); m_calibrationUtil->setChannelOutputValue(value); QList currentChannels; diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h index c574b70e8..dd02fd885 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.h @@ -73,7 +73,7 @@ private slots: void on_calibrateAllMotors_toggled(bool checked); private: - enum ElementType{ FULL, FRAME, MOTOR, SERVO }; + enum ElementType { FULL, FRAME, MOTOR, SERVO }; void setupVehicle(); void startWizard(); void setupVehicleItems(); From 7d62152a98a2102124daa78d89f8b0b9c35fe9a6 Mon Sep 17 00:00:00 2001 From: m_thread Date: Sun, 1 Mar 2015 23:09:56 +0100 Subject: [PATCH 16/68] OP-1756 Removed obsolete concect --- .../src/plugins/setupwizard/pages/outputcalibrationpage.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp index 970231dfc..d39ce03a2 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp @@ -43,8 +43,6 @@ OutputCalibrationPage::OutputCalibrationPage(SetupWizard *wizard, QWidget *paren qDebug() << "calling output calibration page"; m_vehicleRenderer = new QSvgRenderer(); - connect(ui->calibrateAllMotors, SIGNAL(toggled(bool)), this, SLOT(calibrateAllMotorsChanged())); - // move the code that was here to setupVehicle() so we can determine which image to use. m_vehicleScene = new QGraphicsScene(this); ui->vehicleView->setScene(m_vehicleScene); From f3ee2f48459cbbe6453aa071c1b68b595ba016fc Mon Sep 17 00:00:00 2001 From: m_thread Date: Mon, 2 Mar 2015 22:22:41 +0100 Subject: [PATCH 17/68] Fixed layout --- .../src/plugins/config/camerastabilization.ui | 80 +------------------ 1 file changed, 4 insertions(+), 76 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/config/camerastabilization.ui b/ground/openpilotgcs/src/plugins/config/camerastabilization.ui index 168346c81..808bef209 100644 --- a/ground/openpilotgcs/src/plugins/config/camerastabilization.ui +++ b/ground/openpilotgcs/src/plugins/config/camerastabilization.ui @@ -57,7 +57,7 @@ - + 0 0 @@ -72,9 +72,9 @@ 0 - 0 - 750 - 729 + -103 + 748 + 811 @@ -95,24 +95,6 @@ - - - 0 - 0 - - - - - 0 - 0 - - - - - 16777215 - 16777215 - - Module Control @@ -139,24 +121,6 @@ - - - 0 - 0 - - - - - 0 - 110 - - - - - 16777215 - 16777215 - - Basic Settings (Stabilization) @@ -381,24 +345,6 @@ font:bold; - - - 0 - 0 - - - - - 0 - 187 - - - - - 16777215 - 16777215 - - Advanced Settings (Control) @@ -863,12 +809,6 @@ value. - - - 0 - 187 - - Expert Settings (Attitude Filter and Feed Forward) @@ -1324,18 +1264,6 @@ The same value is used for all axes. - - - 0 - 50 - - - - - 16777215 - 16777215 - - Messages From bce05a23124928e7ffb925ad37cd5226bd79b289 Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Mon, 2 Mar 2015 23:32:04 +0100 Subject: [PATCH 18/68] Fixed Stab layout --- .../src/plugins/config/stabilization.ui | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/config/stabilization.ui b/ground/openpilotgcs/src/plugins/config/stabilization.ui index ed649696e..a2a157089 100644 --- a/ground/openpilotgcs/src/plugins/config/stabilization.ui +++ b/ground/openpilotgcs/src/plugins/config/stabilization.ui @@ -136,8 +136,8 @@ 0 0 - 950 - 780 + 939 + 776 @@ -2900,7 +2900,7 @@ border-radius: 5; 16777215 - 160 + 16777215 @@ -5626,7 +5626,7 @@ Then lower the value by 5 or so. 16777215 - 135 + 16777215 @@ -8244,8 +8244,8 @@ border-radius: 5; 0 0 - 950 - 780 + 952 + 763 @@ -18236,8 +18236,8 @@ border-radius: 5; 0 0 - 950 - 780 + 952 + 763 @@ -24082,8 +24082,8 @@ font:bold; 0 0 - 950 - 780 + 952 + 763 From a61891cd2eb291105ab95e8d721ba4eea72a8bea Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Tue, 3 Mar 2015 00:09:50 +0100 Subject: [PATCH 19/68] Fixed Flight Mode layout --- .../openpilotgcs/src/plugins/config/input.ui | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/config/input.ui b/ground/openpilotgcs/src/plugins/config/input.ui index 9a1557eef..322c3efc3 100644 --- a/ground/openpilotgcs/src/plugins/config/input.ui +++ b/ground/openpilotgcs/src/plugins/config/input.ui @@ -17,7 +17,7 @@ - 0 + 1 @@ -116,8 +116,8 @@ 0 0 - 774 - 497 + 1228 + 661 @@ -274,8 +274,7 @@ - - + @@ -491,8 +490,8 @@ 0 0 - 730 - 554 + 1228 + 661 @@ -723,13 +722,13 @@ font:bold; - 106 + 90 0 - 105 + 90 16777215 @@ -1127,13 +1126,13 @@ font:bold; 0 - 230 + 275 16777215 - 230 + 275 @@ -1349,7 +1348,7 @@ font:bold; 16777215 - 150 + 200 @@ -1759,6 +1758,12 @@ font:bold; + + + 16777215 + 29 + + Number of positions your FlightMode switch has. @@ -2214,8 +2219,8 @@ font:bold; 0 0 - 544 - 169 + 1228 + 661 From 6bfe1e66a75b96b589724c789b20cff90975d5a5 Mon Sep 17 00:00:00 2001 From: James Duley Date: Sat, 31 Jan 2015 15:27:37 +1300 Subject: [PATCH 20/68] OP-1695 Ubuntu PPA: actually put debs in PACKAGE_DIR --- package/Linux.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/Linux.mk b/package/Linux.mk index 458b31f77..a6fedb320 100644 --- a/package/Linux.mk +++ b/package/Linux.mk @@ -22,8 +22,8 @@ package: $(V1) cp -rL $(DEB_DIR) $(DEB_BUILD_DIR) $(V1) sed -i -e "$(SED_SCRIPT)" $(DEB_BUILD_DIR)/changelog $(V1) dpkg-buildpackage -b -us -uc - $(V1) mv $(ROOT_DIR)/../$(DEB_PACKAGE_NAME).deb $(BUILD_DIR)/$(DEB_PACKAGE_NAME).deb - $(V1) mv $(ROOT_DIR)/../$(DEB_PACKAGE_NAME).changes $(BUILD_DIR)/$(DEB_PACKAGE_NAME).changes + $(V1) mv $(ROOT_DIR)/../$(DEB_PACKAGE_NAME).deb $(PACKAGE_DIR) + $(V1) mv $(ROOT_DIR)/../$(DEB_PACKAGE_NAME).changes $(PACKAGE_DIR) $(V1) rm -rf $(DEB_BUILD_DIR) ############################## From 5f1f156d1031d7d38718e4181f438328e2dec81a Mon Sep 17 00:00:00 2001 From: James Duley Date: Sat, 31 Jan 2015 15:38:12 +1300 Subject: [PATCH 21/68] OP-1695 Ubuntu PPA: check for fakeroot --- Makefile | 6 ++++-- package/linux/debian/rules | 3 --- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 45d8554ce..281c78dfb 100644 --- a/Makefile +++ b/Makefile @@ -81,8 +81,10 @@ $(foreach var, $(SANITIZE_DEPRECATED_VARS), $(eval $(call SANITIZE_VAR,$(var),de # Make sure this isn't being run as root unless installing (no whoami on Windows, but that is ok here) ifeq ($(shell whoami 2>/dev/null),root) - ifeq ($(filter install all_clean,$(MAKECMDGOALS)),) - $(error You should not be running this as root) + ifeq ($(filter install,$(MAKECMDGOALS)),) + ifndef FAKEROOTKEY + $(error You should not be running this as root) + endif endif endif diff --git a/package/linux/debian/rules b/package/linux/debian/rules index b67ae85e6..266ce3487 100644 --- a/package/linux/debian/rules +++ b/package/linux/debian/rules @@ -18,8 +18,5 @@ override_dh_auto_clean: override_dh_auto_build: #dh_auto_build -- all -override_dh_auto_test: - # Fails non-silently because it is run under fakeroot. - override_dh_auto_install: dh_auto_install -- prefix=/usr From 61395f44fc3dc54a6747f72c208b0630199f0a29 Mon Sep 17 00:00:00 2001 From: James Duley Date: Sat, 31 Jan 2015 16:15:53 +1300 Subject: [PATCH 22/68] OP-1695 Ubuntu PPA: add debian target --- package/Linux.mk | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/package/Linux.mk b/package/Linux.mk index a6fedb320..23edb1ed8 100644 --- a/package/Linux.mk +++ b/package/Linux.mk @@ -7,8 +7,7 @@ ifndef OPENPILOT_IS_COOL endif DEB_VER := $(subst RELEASE-,,$(PACKAGE_LBL))-1 -DEB_DIR := $(ROOT_DIR)/package/linux/debian -DEB_BUILD_DIR := $(ROOT_DIR)/debian +DEB_DIR := package/linux/debian SED_DATE_STRG = $(shell date -R) SED_SCRIPT = s//$(DEB_VER)/;s//$(SED_DATE_STRG)/ @@ -17,14 +16,17 @@ DEB_ARCH := $(shell dpkg --print-architecture) DEB_PACKAGE_NAME := openpilot_$(DEB_VER)_$(DEB_ARCH) .PHONY: package -package: +package: debian $(V1) echo "Building Linux package, please wait..." - $(V1) cp -rL $(DEB_DIR) $(DEB_BUILD_DIR) - $(V1) sed -i -e "$(SED_SCRIPT)" $(DEB_BUILD_DIR)/changelog $(V1) dpkg-buildpackage -b -us -uc $(V1) mv $(ROOT_DIR)/../$(DEB_PACKAGE_NAME).deb $(PACKAGE_DIR) $(V1) mv $(ROOT_DIR)/../$(DEB_PACKAGE_NAME).changes $(PACKAGE_DIR) - $(V1) rm -rf $(DEB_BUILD_DIR) + $(V1) rm -r debian + +debian: $(DEB_DIR) + $(V1) cp -rL $(DEB_DIR) debian + $(V1) sed -i -e "$(SED_SCRIPT)" debian/changelog + ############################## # From 9a1f155510a5d67a42d2f18526b9e9fde4d90ca3 Mon Sep 17 00:00:00 2001 From: James Duley Date: Sun, 1 Feb 2015 08:51:55 +1300 Subject: [PATCH 23/68] OP-1695 Ubuntu PPA: made OP modifications in package rule rather than hardcoded to debian rules file --- package/Linux.mk | 4 +++- package/linux/debian/rules | 6 +----- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/package/Linux.mk b/package/Linux.mk index 23edb1ed8..02aa5b34e 100644 --- a/package/Linux.mk +++ b/package/Linux.mk @@ -17,7 +17,9 @@ DEB_PACKAGE_NAME := openpilot_$(DEB_VER)_$(DEB_ARCH) .PHONY: package package: debian - $(V1) echo "Building Linux package, please wait..." + @$(ECHO) "Building Linux package, please wait..." + # Override clean and build because OP has already performed them. + $(V1) printf "override_dh_auto_clean:\noverride_dh_auto_build:\n\t#\n" >> debian/rules $(V1) dpkg-buildpackage -b -us -uc $(V1) mv $(ROOT_DIR)/../$(DEB_PACKAGE_NAME).deb $(PACKAGE_DIR) $(V1) mv $(ROOT_DIR)/../$(DEB_PACKAGE_NAME).changes $(PACKAGE_DIR) diff --git a/package/linux/debian/rules b/package/linux/debian/rules index 266ce3487..1c0a922f0 100644 --- a/package/linux/debian/rules +++ b/package/linux/debian/rules @@ -11,12 +11,8 @@ export DH_OPTIONS %: dh $@ -# Disabled because OpenPilot makefile cleans and builds. -override_dh_auto_clean: - # - override_dh_auto_build: - #dh_auto_build -- all + dh_auto_build -- all override_dh_auto_install: dh_auto_install -- prefix=/usr From 2431aa8baa53d967f2cb22d622bd741ba60cb9a7 Mon Sep 17 00:00:00 2001 From: James Duley Date: Tue, 10 Feb 2015 18:37:35 +1300 Subject: [PATCH 24/68] OP-1695 Ubuntu PPA: made dist make target use PACKAE_FULL_NAME --- Makefile | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 281c78dfb..78d4957dd 100644 --- a/Makefile +++ b/Makefile @@ -787,9 +787,13 @@ endif # - calls paltform-specific packaging script # Define some variables -export PACKAGE_LBL := $(shell $(VERSION_INFO) --format=\$${LABEL}) -export PACKAGE_NAME := OpenPilot -export PACKAGE_SEP := - +PACKAGE_LBL := $(shell $(VERSION_INFO) --format=\$${LABEL}) +PACKAGE_NAME := OpenPilot +PACKAGE_SEP := - +PACKAGE_FULL_NAME := $(PACKAGE_NAME)$(PACKAGE_SEP)$(PACKAGE_LBL) + +# Source distribution is never dirty because it uses git archive +DIST_NAME := $(DIST_DIR)/$(subst dirty-,,$(PACKAGE_FULL_NAME)).tar .PHONY: package @@ -890,8 +894,7 @@ $(DIST_VER_INFO): $(DIST_DIR) .PHONY: dist dist: $(DIST_DIR) $(DIST_VER_INFO) - @$(ECHO) " SOURCE FOR DISTRIBUTION $(call toprel, $(DIST_DIR))" - $(eval DIST_NAME := $(call toprel, "$(DIST_DIR)/OpenPilot-$(shell git describe).tar")) + @$(ECHO) " SOURCE FOR DISTRIBUTION $(call toprel, $(DIST_NAME).gz)" $(V1) git archive --prefix="OpenPilot/" -o "$(DIST_NAME)" HEAD $(V1) tar --append --file="$(DIST_NAME)" \ --transform='s,.*version-info.json,OpenPilot/version-info.json,' \ From 86dfdb77634d9a173ba98d9b309faf8032ae504b Mon Sep 17 00:00:00 2001 From: James Duley Date: Tue, 10 Feb 2015 18:47:35 +1300 Subject: [PATCH 25/68] OP-1695 Ubuntu PPA: made .gz a make target --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 78d4957dd..f36255a41 100644 --- a/Makefile +++ b/Makefile @@ -892,8 +892,8 @@ DIST_VER_INFO := $(DIST_DIR)/version-info.json $(DIST_VER_INFO): $(DIST_DIR) $(V1) $(VERSION_INFO) --jsonpath="$(DIST_DIR)" -.PHONY: dist -dist: $(DIST_DIR) $(DIST_VER_INFO) + +$(DIST_NAME).gz: $(DIST_DIR) $(DIST_VER_INFO) @$(ECHO) " SOURCE FOR DISTRIBUTION $(call toprel, $(DIST_NAME).gz)" $(V1) git archive --prefix="OpenPilot/" -o "$(DIST_NAME)" HEAD $(V1) tar --append --file="$(DIST_NAME)" \ @@ -901,6 +901,8 @@ dist: $(DIST_DIR) $(DIST_VER_INFO) $(call toprel, "$(DIST_VER_INFO)") $(V1) gzip -f "$(DIST_NAME)" +.PHONY: dist +dist: $(DIST_NAME).gz ############################## # From d887e7e5ba729db1d3d08dd6edde8d78ca82a323 Mon Sep 17 00:00:00 2001 From: James Duley Date: Tue, 10 Feb 2015 18:52:01 +1300 Subject: [PATCH 26/68] OP-1695 Ubuntu PPA: made PACKAGE_DIR and DIST_DIR order only make dependcies --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index f36255a41..ff5097291 100644 --- a/Makefile +++ b/Makefile @@ -799,7 +799,7 @@ DIST_NAME := $(DIST_DIR)/$(subst dirty-,,$(PACKAGE_FULL_NAME)).tar include $(ROOT_DIR)/package/$(UNAME).mk -package: all_fw all_ground uavobjects_matlab $(PACKAGE_DIR) +package: all_fw all_ground uavobjects_matlab | $(PACKAGE_DIR) ifneq ($(GCS_BUILD_CONF),release) # We can only package release builds $(error Packaging is currently supported for release builds only) @@ -889,11 +889,11 @@ build-info: DIST_VER_INFO := $(DIST_DIR)/version-info.json .PHONY: $(DIST_VER_INFO) # Because to many deps to list -$(DIST_VER_INFO): $(DIST_DIR) +$(DIST_VER_INFO): | $(DIST_DIR) $(V1) $(VERSION_INFO) --jsonpath="$(DIST_DIR)" -$(DIST_NAME).gz: $(DIST_DIR) $(DIST_VER_INFO) +$(DIST_NAME).gz: $(DIST_VER_INFO) | $(DIST_DIR) @$(ECHO) " SOURCE FOR DISTRIBUTION $(call toprel, $(DIST_NAME).gz)" $(V1) git archive --prefix="OpenPilot/" -o "$(DIST_NAME)" HEAD $(V1) tar --append --file="$(DIST_NAME)" \ From 4410f955c16e40f758c90c0e2d95b26eacd101cc Mon Sep 17 00:00:00 2001 From: James Duley Date: Wed, 11 Feb 2015 17:04:42 +1300 Subject: [PATCH 27/68] OP-1695 Ubuntu PPA: made debian/rules executable --- package/linux/debian/rules | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 package/linux/debian/rules diff --git a/package/linux/debian/rules b/package/linux/debian/rules old mode 100644 new mode 100755 From 53e4be9bdb9f5b889c0cca69955835bf4612c269 Mon Sep 17 00:00:00 2001 From: James Duley Date: Wed, 11 Feb 2015 17:19:26 +1300 Subject: [PATCH 28/68] OP-1695 Ubuntu PPA: added correct debian/control/format --- package/linux/debian/source/format | 1 + 1 file changed, 1 insertion(+) create mode 100644 package/linux/debian/source/format diff --git a/package/linux/debian/source/format b/package/linux/debian/source/format new file mode 100644 index 000000000..163aaf8d8 --- /dev/null +++ b/package/linux/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) From 843325d44e3812e93a103893369cafaad905c490 Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Tue, 3 Mar 2015 00:40:50 +0100 Subject: [PATCH 29/68] GUI input / helicopter tab : Define first tab as default --- ground/openpilotgcs/src/plugins/config/airframe_ccpm.ui | 2 +- ground/openpilotgcs/src/plugins/config/input.ui | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/config/airframe_ccpm.ui b/ground/openpilotgcs/src/plugins/config/airframe_ccpm.ui index 87503edc9..8b7e8bfe7 100644 --- a/ground/openpilotgcs/src/plugins/config/airframe_ccpm.ui +++ b/ground/openpilotgcs/src/plugins/config/airframe_ccpm.ui @@ -116,7 +116,7 @@ QGroupBox::title { QTabWidget::Rounded - 1 + 0 false diff --git a/ground/openpilotgcs/src/plugins/config/input.ui b/ground/openpilotgcs/src/plugins/config/input.ui index 322c3efc3..9c33b6cdd 100644 --- a/ground/openpilotgcs/src/plugins/config/input.ui +++ b/ground/openpilotgcs/src/plugins/config/input.ui @@ -17,7 +17,7 @@ - 1 + 0 From 716358f7ba43519cf33f845cb8bcf9f1055d452a Mon Sep 17 00:00:00 2001 From: James Duley Date: Wed, 11 Feb 2015 17:51:53 +1300 Subject: [PATCH 30/68] OP-1695 Ubuntu PPA: added package_src make target --- Makefile | 4 ++-- package/Linux.mk | 29 +++++++++++++++++++++++------ 2 files changed, 25 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index ff5097291..db5360d59 100644 --- a/Makefile +++ b/Makefile @@ -895,9 +895,9 @@ $(DIST_VER_INFO): | $(DIST_DIR) $(DIST_NAME).gz: $(DIST_VER_INFO) | $(DIST_DIR) @$(ECHO) " SOURCE FOR DISTRIBUTION $(call toprel, $(DIST_NAME).gz)" - $(V1) git archive --prefix="OpenPilot/" -o "$(DIST_NAME)" HEAD + $(V1) git archive --prefix="$(PACKAGE_NAME)/" -o "$(DIST_NAME)" HEAD $(V1) tar --append --file="$(DIST_NAME)" \ - --transform='s,.*version-info.json,OpenPilot/version-info.json,' \ + --transform='s,.*version-info.json,$(PACKAGE_NAME)/version-info.json,' \ $(call toprel, "$(DIST_VER_INFO)") $(V1) gzip -f "$(DIST_NAME)" diff --git a/package/Linux.mk b/package/Linux.mk index 02aa5b34e..85fa8276c 100644 --- a/package/Linux.mk +++ b/package/Linux.mk @@ -6,14 +6,19 @@ ifndef OPENPILOT_IS_COOL $(error Top level Makefile must be used to build this target) endif -DEB_VER := $(subst RELEASE-,,$(PACKAGE_LBL))-1 -DEB_DIR := package/linux/debian +# Instead of RELEASE-15.01-RC1 debian wants 15.01~RC1 +UPSTREAM_VER := $(subst -,~,$(subst RELEASE-,,$(PACKAGE_LBL))) +DEB_REV := 1 +DEB_NAME := openpilot +DEB_ORIG_SRC := $(PACKAGE_DIR)/$(DEB_NAME)_$(UPSTREAM_VER).orig.tar.gz +DEB_PACKAGE_DIR := $(PACKAGE_DIR)/$(DEB_NAME)-$(UPSTREAM_VER) +DEB_ARCH := $(shell dpkg --print-architecture) +DEB_PACKAGE_NAME := $(DEB_NAME)_$(UPSTREAM_VER)-$(DEB_REV)_$(DEB_ARCH) +DEB_DIR := package/linux/debian -SED_DATE_STRG = $(shell date -R) -SED_SCRIPT = s//$(DEB_VER)/;s//$(SED_DATE_STRG)/ +SED_DATE_STRG = $(shell date -R) +SED_SCRIPT = s//$(UPSTREAM_VER)-$(DEB_REV)/;s//$(SED_DATE_STRG)/ -DEB_ARCH := $(shell dpkg --print-architecture) -DEB_PACKAGE_NAME := openpilot_$(DEB_VER)_$(DEB_ARCH) .PHONY: package package: debian @@ -26,9 +31,21 @@ package: debian $(V1) rm -r debian debian: $(DEB_DIR) + $(V1) rm -rf debian $(V1) cp -rL $(DEB_DIR) debian $(V1) sed -i -e "$(SED_SCRIPT)" debian/changelog +.PHONY: package_src +package_src: $(DEB_ORIG_SRC_NAME) $(DEB_PACKAGE_DIR) + $(V1) cd $(DEB_PACKAGE_DIR) && dpkg-buildpackage -S -us -uc + +$(DEB_ORIG_SRC): $(DIST_NAME).gz | $(PACKAGE_DIR) + $(V1) cp $(DIST_NAME).gz $(DEB_ORIG_SRC) + +$(DEB_PACKAGE_DIR): $(DEB_ORIG_SRC) debian | $(PACKAGE_DIR) + $(V1) tar -xf $(DEB_ORIG_SRC) -C $(PACKAGE_DIR) + $(V1) mv debian $(PACKAGE_DIR)/$(PACKAGE_NAME) + $(V1) rm -rf $(DEB_PACKAGE_DIR) && mv $(PACKAGE_DIR)/$(PACKAGE_NAME) $(DEB_PACKAGE_DIR) ############################## # From f6112792910f5d1f07449c6ba6b34134379eada9 Mon Sep 17 00:00:00 2001 From: James Duley Date: Wed, 11 Feb 2015 20:53:50 +1300 Subject: [PATCH 31/68] OP-1695 Ubuntu PPA: update standards version and deb builder version --- package/linux/debian/control | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package/linux/debian/control b/package/linux/debian/control index 3ac0c681a..96ae8a0de 100644 --- a/package/linux/debian/control +++ b/package/linux/debian/control @@ -2,8 +2,8 @@ Source: openpilot Section: unknown Priority: optional Maintainer: James Duley -Build-Depends: debhelper (>= 8.0.0) -Standards-Version: 3.9.4 +Build-Depends: debhelper (>= 9) +Standards-Version: 3.9.5 Homepage: http://www.openpilot.org Vcs-Git: git://git.openpilot.org/OpenPilot.git Vcs-Browser: http://git.openpilot.org/changelog/OpenPilot From 51e4f3aa0eb889bdb1fd8353eef805c41223ef1a Mon Sep 17 00:00:00 2001 From: James Duley Date: Wed, 11 Feb 2015 20:44:24 +1300 Subject: [PATCH 32/68] OP-1695 Ubuntu PPA: add missing build depends --- package/linux/debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/linux/debian/control b/package/linux/debian/control index 96ae8a0de..94cdf8fb2 100644 --- a/package/linux/debian/control +++ b/package/linux/debian/control @@ -2,7 +2,7 @@ Source: openpilot Section: unknown Priority: optional Maintainer: James Duley -Build-Depends: debhelper (>= 9) +Build-Depends: debhelper (>= 9), libudev-dev, libusb-1.0-0-dev, libsdl1.2-dev, python, gcc-arm-none-eabi (>=4.9), qt5-default, qttools5-dev-tools, libqt5svg5-dev, qtdeclarative5-dev, qtdeclarative5-controls-plugin, libqt5serialport5-dev, qtmultimedia5-dev, qtscript5-dev, libqt5opengl5-dev Standards-Version: 3.9.5 Homepage: http://www.openpilot.org Vcs-Git: git://git.openpilot.org/OpenPilot.git From c0c2e0b721a52a7e54cb3db8dfaf8b779b6d771c Mon Sep 17 00:00:00 2001 From: James Duley Date: Mon, 16 Feb 2015 16:57:57 +1300 Subject: [PATCH 33/68] OP-1695 Ubuntu PPA: made dist targets depend on .git/index instead of being PHONY --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index db5360d59..19e2f55b7 100644 --- a/Makefile +++ b/Makefile @@ -887,13 +887,13 @@ build-info: ############################## DIST_VER_INFO := $(DIST_DIR)/version-info.json +MODIFIED_FILES := $(shell git ls-files -m) -.PHONY: $(DIST_VER_INFO) # Because to many deps to list -$(DIST_VER_INFO): | $(DIST_DIR) +$(DIST_VER_INFO): .git/index $(MODIFIED_FILES) | $(DIST_DIR) $(V1) $(VERSION_INFO) --jsonpath="$(DIST_DIR)" -$(DIST_NAME).gz: $(DIST_VER_INFO) | $(DIST_DIR) +$(DIST_NAME).gz: $(DIST_VER_INFO) .git/index | $(DIST_DIR) @$(ECHO) " SOURCE FOR DISTRIBUTION $(call toprel, $(DIST_NAME).gz)" $(V1) git archive --prefix="$(PACKAGE_NAME)/" -o "$(DIST_NAME)" HEAD $(V1) tar --append --file="$(DIST_NAME)" \ From c23f7ec94c14fb7d6e123f6159437d27043d1517 Mon Sep 17 00:00:00 2001 From: James Duley Date: Mon, 16 Feb 2015 19:00:24 +1300 Subject: [PATCH 34/68] OP-1695 Ubuntu PPA: add option to set debian distribution --- package/Linux.mk | 3 ++- package/linux/debian/changelog | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/package/Linux.mk b/package/Linux.mk index 85fa8276c..19972b3bf 100644 --- a/package/Linux.mk +++ b/package/Linux.mk @@ -6,6 +6,7 @@ ifndef OPENPILOT_IS_COOL $(error Top level Makefile must be used to build this target) endif +DEB_DIST := unstable # Instead of RELEASE-15.01-RC1 debian wants 15.01~RC1 UPSTREAM_VER := $(subst -,~,$(subst RELEASE-,,$(PACKAGE_LBL))) DEB_REV := 1 @@ -17,7 +18,7 @@ DEB_PACKAGE_NAME := $(DEB_NAME)_$(UPSTREAM_VER)-$(DEB_REV)_$(DEB_ARCH) DEB_DIR := package/linux/debian SED_DATE_STRG = $(shell date -R) -SED_SCRIPT = s//$(UPSTREAM_VER)-$(DEB_REV)/;s//$(SED_DATE_STRG)/ +SED_SCRIPT = s//$(UPSTREAM_VER)-$(DEB_REV)/;s//$(SED_DATE_STRG)/;s//$(DEB_DIST)/ .PHONY: package diff --git a/package/linux/debian/changelog b/package/linux/debian/changelog index 9c205bb68..fe2d82497 100644 --- a/package/linux/debian/changelog +++ b/package/linux/debian/changelog @@ -1,4 +1,4 @@ -openpilot () unstable; urgency=low +openpilot () ; urgency=low * Release from upstream Git (testing - unstable) From 2eb5fbee8a3158bd382e10a6dd1a348d0ba41a48 Mon Sep 17 00:00:00 2001 From: James Duley Date: Mon, 16 Feb 2015 19:14:31 +1300 Subject: [PATCH 35/68] OP-1695 Ubuntu PPA: set debian section to electronics --- package/linux/debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/linux/debian/control b/package/linux/debian/control index 94cdf8fb2..5bbc7df2b 100644 --- a/package/linux/debian/control +++ b/package/linux/debian/control @@ -1,5 +1,5 @@ Source: openpilot -Section: unknown +Section: electronics Priority: optional Maintainer: James Duley Build-Depends: debhelper (>= 9), libudev-dev, libusb-1.0-0-dev, libsdl1.2-dev, python, gcc-arm-none-eabi (>=4.9), qt5-default, qttools5-dev-tools, libqt5svg5-dev, qtdeclarative5-dev, qtdeclarative5-controls-plugin, libqt5serialport5-dev, qtmultimedia5-dev, qtscript5-dev, libqt5opengl5-dev From 2efa05c17aa7feede03dde6e0eeb7469622b5579 Mon Sep 17 00:00:00 2001 From: James Duley Date: Thu, 19 Feb 2015 12:06:07 +1300 Subject: [PATCH 36/68] OP-1695 Ubuntu PPA: added runtime depends --- package/linux/debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/linux/debian/control b/package/linux/debian/control index 5bbc7df2b..0734154a6 100644 --- a/package/linux/debian/control +++ b/package/linux/debian/control @@ -10,6 +10,6 @@ Vcs-Browser: http://git.openpilot.org/changelog/OpenPilot Package: openpilot Architecture: any -Depends: ${shlibs:Depends}, ${misc:Depends} +Depends: ${shlibs:Depends}, ${misc:Depends}, qml-module-qtquick-controls, qml-module-qtquick-dialogs, qml-module-qtquick-xmllistmodel, qml-module-qtquick-localstorage, qml-module-qtquick-particles2, qml-module-qtquick-window2, qml-module-qtquick2 Description: OpenPilot GCS OpenPilot Ground Control Station software From f59512cdc142e35cdf0a5ac2ec94e7e8062d83c2 Mon Sep 17 00:00:00 2001 From: James Duley Date: Thu, 19 Feb 2015 12:40:20 +1300 Subject: [PATCH 37/68] OP-1695 Ubuntu PPA: added trusty depends workaround --- package/Linux.mk | 11 +++++++++++ package/linux/debian/control | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/package/Linux.mk b/package/Linux.mk index 19972b3bf..76657eca4 100644 --- a/package/Linux.mk +++ b/package/Linux.mk @@ -20,6 +20,14 @@ DEB_DIR := package/linux/debian SED_DATE_STRG = $(shell date -R) SED_SCRIPT = s//$(UPSTREAM_VER)-$(DEB_REV)/;s//$(SED_DATE_STRG)/;s//$(DEB_DIST)/ +# Ubuntu 14.04 (Trusty Tahr) has different names for the qml-modules +TRUSTY_DEPS_SED := s/qml-module-qtquick-controls/qtdeclarative5-controls-plugin/g; \ + s/qml-module-qtquick-dialogs/qtdeclarative5-dialogs-plugin/g; \ + s/qml-module-qtquick-localstorage/qtdeclarative5-localstorage-plugin/g; \ + s/qml-module-qtquick-particles2/qtdeclarative5-particles-plugin/g; \ + s/qml-module-qtquick2/qtdeclarative5-qtquick2-plugin/g; \ + s/qml-module-qtquick-window2/qtdeclarative5-window-plugin/g; \ + s/qml-module-qtquick-xmllistmodel/qtdeclarative5-xmllistmodel-plugin/g; .PHONY: package package: debian @@ -35,6 +43,9 @@ debian: $(DEB_DIR) $(V1) rm -rf debian $(V1) cp -rL $(DEB_DIR) debian $(V1) sed -i -e "$(SED_SCRIPT)" debian/changelog +ifeq ($(DEB_DIST), trusty) + $(V1) sed -i -e "$(TRUSTY_DEPS_SED)" debian/control +endif .PHONY: package_src package_src: $(DEB_ORIG_SRC_NAME) $(DEB_PACKAGE_DIR) diff --git a/package/linux/debian/control b/package/linux/debian/control index 0734154a6..db02e54a7 100644 --- a/package/linux/debian/control +++ b/package/linux/debian/control @@ -2,7 +2,7 @@ Source: openpilot Section: electronics Priority: optional Maintainer: James Duley -Build-Depends: debhelper (>= 9), libudev-dev, libusb-1.0-0-dev, libsdl1.2-dev, python, gcc-arm-none-eabi (>=4.9), qt5-default, qttools5-dev-tools, libqt5svg5-dev, qtdeclarative5-dev, qtdeclarative5-controls-plugin, libqt5serialport5-dev, qtmultimedia5-dev, qtscript5-dev, libqt5opengl5-dev +Build-Depends: debhelper (>= 9), libudev-dev, libusb-1.0-0-dev, libsdl1.2-dev, python, gcc-arm-none-eabi (>=4.9), qt5-default, qttools5-dev-tools, libqt5svg5-dev, qtdeclarative5-dev, qml-module-qtquick-controls, libqt5serialport5-dev, qtmultimedia5-dev, qtscript5-dev, libqt5opengl5-dev Standards-Version: 3.9.5 Homepage: http://www.openpilot.org Vcs-Git: git://git.openpilot.org/OpenPilot.git From 089940387738838190e20e9de8361c386e352501 Mon Sep 17 00:00:00 2001 From: James Duley Date: Thu, 19 Feb 2015 13:46:29 +1300 Subject: [PATCH 38/68] OP-1695 Ubuntu PPA: added workaround for when calling standard package rule --- package/Linux.mk | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/package/Linux.mk b/package/Linux.mk index 76657eca4..4dfb09af2 100644 --- a/package/Linux.mk +++ b/package/Linux.mk @@ -29,11 +29,16 @@ TRUSTY_DEPS_SED := s/qml-module-qtquick-controls/qtdeclarative5-controls-pl s/qml-module-qtquick-window2/qtdeclarative5-window-plugin/g; \ s/qml-module-qtquick-xmllistmodel/qtdeclarative5-xmllistmodel-plugin/g; +# Leave off Qt and ARM compiler dependencies if calling package target under the assumption that +# OP is providing them or the user already has them installed because OP is already built. +PACKAGE_DEPS_SED := s/python.*/python/;s/{misc:Depends}.*/{misc:Depends}/; + .PHONY: package package: debian @$(ECHO) "Building Linux package, please wait..." # Override clean and build because OP has already performed them. $(V1) printf "override_dh_auto_clean:\noverride_dh_auto_build:\n\t#\n" >> debian/rules + $(V1) sed -i -e "$(PACKAGE_DEPS_SED)" debian/control $(V1) dpkg-buildpackage -b -us -uc $(V1) mv $(ROOT_DIR)/../$(DEB_PACKAGE_NAME).deb $(PACKAGE_DIR) $(V1) mv $(ROOT_DIR)/../$(DEB_PACKAGE_NAME).changes $(PACKAGE_DIR) From afe0949f00619a1acf2ef76ce3d3e7b49e1f00dd Mon Sep 17 00:00:00 2001 From: James Duley Date: Thu, 19 Feb 2015 13:51:58 +1300 Subject: [PATCH 39/68] OP-1695 Ubuntu PPA: added check for debian distro --- package/Linux.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package/Linux.mk b/package/Linux.mk index 4dfb09af2..36fb360cd 100644 --- a/package/Linux.mk +++ b/package/Linux.mk @@ -6,6 +6,9 @@ ifndef OPENPILOT_IS_COOL $(error Top level Makefile must be used to build this target) endif +# Are we using a debian based distro? +ifneq ($(shell which dpkg),) + DEB_DIST := unstable # Instead of RELEASE-15.01-RC1 debian wants 15.01~RC1 UPSTREAM_VER := $(subst -,~,$(subst RELEASE-,,$(PACKAGE_LBL))) @@ -64,6 +67,7 @@ $(DEB_PACKAGE_DIR): $(DEB_ORIG_SRC) debian | $(PACKAGE_DIR) $(V1) mv debian $(PACKAGE_DIR)/$(PACKAGE_NAME) $(V1) rm -rf $(DEB_PACKAGE_DIR) && mv $(PACKAGE_DIR)/$(PACKAGE_NAME) $(DEB_PACKAGE_DIR) +endif # Debian based distro? ############################## # # Install OpenPilot From 0b20faf6a3b1591285c55f4181bb326d54fab7df Mon Sep 17 00:00:00 2001 From: James Duley Date: Thu, 19 Feb 2015 15:26:39 +1300 Subject: [PATCH 40/68] OP-1695 Ubuntu PPA: added trusty suffix to DEB_REV if trusty --- package/Linux.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/package/Linux.mk b/package/Linux.mk index 36fb360cd..9bb088239 100644 --- a/package/Linux.mk +++ b/package/Linux.mk @@ -13,6 +13,9 @@ DEB_DIST := unstable # Instead of RELEASE-15.01-RC1 debian wants 15.01~RC1 UPSTREAM_VER := $(subst -,~,$(subst RELEASE-,,$(PACKAGE_LBL))) DEB_REV := 1 +ifeq ($(DEB_DIST), trusty) +DEB_REV := $(DEB_REV)$(DEB_DIST)1 +endif DEB_NAME := openpilot DEB_ORIG_SRC := $(PACKAGE_DIR)/$(DEB_NAME)_$(UPSTREAM_VER).orig.tar.gz DEB_PACKAGE_DIR := $(PACKAGE_DIR)/$(DEB_NAME)-$(UPSTREAM_VER) @@ -47,6 +50,7 @@ package: debian $(V1) mv $(ROOT_DIR)/../$(DEB_PACKAGE_NAME).changes $(PACKAGE_DIR) $(V1) rm -r debian +.PHONY: debian debian: $(DEB_DIR) $(V1) rm -rf debian $(V1) cp -rL $(DEB_DIR) debian From 54df9d1ea09c4c411fb741ffe22bf4f34e0dac6f Mon Sep 17 00:00:00 2001 From: James Duley Date: Tue, 3 Mar 2015 14:25:41 +1300 Subject: [PATCH 41/68] firmware-defs.mk: added '+' to replace_special_characters --- make/firmware-defs.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make/firmware-defs.mk b/make/firmware-defs.mk index 7bbe20c9b..5f1ed36ee 100644 --- a/make/firmware-defs.mk +++ b/make/firmware-defs.mk @@ -72,7 +72,7 @@ MSG_FLASH_IMG = $(QUOTE) FLASH_IMG $(MSG_EXTRA) $(QUOTE) toprel = $(subst $(realpath $(ROOT_DIR))/,,$(abspath $(1))) # Function to replace special characters like is done for the symbols. -replace_special_chars = $(subst ~,_,$(subst @,_,$(subst :,_,$(subst -,_,$(subst .,_,$(subst /,_,$1)))))) +replace_special_chars = $(subst +,_,$(subst ~,_,$(subst @,_,$(subst :,_,$(subst -,_,$(subst .,_,$(subst /,_,$1))))))) # Display compiler version information. .PHONY: gccversion From 655e9075067c30a75de132ac8447888846ddf95f Mon Sep 17 00:00:00 2001 From: James Duley Date: Tue, 3 Mar 2015 17:51:43 +1300 Subject: [PATCH 42/68] OP-1695 Ubuntu PPA: remove dirty from version-info.json --- Makefile | 3 +-- make/scripts/version-info.py | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 19e2f55b7..f18e3efbd 100644 --- a/Makefile +++ b/Makefile @@ -887,9 +887,8 @@ build-info: ############################## DIST_VER_INFO := $(DIST_DIR)/version-info.json -MODIFIED_FILES := $(shell git ls-files -m) -$(DIST_VER_INFO): .git/index $(MODIFIED_FILES) | $(DIST_DIR) +$(DIST_VER_INFO): .git/index | $(DIST_DIR) $(V1) $(VERSION_INFO) --jsonpath="$(DIST_DIR)" diff --git a/make/scripts/version-info.py b/make/scripts/version-info.py index 82ebb48d8..38b8401db 100644 --- a/make/scripts/version-info.py +++ b/make/scripts/version-info.py @@ -228,7 +228,8 @@ class Repo: json_data['last_tag'] = self._last_tag json_data['num_commits_past_tag'] = self._num_commits_past_tag json_data['branch'] = self._branch - json_data['dirty'] = self._dirty + # version-info.json is for use with git archive which doesn't take in dirty changes + json_data['dirty'] = False json_path = os.path.join(path, 'version-info.json') with open(json_path, 'w') as json_file: From b1adc38f0585c45925157e9a9534b4dfd14bc934 Mon Sep 17 00:00:00 2001 From: James Duley Date: Tue, 3 Mar 2015 18:19:42 +1300 Subject: [PATCH 43/68] OP-1695 Ubuntu PPA: suppress 'which' stderr --- package/Linux.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/Linux.mk b/package/Linux.mk index 9bb088239..456173131 100644 --- a/package/Linux.mk +++ b/package/Linux.mk @@ -7,7 +7,7 @@ ifndef OPENPILOT_IS_COOL endif # Are we using a debian based distro? -ifneq ($(shell which dpkg),) +ifneq ($(shell which dpkg 2> /dev/null),) DEB_DIST := unstable # Instead of RELEASE-15.01-RC1 debian wants 15.01~RC1 From b0a7a19a94a5e1dce142c8f8ea1622120e9129c7 Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Sat, 7 Mar 2015 12:52:06 +0100 Subject: [PATCH 44/68] Uncrustify --- .../src/plugins/setupwizard/pages/outputcalibrationpage.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp index ebafdea31..099316633 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/outputcalibrationpage.cpp @@ -44,7 +44,7 @@ OutputCalibrationPage::OutputCalibrationPage(SetupWizard *wizard, QWidget *paren m_vehicleRenderer = new QSvgRenderer(); // move the code that was here to setupVehicle() so we can determine which image to use. - m_vehicleScene = new QGraphicsScene(this); + m_vehicleScene = new QGraphicsScene(this); ui->vehicleView->setScene(m_vehicleScene); } From 4b640c5d1dc969624429182da0c3d724a02a3e3e Mon Sep 17 00:00:00 2001 From: Laurent Lalanne Date: Sun, 8 Mar 2015 02:20:57 +0100 Subject: [PATCH 45/68] OP-1764 Add Throttle range check --- .../src/plugins/config/configinputwidget.cpp | 28 +++++++++++++++---- .../src/plugins/config/configinputwidget.h | 2 ++ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp b/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp index 52d2f598e..e21cebbbe 100644 --- a/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp +++ b/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp @@ -549,6 +549,8 @@ void ConfigInputWidget::wzNext() // Force flight mode neutral to middle and Throttle neutral at 4% adjustSpecialNeutrals(); + throttleError = false; + checkThrottleRange(); manualSettingsObj->setData(manualSettingsData); // move to Arming Settings tab @@ -1593,6 +1595,7 @@ void ConfigInputWidget::simpleCalibration(bool enable) ui->saveRCInputToRAM->setEnabled(false); ui->saveRCInputToSD->setEnabled(false); ui->runCalibration->setText(tr("Stop Manual Calibration")); + throttleError = false; QMessageBox msgBox; msgBox.setText(tr("

Arming Settings are now set to 'Always Disarmed' for your safety.

" @@ -1628,11 +1631,6 @@ void ConfigInputWidget::simpleCalibration(bool enable) connect(manualCommandObj, SIGNAL(objectUnpacked(UAVObject *)), this, SLOT(updateCalibration())); } else { - ui->configurationWizard->setEnabled(true); - ui->saveRCInputToRAM->setEnabled(true); - ui->saveRCInputToSD->setEnabled(true); - ui->runCalibration->setText(tr("Start Manual Calibration")); - manualCommandData = manualCommandObj->getData(); manualSettingsData = manualSettingsObj->getData(); @@ -1641,16 +1639,21 @@ void ConfigInputWidget::simpleCalibration(bool enable) for (unsigned int i = 0; i < ManualControlCommand::CHANNEL_NUMELEM; i++) { if ((i == ManualControlSettings::CHANNELNUMBER_FLIGHTMODE) || (i == ManualControlSettings::CHANNELNUMBER_THROTTLE)) { adjustSpecialNeutrals(); + checkThrottleRange(); } else { manualSettingsData.ChannelNeutral[i] = manualCommandData.Channel[i]; } } - manualSettingsObj->setData(manualSettingsData); // Load actuator settings back from beginning of manual calibration actuatorSettingsObj->setData(previousActuatorSettingsData); + ui->configurationWizard->setEnabled(true); + ui->saveRCInputToRAM->setEnabled(true); + ui->saveRCInputToSD->setEnabled(true); + ui->runCalibration->setText(tr("Start Manual Calibration")); + disconnect(manualCommandObj, SIGNAL(objectUnpacked(UAVObject *)), this, SLOT(updateCalibration())); } } @@ -1671,6 +1674,19 @@ void ConfigInputWidget::adjustSpecialNeutrals() manualSettingsData.ChannelMin[ManualControlSettings::CHANNELMIN_THROTTLE]) * 0.04); } +void ConfigInputWidget::checkThrottleRange() +{ + if ((abs(manualSettingsData.ChannelMax[ManualControlSettings::CHANNELMAX_THROTTLE] - + manualSettingsData.ChannelMin[ManualControlSettings::CHANNELMIN_THROTTLE]) < 300) && (throttleError == false)) { + throttleError = true; + QMessageBox::warning(this, tr("Warning"), tr("

There is something wrong with Throttle range. Please redo calibration and move ALL sticks, Throttle stick included.

"), QMessageBox::Ok); + + // Set Throttle neutral to max value so Throttle can't be positive + manualSettingsData.ChannelNeutral[ManualControlSettings::CHANNELNEUTRAL_THROTTLE] = + manualSettingsData.ChannelMax[ManualControlSettings::CHANNELMAX_THROTTLE]; + } +} + bool ConfigInputWidget::shouldObjectBeSaved(UAVObject *object) { // ManualControlCommand no need to be saved diff --git a/ground/openpilotgcs/src/plugins/config/configinputwidget.h b/ground/openpilotgcs/src/plugins/config/configinputwidget.h index eac10856c..3c2a138d2 100644 --- a/ground/openpilotgcs/src/plugins/config/configinputwidget.h +++ b/ground/openpilotgcs/src/plugins/config/configinputwidget.h @@ -71,6 +71,7 @@ public: bool shouldObjectBeSaved(UAVObject *object); private: + bool throttleError; bool growing; bool reverse[ManualControlSettings::CHANNELNEUTRAL_NUMELEM]; txMovements currentMovement; @@ -199,6 +200,7 @@ private slots: void invertControls(); void simpleCalibration(bool state); void adjustSpecialNeutrals(); + void checkThrottleRange(); void updateCalibration(); void resetChannelSettings(); void resetActuatorSettings(); From 993481c11e9c656f557a9536dda6e59cfeee1d03 Mon Sep 17 00:00:00 2001 From: abeck70 Date: Mon, 9 Mar 2015 21:31:42 +1100 Subject: [PATCH 46/68] OP-1764 added flight side sanity checks --- flight/libraries/sanitycheck.c | 22 +++++++++++++++++++++ shared/uavobjectdefinition/systemalarms.xml | 1 + 2 files changed, 23 insertions(+) diff --git a/flight/libraries/sanitycheck.c b/flight/libraries/sanitycheck.c index 13bca13be..8dbe6b7a1 100644 --- a/flight/libraries/sanitycheck.c +++ b/flight/libraries/sanitycheck.c @@ -44,6 +44,7 @@ // a number of useful macros #define ADDSEVERITY(check) severity = (severity != SYSTEMALARMS_ALARM_OK ? severity : ((check) ? SYSTEMALARMS_ALARM_OK : SYSTEMALARMS_ALARM_CRITICAL)) +#define ADDEXTENDEDALARMSTATUS(error_code, error_substatus) if ((severity != SYSTEMALARMS_ALARM_OK) && (alarmstatus == SYSTEMALARMS_EXTENDEDALARMSTATUS_NONE)) { alarmstatus = (error_code); alarmsubstatus = (error_substatus); } // private types typedef struct SANITYCHECK_CustomHookInstance { @@ -178,6 +179,27 @@ int32_t configuration_check() } } + + // Check throttle/collective channel range for valid configuration of input for critical control + SystemSettingsThrustControlOptions thrustType; + SystemSettingsThrustControlGet(&thrustType); + ManualControlSettingsChannelMinData channelMin; + ManualControlSettingsChannelMaxData channelMax; + ManualControlSettingsChannelMinGet(&channelMin); + ManualControlSettingsChannelMaxGet(&channelMax); + switch (thrustType) { + case SYSTEMSETTINGS_THRUSTCONTROL_THROTTLE: + ADDSEVERITY( fabsf(channelMax.Throttle - channelMin.Throttle) > 300.0f) ; + ADDEXTENDEDALARMSTATUS(SYSTEMALARMS_EXTENDEDALARMSTATUS_BADTHROTTLEORCOLLECTIVEINPUTRANGE, 0); + break; + case SYSTEMSETTINGS_THRUSTCONTROL_COLLECTIVE: + ADDSEVERITY( fabsf(channelMax.Collective - channelMin.Collective) > 300.0f); + ADDEXTENDEDALARMSTATUS(SYSTEMALARMS_EXTENDEDALARMSTATUS_BADTHROTTLEORCOLLECTIVEINPUTRANGE, 0); + break; + default: + break; + } + // query sanity check hooks if (severity < SYSTEMALARMS_ALARM_CRITICAL) { SANITYCHECK_CustomHookInstance *instance = NULL; diff --git a/shared/uavobjectdefinition/systemalarms.xml b/shared/uavobjectdefinition/systemalarms.xml index c242e133c..ba4cd24de 100644 --- a/shared/uavobjectdefinition/systemalarms.xml +++ b/shared/uavobjectdefinition/systemalarms.xml @@ -36,6 +36,7 @@ + From 2b12b18167fee0f53528d02c268ba4830f27f419 Mon Sep 17 00:00:00 2001 From: abeck70 Date: Mon, 9 Mar 2015 22:27:25 +1100 Subject: [PATCH 47/68] OP-1764 Add explanation html for the new throttle/collective input channel min/max range check --- ...ation-BadThrottleOrCollectiveInputRange.html | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 ground/openpilotgcs/src/plugins/systemhealth/html/SystemConfiguration-BadThrottleOrCollectiveInputRange.html diff --git a/ground/openpilotgcs/src/plugins/systemhealth/html/SystemConfiguration-BadThrottleOrCollectiveInputRange.html b/ground/openpilotgcs/src/plugins/systemhealth/html/SystemConfiguration-BadThrottleOrCollectiveInputRange.html new file mode 100644 index 000000000..0a478671a --- /dev/null +++ b/ground/openpilotgcs/src/plugins/systemhealth/html/SystemConfiguration-BadThrottleOrCollectiveInputRange.html @@ -0,0 +1,17 @@ + + + + + + + +

System Configuration : BadThrottleOrCollectiveInputRange

+

+ There is a problem with throttle/collection channel configuration : +

    +
  • Redo your input calibration.
  • +
  • The range for the channel between min and max must be more than 300us.
  • +
+

+ + From dc3610f4e854476870e8390ccde53057fdd3f7a4 Mon Sep 17 00:00:00 2001 From: abeck70 Date: Mon, 9 Mar 2015 22:31:40 +1100 Subject: [PATCH 48/68] OP-1764 uncrustify --- flight/libraries/sanitycheck.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/flight/libraries/sanitycheck.c b/flight/libraries/sanitycheck.c index 8dbe6b7a1..a55a05a70 100644 --- a/flight/libraries/sanitycheck.c +++ b/flight/libraries/sanitycheck.c @@ -43,7 +43,7 @@ #include // a number of useful macros -#define ADDSEVERITY(check) severity = (severity != SYSTEMALARMS_ALARM_OK ? severity : ((check) ? SYSTEMALARMS_ALARM_OK : SYSTEMALARMS_ALARM_CRITICAL)) +#define ADDSEVERITY(check) severity = (severity != SYSTEMALARMS_ALARM_OK ? severity : ((check) ? SYSTEMALARMS_ALARM_OK : SYSTEMALARMS_ALARM_CRITICAL)) #define ADDEXTENDEDALARMSTATUS(error_code, error_substatus) if ((severity != SYSTEMALARMS_ALARM_OK) && (alarmstatus == SYSTEMALARMS_EXTENDEDALARMSTATUS_NONE)) { alarmstatus = (error_code); alarmsubstatus = (error_substatus); } // private types @@ -188,16 +188,16 @@ int32_t configuration_check() ManualControlSettingsChannelMinGet(&channelMin); ManualControlSettingsChannelMaxGet(&channelMax); switch (thrustType) { - case SYSTEMSETTINGS_THRUSTCONTROL_THROTTLE: - ADDSEVERITY( fabsf(channelMax.Throttle - channelMin.Throttle) > 300.0f) ; - ADDEXTENDEDALARMSTATUS(SYSTEMALARMS_EXTENDEDALARMSTATUS_BADTHROTTLEORCOLLECTIVEINPUTRANGE, 0); - break; - case SYSTEMSETTINGS_THRUSTCONTROL_COLLECTIVE: - ADDSEVERITY( fabsf(channelMax.Collective - channelMin.Collective) > 300.0f); - ADDEXTENDEDALARMSTATUS(SYSTEMALARMS_EXTENDEDALARMSTATUS_BADTHROTTLEORCOLLECTIVEINPUTRANGE, 0); - break; - default: - break; + case SYSTEMSETTINGS_THRUSTCONTROL_THROTTLE: + ADDSEVERITY(fabsf(channelMax.Throttle - channelMin.Throttle) > 300.0f); + ADDEXTENDEDALARMSTATUS(SYSTEMALARMS_EXTENDEDALARMSTATUS_BADTHROTTLEORCOLLECTIVEINPUTRANGE, 0); + break; + case SYSTEMSETTINGS_THRUSTCONTROL_COLLECTIVE: + ADDSEVERITY(fabsf(channelMax.Collective - channelMin.Collective) > 300.0f); + ADDEXTENDEDALARMSTATUS(SYSTEMALARMS_EXTENDEDALARMSTATUS_BADTHROTTLEORCOLLECTIVEINPUTRANGE, 0); + break; + default: + break; } // query sanity check hooks From d94b015ed1c5716926ff04813a0004bf95410ecd Mon Sep 17 00:00:00 2001 From: abeck70 Date: Mon, 9 Mar 2015 22:36:54 +1100 Subject: [PATCH 49/68] OP-1764 spelling mistake --- .../SystemConfiguration-BadThrottleOrCollectiveInputRange.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ground/openpilotgcs/src/plugins/systemhealth/html/SystemConfiguration-BadThrottleOrCollectiveInputRange.html b/ground/openpilotgcs/src/plugins/systemhealth/html/SystemConfiguration-BadThrottleOrCollectiveInputRange.html index 0a478671a..7318fa2eb 100644 --- a/ground/openpilotgcs/src/plugins/systemhealth/html/SystemConfiguration-BadThrottleOrCollectiveInputRange.html +++ b/ground/openpilotgcs/src/plugins/systemhealth/html/SystemConfiguration-BadThrottleOrCollectiveInputRange.html @@ -7,7 +7,7 @@

System Configuration : BadThrottleOrCollectiveInputRange

- There is a problem with throttle/collection channel configuration : + There is a problem with throttle/collective channel configuration :