1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-20 10:54:14 +01:00

Merge branch 'bugfix-ground'

This commit is contained in:
elafargue 2011-05-25 23:15:47 +02:00
commit 54474613e9
9 changed files with 139 additions and 32 deletions

View File

@ -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="<<str;
return a.exec();
}

View File

@ -56,7 +56,9 @@ OP_DFU::OP_DFU(bool _debug,bool _use_serial,QString portname,bool umodereset): d
{
cout<<".";
delay::msleep(500);
numDevices = hidHandle.open(1,0x20a0,0x4117,0,0); //0xff9c,0x0001);
numDevices = hidHandle.open(1,0x20a0,0x415A,0,0); //0xff9c,0x0001);
if(numDevices==0)
numDevices = hidHandle.open(1,0x20a0,0x415B,0,0); //0xff9c,0x0001);
if(++count==10)
{
cout<<"\r";

View File

@ -138,7 +138,7 @@ struct PortSettings
#include <windows.h>
#include <QThread>
#include <QReadWriteLock>
#include <QtCore/private/qwineventnotifier_p.h>
#include "utils/qwineventnotifier_p.h"
#endif
/*!

View File

@ -33,7 +33,7 @@
#include <QtCore/QDir>
#include <QtCore/QTemporaryFile>
#include <QtCore/QAbstractEventDispatcher>
#include <QtCore/private/qwineventnotifier_p.h>
#include "qwineventnotifier_p.h"
#include <QtNetwork/QLocalSocket>

View File

@ -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

View File

@ -17,7 +17,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="tabWidgetPage1">
<attribute name="title">
@ -102,7 +102,7 @@
<item>
<widget class="QStackedWidget" name="airframesWidget">
<property name="currentIndex">
<number>3</number>
<number>0</number>
</property>
<widget class="QWidget" name="fixedWing">
<property name="enabled">

View File

@ -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;
}
@ -268,12 +276,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 +284,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 +291,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:
@ -416,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;

View File

@ -137,13 +137,6 @@
</item>
</layout>
</item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="buildDate">
<property name="text">
<string>Build Date</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="commitTag">
<property name="text">
@ -151,6 +144,30 @@
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="certifiedFW">
<property name="text">
<string>certified</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="buildDate">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>buildDate</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>

View File

@ -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.
}