From b69402b7ab828e48bd64c36ec0706841e5b2b38e Mon Sep 17 00:00:00 2001 From: zedamota Date: Mon, 23 May 2011 11:55:09 +0100 Subject: [PATCH 1/5] This should fix the upload CLI tool. --- .../src/experimental/USB_UPLOAD_TOOL/main.cpp | 8 -------- .../src/experimental/USB_UPLOAD_TOOL/op_dfu.cpp | 4 +++- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/ground/openpilotgcs/src/experimental/USB_UPLOAD_TOOL/main.cpp b/ground/openpilotgcs/src/experimental/USB_UPLOAD_TOOL/main.cpp index e846cbea6..c9c687986 100644 --- a/ground/openpilotgcs/src/experimental/USB_UPLOAD_TOOL/main.cpp +++ b/ground/openpilotgcs/src/experimental/USB_UPLOAD_TOOL/main.cpp @@ -324,13 +324,5 @@ int main(int argc, char *argv[]) return 0; } -// OP_DFU dfu(true); -// //dfu.findDevices(); -// dfu.enterDFU(1); -// dfu.UploadFirmware("c:/ahrs.bin",true,1); -// // dfu.UploadDescription("josemanuel"); -// // QString str=dfu.DownloadDescription(12); - // dfu.JumpToApp(); - // qDebug()<<"Description="< Date: Tue, 24 May 2011 08:15:57 +0200 Subject: [PATCH 2/5] OP-504 Attempt to fix the Rescue/Boot issue, and bugfix in firmware version display in UPloader gadget. --- .../openpilotgcs/src/plugins/uploader/devicewidget.cpp | 10 ---------- .../src/plugins/uploader/uploadergadgetwidget.cpp | 6 +++++- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/uploader/devicewidget.cpp b/ground/openpilotgcs/src/plugins/uploader/devicewidget.cpp index d892c6f7a..7aa040255 100644 --- a/ground/openpilotgcs/src/plugins/uploader/devicewidget.cpp +++ b/ground/openpilotgcs/src/plugins/uploader/devicewidget.cpp @@ -268,12 +268,7 @@ void deviceWidget::uploadFirmware() if (firmwareBoard != board) { status("Error: firmware does not match board", STATUSICON_FAIL); return; - } else { - // Not a structured description: warn user - myDevice->buildDate->setText("Warning: development firmware"); - myDevice->commitTag->setText(""); } - // Check the firmware embedded in the file: QByteArray firmwareHash = desc.mid(40,20); QByteArray fileHash = QCryptographicHash::hash(arr.left(arr.length()-100), QCryptographicHash::Sha1); @@ -281,9 +276,6 @@ void deviceWidget::uploadFirmware() status("Error: firmware file corrupt", STATUSICON_FAIL); return; } - - - } else { // The firmware is not packaged, just upload the text in the description field // if it is there. @@ -291,8 +283,6 @@ void deviceWidget::uploadFirmware() } - - status("Starting firmware upload", STATUSICON_RUNNING); // We don't know which device was used previously, so we // are cautious and reenter DFU for this deviceID: diff --git a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp index d9823a36c..2943bcdfd 100755 --- a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp @@ -291,7 +291,10 @@ void UploaderGadgetWidget::goToBootloader(UAVObject* callerObj, bool success) /* m_config->haltButton->setEnabled(false); m_config->resetButton->setEnabled(false); + */ + // Need to re-enable in case we were not connected m_config->bootButton->setEnabled(true); + /* m_config->telemetryLink->setEnabled(false); m_config->rescueButton->setEnabled(false); */ @@ -359,6 +362,7 @@ void UploaderGadgetWidget::systemBoot() delete dfu; dfu = NULL; m_config->bootButton->setEnabled(true); + m_config->rescueButton->setEnabled(true); // Boot not possible, maybe Rescue OK? return; } log("Booting system..."); @@ -503,7 +507,7 @@ void UploaderGadgetWidget::systemRescue() } m_config->haltButton->setEnabled(false); m_config->resetButton->setEnabled(false); - //m_config->bootButton->setEnabled(true); + m_config->bootButton->setEnabled(true); m_config->rescueButton->setEnabled(false); currentStep = IAP_STATE_BOOTLOADER; // So that we can boot from the GUI afterwards. } From ccd383c99989918affb8e849c45f0df915bc20b0 Mon Sep 17 00:00:00 2001 From: zedamota Date: Wed, 25 May 2011 16:07:12 +0100 Subject: [PATCH 3/5] Fixes compile issues on windows with latest Qt --- .../libs/qextserialport/src/qextserialport.h | 2 +- .../src/libs/utils/consoleprocess_win.cpp | 2 +- .../src/libs/utils/qwineventnotifier_p.h | 94 +++++++++++++++++++ 3 files changed, 96 insertions(+), 2 deletions(-) create mode 100644 ground/openpilotgcs/src/libs/utils/qwineventnotifier_p.h diff --git a/ground/openpilotgcs/src/libs/qextserialport/src/qextserialport.h b/ground/openpilotgcs/src/libs/qextserialport/src/qextserialport.h index 5e247529d..60d973f41 100644 --- a/ground/openpilotgcs/src/libs/qextserialport/src/qextserialport.h +++ b/ground/openpilotgcs/src/libs/qextserialport/src/qextserialport.h @@ -138,7 +138,7 @@ struct PortSettings #include #include #include -#include +#include "utils/qwineventnotifier_p.h" #endif /*! diff --git a/ground/openpilotgcs/src/libs/utils/consoleprocess_win.cpp b/ground/openpilotgcs/src/libs/utils/consoleprocess_win.cpp index f58007c5c..15eec8361 100644 --- a/ground/openpilotgcs/src/libs/utils/consoleprocess_win.cpp +++ b/ground/openpilotgcs/src/libs/utils/consoleprocess_win.cpp @@ -33,7 +33,7 @@ #include #include #include -#include +#include "qwineventnotifier_p.h" #include diff --git a/ground/openpilotgcs/src/libs/utils/qwineventnotifier_p.h b/ground/openpilotgcs/src/libs/utils/qwineventnotifier_p.h new file mode 100644 index 000000000..459cd6730 --- /dev/null +++ b/ground/openpilotgcs/src/libs/utils/qwineventnotifier_p.h @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial Usage +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINEVENTNOTIFIER_P_H +#define QWINEVENTNOTIFIER_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience +// of other Qt classes. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "QtCore/qobject.h" +#include "QtCore/qt_windows.h" + +QT_BEGIN_NAMESPACE + +class Q_CORE_EXPORT QWinEventNotifier : public QObject +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QObject) + +public: + explicit QWinEventNotifier(QObject *parent = 0); + explicit QWinEventNotifier(HANDLE hEvent, QObject *parent = 0); + ~QWinEventNotifier(); + + void setHandle(HANDLE hEvent); + HANDLE handle() const; + + bool isEnabled() const; + +public Q_SLOTS: + void setEnabled(bool enable); + +Q_SIGNALS: + void activated(HANDLE hEvent); + +protected: + bool event(QEvent * e); + +private: + Q_DISABLE_COPY(QWinEventNotifier) + + HANDLE handleToEvent; + bool enabled; +}; + +QT_END_NAMESPACE + +#endif // QWINEVENTNOTIFIER_P_H From 3edd7e3c3d388f131332949ef8fbe4888c3ac50d Mon Sep 17 00:00:00 2001 From: elafargue Date: Wed, 25 May 2011 21:23:22 +0200 Subject: [PATCH 4/5] Support for packaged firmware files (opfw) in the uploader gadget. --- .../src/plugins/uploader/devicewidget.cpp | 10 +++++- .../src/plugins/uploader/devicewidget.ui | 31 ++++++++++++++----- 2 files changed, 33 insertions(+), 8 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/uploader/devicewidget.cpp b/ground/openpilotgcs/src/plugins/uploader/devicewidget.cpp index 7aa040255..7284d5d55 100644 --- a/ground/openpilotgcs/src/plugins/uploader/devicewidget.cpp +++ b/ground/openpilotgcs/src/plugins/uploader/devicewidget.cpp @@ -42,6 +42,8 @@ deviceWidget::deviceWidget(QWidget *parent) : QPixmap pix = QPixmap(QString(":uploader/images/view-refresh.svg")); myDevice->statusIcon->setPixmap(pix); + + myDevice->certifiedFW->setText(""); } @@ -123,6 +125,9 @@ void deviceWidget::populate() QString str = m_dfu->DownloadDescription(size); myDevice->description->setMaxLength(size); myDevice->description->setText(str.left(str.indexOf(QChar(255)))); + QPixmap pix = QPixmap(QString(":uploader/images/gtk-info.svg")); + myDevice->certifiedFW->setPixmap(pix); + myDevice->certifiedFW->setToolTip(tr("Custom Firmware Build")); myDevice->buildDate->setText("Warning: development firmware"); myDevice->commitTag->setText(""); } @@ -182,6 +187,9 @@ bool deviceWidget::populateStructuredDescription(QByteArray desc) QString dscText = QString(desc.mid(14,26)); myDevice->description->setText(dscText); + QPixmap pix = QPixmap(QString(":uploader/images/application-certificate.svg")); + myDevice->certifiedFW->setPixmap(pix); + myDevice->certifiedFW->setToolTip(tr("Official Firmware Build")); return true; } @@ -406,7 +414,7 @@ QString deviceWidget::setOpenFileName() QString fileName = QFileDialog::getOpenFileName(this, tr("Select firmware file"), "", - tr("Firmware Files (*.bin)"), + tr("Firmware Files (*.bin *.opfw)"), &selectedFilter, options); return fileName; diff --git a/ground/openpilotgcs/src/plugins/uploader/devicewidget.ui b/ground/openpilotgcs/src/plugins/uploader/devicewidget.ui index 5d09b3d1a..a5f17794e 100644 --- a/ground/openpilotgcs/src/plugins/uploader/devicewidget.ui +++ b/ground/openpilotgcs/src/plugins/uploader/devicewidget.ui @@ -137,13 +137,6 @@ - - - - Build Date - - - @@ -151,6 +144,30 @@ + + + + + + certified + + + + + + + + 0 + 0 + + + + buildDate + + + + + From 9cb380fba387b17074914b863314e272c7e0107f Mon Sep 17 00:00:00 2001 From: elafargue Date: Wed, 25 May 2011 21:25:29 +0200 Subject: [PATCH 5/5] Make sure the "Advanced" settings is not selected by default in the airframe config UI. --- ground/openpilotgcs/src/plugins/config/airframe.ui | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ground/openpilotgcs/src/plugins/config/airframe.ui b/ground/openpilotgcs/src/plugins/config/airframe.ui index 3b7fb1d57..44d65930a 100644 --- a/ground/openpilotgcs/src/plugins/config/airframe.ui +++ b/ground/openpilotgcs/src/plugins/config/airframe.ui @@ -17,7 +17,7 @@ - 1 + 0 @@ -102,7 +102,7 @@ - 3 + 0