mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
Merge remote-tracking branch 'remotes/origin/OP-515-PT_Dreamer' into bugfix-ground
This commit is contained in:
commit
4d634ad304
@ -270,9 +270,9 @@ QByteArray UAVObjectUtilManager::getBoardCPUSerial()
|
||||
/**
|
||||
* Get the UAV Board Description, for anyone interested.
|
||||
*/
|
||||
QString UAVObjectUtilManager::getBoardDescription()
|
||||
QByteArray UAVObjectUtilManager::getBoardDescription()
|
||||
{
|
||||
QString description;
|
||||
QByteArray ret;
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
if (!pm)
|
||||
return 0;
|
||||
@ -291,10 +291,10 @@ QString UAVObjectUtilManager::getBoardDescription()
|
||||
|
||||
UAVObjectField* descriptionField = obj->getField("Description");
|
||||
// Description starts with an offset of
|
||||
for (int i = 14; i < descriptionField->getNumElements(); ++i) {
|
||||
description.append(descriptionField->getValue(i).toChar());
|
||||
for (int i = 0; i < descriptionField->getNumElements(); ++i) {
|
||||
ret.append(descriptionField->getValue(i).toInt());
|
||||
}
|
||||
return description;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
@ -63,7 +63,7 @@ public:
|
||||
|
||||
int getBoardModel();
|
||||
QByteArray getBoardCPUSerial();
|
||||
QString getBoardDescription();
|
||||
QByteArray getBoardDescription();
|
||||
UAVObjectManager* getObjectManager();
|
||||
void saveObjectToSD(UAVObject *obj);
|
||||
|
||||
|
@ -0,0 +1,5 @@
|
||||
#include "devicedescriptorstruct.h"
|
||||
|
||||
deviceDescriptorStruct::deviceDescriptorStruct()
|
||||
{
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
#ifndef DEVICEDESCRIPTORSTRUCT_H
|
||||
#define DEVICEDESCRIPTORSTRUCT_H
|
||||
|
||||
#include <QString>
|
||||
struct deviceDescriptorStruct
|
||||
{
|
||||
public:
|
||||
QString gitTag;
|
||||
QString buildDate;
|
||||
QString description;
|
||||
int boardType;
|
||||
int boardRevision;
|
||||
deviceDescriptorStruct();
|
||||
};
|
||||
|
||||
#endif // DEVICEDESCRIPTORSTRUCT_H
|
@ -34,16 +34,17 @@ deviceWidget::deviceWidget(QWidget *parent) :
|
||||
devicePic = NULL; // Initialize pointer to null
|
||||
|
||||
// Initialization of the Device icon display
|
||||
myDevice->devicePicture->setScene(new QGraphicsScene(this));
|
||||
|
||||
connect(myDevice->verifyButton, SIGNAL(clicked()), this, SLOT(verifyFirmware()));
|
||||
myDevice->verticalGroupBox_loaded->setVisible(false);
|
||||
myDevice->youdont->setVisible(false);
|
||||
myDevice->gVDevice->setScene(new QGraphicsScene(this));
|
||||
connect(myDevice->retrieveButton, SIGNAL(clicked()), this, SLOT(downloadFirmware()));
|
||||
connect(myDevice->updateButton, SIGNAL(clicked()), this, SLOT(uploadFirmware()));
|
||||
|
||||
connect(myDevice->pbLoad, SIGNAL(clicked()), this, SLOT(loadFirmware()));
|
||||
connect(myDevice->youdont, SIGNAL(stateChanged(int)), this, SLOT(confirmCB(int)));
|
||||
QPixmap pix = QPixmap(QString(":uploader/images/view-refresh.svg"));
|
||||
myDevice->statusIcon->setPixmap(pix);
|
||||
|
||||
myDevice->certifiedFW->setText("");
|
||||
myDevice->lblCertified->setText("");
|
||||
}
|
||||
|
||||
|
||||
@ -54,14 +55,16 @@ void deviceWidget::showEvent(QShowEvent *event)
|
||||
// widget is shown, otherwise it cannot compute its values and
|
||||
// the result is usually a ahrsbargraph that is way too small.
|
||||
if (devicePic)
|
||||
myDevice->devicePicture->fitInView(devicePic,Qt::KeepAspectRatio);
|
||||
{
|
||||
myDevice->gVDevice->fitInView(devicePic,Qt::KeepAspectRatio);
|
||||
}
|
||||
}
|
||||
|
||||
void deviceWidget::resizeEvent(QResizeEvent* event)
|
||||
{
|
||||
Q_UNUSED(event);
|
||||
if (devicePic)
|
||||
myDevice->devicePicture->fitInView(devicePic, Qt::KeepAspectRatio);
|
||||
myDevice->gVDevice->fitInView(devicePic, Qt::KeepAspectRatio);
|
||||
}
|
||||
|
||||
|
||||
@ -74,21 +77,46 @@ void deviceWidget::setDfu(DFUObject *dfu)
|
||||
m_dfu = dfu;
|
||||
}
|
||||
|
||||
QString deviceWidget::idToBoardName(int id)
|
||||
{
|
||||
switch (id | 0x0011) {
|
||||
case 0x0111://MB
|
||||
return QString("Board Name: OpenPilot MainBoard");
|
||||
break;
|
||||
case 0x0311://PipX
|
||||
return QString("Board Name: PipXtreame");
|
||||
break;
|
||||
case 0x0411://Coptercontrol
|
||||
return QString("Board Name: CopterControl");
|
||||
break;
|
||||
case 0x0211://INS
|
||||
return QString("Board Name: OpenPilot INS");
|
||||
break;
|
||||
default:
|
||||
return QString("");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Fills the various fields for the device
|
||||
*/
|
||||
void deviceWidget::populate()
|
||||
{
|
||||
|
||||
int id = m_dfu->devices[deviceID].ID;
|
||||
myDevice->deviceID->setText(QString("Device ID: ") + QString::number(id, 16));
|
||||
myDevice->lbldevID->setText(QString("Device ID: ") + QString::number(id, 16));
|
||||
// DeviceID tells us what sort of HW we have detected:
|
||||
// display a nice icon:
|
||||
myDevice->devicePicture->scene()->clear();
|
||||
myDevice->gVDevice->scene()->clear();
|
||||
if (devicePic)
|
||||
delete devicePic;
|
||||
devicePic = new QGraphicsSvgItem();
|
||||
devicePic->setSharedRenderer(new QSvgRenderer());
|
||||
|
||||
myDevice->lblDevName->setText(idToBoardName(id));
|
||||
|
||||
myDevice->lblHWRev->setText(QString(tr("HW Revision:"))+QString::number(id & 0x0011, 16));
|
||||
switch (id) {
|
||||
case 0x0101:
|
||||
devicePic->renderer()->load(QString(":/uploader/images/deviceID-0101.svg"));
|
||||
@ -106,30 +134,37 @@ void deviceWidget::populate()
|
||||
break;
|
||||
}
|
||||
devicePic->setElementId("device");
|
||||
myDevice->devicePicture->scene()->addItem(devicePic);
|
||||
myDevice->devicePicture->setSceneRect(devicePic->boundingRect());
|
||||
myDevice->devicePicture->fitInView(devicePic,Qt::KeepAspectRatio);
|
||||
//myDevice->devicePicture->scene()->addItem(devicePic);
|
||||
//myDevice->devicePicture->setSceneRect(devicePic->boundingRect());
|
||||
//myDevice->devicePicture->fitInView(devicePic,Qt::KeepAspectRatio);
|
||||
|
||||
myDevice->gVDevice->scene()->addItem(devicePic);
|
||||
myDevice->gVDevice->setSceneRect(devicePic->boundingRect());
|
||||
myDevice->gVDevice->fitInView(devicePic,Qt::KeepAspectRatio);
|
||||
|
||||
bool r = m_dfu->devices[deviceID].Readable;
|
||||
bool w = m_dfu->devices[deviceID].Writable;
|
||||
myDevice->deviceACL->setText(QString("Access: ") + QString(r ? "R" : "-") + QString(w ? "W" : "-"));
|
||||
myDevice->maxCodeSize->setText(QString("Max code size: ") +QString::number(m_dfu->devices[deviceID].SizeOfCode));
|
||||
myDevice->fwCRC->setText(QString("FW CRC: ") + QString::number(m_dfu->devices[deviceID].FW_CRC));
|
||||
myDevice->BLVersion->setText(QString("BL Version: ") + QString::number(m_dfu->devices[deviceID].BL_Version));
|
||||
|
||||
myDevice->lblAccess->setText(QString("Access: ") + QString(r ? "R" : "-") + QString(w ? "W" : "-"));
|
||||
myDevice->lblMaxCode->setText(QString("Max code size: ") +QString::number(m_dfu->devices[deviceID].SizeOfCode));
|
||||
myDevice->lblCRC->setText(QString("FW CRC: ") + QString::number(m_dfu->devices[deviceID].FW_CRC));
|
||||
myDevice->lblBLVer->setText(QString("BL Version: ") + QString::number(m_dfu->devices[deviceID].BL_Version));
|
||||
|
||||
int size=((OP_DFU::device)m_dfu->devices[deviceID]).SizeOfDesc;
|
||||
m_dfu->enterDFU(deviceID);
|
||||
QByteArray desc = m_dfu->DownloadDescriptionAsBA(size);
|
||||
if (! populateStructuredDescription(desc)) {
|
||||
|
||||
if (! populateBoardStructuredDescription(desc)) {
|
||||
//TODO
|
||||
// desc was not a structured description
|
||||
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("");
|
||||
//myDevice->lblDescription->setMaxLength(size);
|
||||
myDevice->lblDescription->setText(QString("FW Description")+str.left(str.indexOf(QChar(255))));
|
||||
QPixmap pix = QPixmap(QString(":uploader/images/warning.svg"));
|
||||
myDevice->lblCertified->setPixmap(pix);
|
||||
myDevice->lblCertified->setToolTip(tr("Custom Firmware Build"));
|
||||
myDevice->lblBuildDate->setText("Warning: development firmware");
|
||||
myDevice->lblGitTag->setText("");
|
||||
}
|
||||
|
||||
|
||||
@ -145,59 +180,75 @@ void deviceWidget::freeze()
|
||||
{
|
||||
myDevice->description->setEnabled(false);
|
||||
myDevice->updateButton->setEnabled(false);
|
||||
myDevice->verifyButton->setEnabled(false);
|
||||
myDevice->retrieveButton->setEnabled(false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Populates the widget field with the description in case
|
||||
it is structured properly
|
||||
*/
|
||||
bool deviceWidget::populateStructuredDescription(QByteArray desc)
|
||||
bool deviceWidget::populateBoardStructuredDescription(QByteArray desc)
|
||||
{
|
||||
if (desc.startsWith("OpFw")) {
|
||||
// This looks like a binary with a description at the end
|
||||
/*
|
||||
# 4 bytes: header: "OpFw"
|
||||
# 4 bytes: GIT commit tag (short version of SHA1)
|
||||
# 4 bytes: Unix timestamp of compile time
|
||||
# 2 bytes: target platform. Should follow same rule as BOARD_TYPE and BOARD_REVISION in board define files.
|
||||
# 26 bytes: commit tag if it is there, otherwise "Unreleased". Zero-padded
|
||||
# ---- 40 bytes limit ---
|
||||
# 20 bytes: SHA1 sum of the firmware.
|
||||
# 40 bytes: free for now.
|
||||
*/
|
||||
|
||||
// Note: the ARM binary is big-endian:
|
||||
quint32 gitCommitTag = desc.at(7)&0xFF;
|
||||
for (int i=1;i<4;i++) {
|
||||
gitCommitTag = gitCommitTag<<8;
|
||||
gitCommitTag += desc.at(7-i) & 0xFF;
|
||||
}
|
||||
myDevice->commitTag->setText("GIT tag 0x" + QString::number(gitCommitTag,16));
|
||||
quint32 buildDate = desc.at(11)&0xFF;
|
||||
for (int i=1;i<4;i++) {
|
||||
buildDate = buildDate<<8;
|
||||
buildDate += desc.at(11-i) & 0xFF;
|
||||
}
|
||||
|
||||
myDevice->buildDate->setText(QString("Build time: ") + QDateTime::fromTime_t(buildDate).toString());
|
||||
QByteArray targetPlatform = desc.mid(12,2);
|
||||
// TODO: check platform compatibility
|
||||
QString dscText = QString(desc.mid(14,26));
|
||||
myDevice->description->setText(dscText);
|
||||
|
||||
if(UploaderGadgetWidget::descriptionToStructure(desc,&onBoardDescrition))
|
||||
{
|
||||
myDevice->lblGitTag->setText("GIT tag "+onBoardDescrition.gitTag);
|
||||
myDevice->lblBuildDate->setText(QString("Build time: ") + onBoardDescrition.buildDate);
|
||||
if(onBoardDescrition.description.startsWith("release",Qt::CaseInsensitive))
|
||||
{
|
||||
myDevice->lblDescription->setText(QString("FW Release:")+onBoardDescrition.description);
|
||||
QPixmap pix = QPixmap(QString(":uploader/images/application-certificate.svg"));
|
||||
myDevice->certifiedFW->setPixmap(pix);
|
||||
myDevice->certifiedFW->setToolTip(tr("Official Firmware Build"));
|
||||
myDevice->lblCertified->setPixmap(pix);
|
||||
myDevice->lblCertified->setToolTip(tr("Official Firmware Build"));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
myDevice->lblDescription->setText(QString("Beta or Custom Firmware:")+onBoardDescrition.description);
|
||||
QPixmap pix = QPixmap(QString(":uploader/images/warning.svg"));
|
||||
myDevice->lblCertified->setPixmap(pix);
|
||||
myDevice->lblCertified->setToolTip(tr("Custom Firmware Build"));
|
||||
}
|
||||
|
||||
myDevice->lblBrdName->setText(idToBoardName(onBoardDescrition.boardType<<8));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
bool deviceWidget::populateLoadedStructuredDescription(QByteArray desc)
|
||||
{
|
||||
if(UploaderGadgetWidget::descriptionToStructure(desc,&LoadedDescrition))
|
||||
{
|
||||
myDevice->lblGitTagL->setText("GIT tag "+LoadedDescrition.gitTag);
|
||||
myDevice->lblBuildDateL->setText(QString("Build time: ") + LoadedDescrition.buildDate);
|
||||
if(LoadedDescrition.description.startsWith("release",Qt::CaseInsensitive))
|
||||
{
|
||||
myDevice->lblDescriptionL->setText(tr("FW Release:"));
|
||||
myDevice->description->setText(LoadedDescrition.description);
|
||||
QPixmap pix = QPixmap(QString(":uploader/images/application-certificate.svg"));
|
||||
myDevice->lblCertifiedL->setPixmap(pix);
|
||||
myDevice->lblCertifiedL->setToolTip(tr("Official Firmware Build"));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
myDevice->lblDescriptionL->setText(tr("Beta or Custom Firmware:"));
|
||||
myDevice->description->setText(LoadedDescrition.description);
|
||||
QPixmap pix = QPixmap(QString(":uploader/images/warning.svg"));
|
||||
myDevice->lblCertifiedL->setPixmap(pix);
|
||||
myDevice->lblCertifiedL->setToolTip(tr("Custom Firmware Build"));
|
||||
}
|
||||
|
||||
myDevice->lblBrdNameL->setText(idToBoardName(LoadedDescrition.boardType<<8));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
/**
|
||||
Updates status message for messages coming from DFU
|
||||
*/
|
||||
@ -206,6 +257,16 @@ void deviceWidget::dfuStatus(QString str)
|
||||
status(str, STATUSICON_RUNNING);
|
||||
}
|
||||
|
||||
void deviceWidget::confirmCB(int value)
|
||||
{
|
||||
if(value==Qt::Checked)
|
||||
{
|
||||
myDevice->updateButton->setEnabled(true);
|
||||
}
|
||||
else
|
||||
myDevice->updateButton->setEnabled(false);
|
||||
}
|
||||
|
||||
/**
|
||||
Updates status message
|
||||
*/
|
||||
@ -229,11 +290,68 @@ void deviceWidget::status(QString str, StatusIcon ic)
|
||||
myDevice->statusIcon->setPixmap(px);
|
||||
}
|
||||
|
||||
/**
|
||||
Verifies the firmware CRC
|
||||
*/
|
||||
void deviceWidget::verifyFirmware()
|
||||
|
||||
void deviceWidget::loadFirmware()
|
||||
{
|
||||
filename = setOpenFileName();
|
||||
|
||||
if (filename.isEmpty()) {
|
||||
status("Empty filename", STATUSICON_FAIL);
|
||||
return;
|
||||
}
|
||||
|
||||
QFile file(filename);
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
status("Can't open file", STATUSICON_FAIL);
|
||||
return;
|
||||
}
|
||||
|
||||
loadedFW = file.readAll();
|
||||
myDevice->youdont->setVisible(false);
|
||||
myDevice->youdont->setChecked(false);
|
||||
QByteArray desc = loadedFW.right(100);
|
||||
QPixmap px;
|
||||
myDevice->lblCRCL->setText(QString("FW CRC: ") + QString::number(DFUObject::CRCFromQBArray(loadedFW,m_dfu->devices[deviceID].SizeOfCode)));
|
||||
if (populateLoadedStructuredDescription(desc))
|
||||
{
|
||||
myDevice->youdont->setChecked(true);
|
||||
myDevice->verticalGroupBox_loaded->setVisible(true);
|
||||
if(myDevice->lblCRC->text()==myDevice->lblCRCL->text())
|
||||
{
|
||||
myDevice->statusLabel->setText(tr("The loaded firmware maches the firmware on the board. You shouldn't upload it"));
|
||||
px.load(QString(":/uploader/images/warning.svg"));
|
||||
}
|
||||
else if(onBoardDescrition.boardType!=LoadedDescrition.boardType)
|
||||
{
|
||||
myDevice->statusLabel->setText(tr("The loaded firmware is not suited for the HW connected. You shouldn't upload it"));
|
||||
px.load(QString(":/uploader/images/warning.svg"));
|
||||
}
|
||||
else if(QDateTime::fromString(onBoardDescrition.buildDate)>QDateTime::fromString(LoadedDescrition.buildDate))
|
||||
{
|
||||
myDevice->statusLabel->setText(tr("The loaded firmware is older then the firmware on the board. You shouldn't upload it"));
|
||||
px.load(QString(":/uploader/images/warning.svg"));
|
||||
}
|
||||
else if(!LoadedDescrition.description.startsWith("release",Qt::CaseInsensitive))
|
||||
{
|
||||
myDevice->statusLabel->setText(tr("The loaded firmware is not an oficial OpenPilot release. You should upload it only if you know what you are doing"));
|
||||
px.load(QString(":/uploader/images/warning.svg"));
|
||||
}
|
||||
else
|
||||
{
|
||||
myDevice->statusLabel->setText(tr("Everything seems OK. You should upload the loaded firmware by pressing 'upload'"));
|
||||
px.load(QString(":/uploader/images/gtk-info.svg"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
myDevice->statusLabel->setText(tr("The loaded firmware was not packaged with a compatible format. You shouldn't' upload it, if you know what you are doing and still want to upload it confirm it by checking the checkbox bellow"));
|
||||
px.load(QString(":/uploader/images/warning.svg"));
|
||||
myDevice->youdont->setChecked(false);
|
||||
myDevice->youdont->setVisible(true);
|
||||
myDevice->verticalGroupBox_loaded->setVisible(false);
|
||||
}
|
||||
myDevice->statusIcon->setPixmap(px);
|
||||
//myDevice->updateButton->setEnabled(true);
|
||||
|
||||
}
|
||||
|
||||
@ -253,22 +371,8 @@ void deviceWidget::uploadFirmware()
|
||||
verify = true;
|
||||
*/
|
||||
|
||||
QString filename = setOpenFileName();
|
||||
|
||||
if (filename.isEmpty()) {
|
||||
status("Empty filename", STATUSICON_FAIL);
|
||||
return;
|
||||
}
|
||||
|
||||
QFile file(filename);
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
status("Can't open file", STATUSICON_FAIL);
|
||||
return;
|
||||
}
|
||||
|
||||
QByteArray arr = file.readAll();
|
||||
QByteArray desc = arr.right(100);
|
||||
if (populateStructuredDescription(desc)) {
|
||||
QByteArray desc = loadedFW.right(100);
|
||||
if (desc.startsWith("OpFw")) {
|
||||
descriptionArray = desc;
|
||||
// Now do sanity checking:
|
||||
// - Check whether board type matches firmware:
|
||||
@ -280,7 +384,7 @@ void deviceWidget::uploadFirmware()
|
||||
}
|
||||
// Check the firmware embedded in the file:
|
||||
QByteArray firmwareHash = desc.mid(40,20);
|
||||
QByteArray fileHash = QCryptographicHash::hash(arr.left(arr.length()-100), QCryptographicHash::Sha1);
|
||||
QByteArray fileHash = QCryptographicHash::hash(loadedFW.left(loadedFW.length()-100), QCryptographicHash::Sha1);
|
||||
if (firmwareHash != fileHash) {
|
||||
status("Error: firmware file corrupt", STATUSICON_FAIL);
|
||||
return;
|
||||
|
@ -38,9 +38,9 @@
|
||||
#include <QtSvg/QGraphicsSvgItem>
|
||||
#include <QtSvg/QSvgRenderer>
|
||||
#include <QCryptographicHash>
|
||||
|
||||
#include "uavobjectutilmanager.h"
|
||||
#include "devicedescriptorstruct.h"
|
||||
using namespace OP_DFU;
|
||||
|
||||
class deviceWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -54,6 +54,10 @@ public:
|
||||
QString setOpenFileName();
|
||||
QString setSaveFileName();
|
||||
private:
|
||||
deviceDescriptorStruct onBoardDescrition;
|
||||
deviceDescriptorStruct LoadedDescrition;
|
||||
QByteArray loadedFW;
|
||||
QString idToBoardName(int id);
|
||||
Ui_deviceWidget *myDevice;
|
||||
int deviceID;
|
||||
DFUObject *m_dfu;
|
||||
@ -62,19 +66,20 @@ private:
|
||||
QGraphicsSvgItem *devicePic;
|
||||
QByteArray descriptionArray;
|
||||
void status(QString str, StatusIcon ic);
|
||||
bool populateStructuredDescription(QByteArray arr);
|
||||
|
||||
bool populateBoardStructuredDescription(QByteArray arr);
|
||||
bool populateLoadedStructuredDescription(QByteArray arr);
|
||||
|
||||
signals:
|
||||
|
||||
public slots:
|
||||
void verifyFirmware();
|
||||
void uploadFirmware();
|
||||
void loadFirmware();
|
||||
void downloadFirmware();
|
||||
void setProgress(int);
|
||||
void downloadFinished();
|
||||
void uploadFinished(OP_DFU::Status);
|
||||
void dfuStatus(QString);
|
||||
void confirmCB(int);
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent *event);
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>516</width>
|
||||
<height>253</height>
|
||||
<height>507</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -15,37 +15,15 @@
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="0" colspan="3">
|
||||
<widget class="QLineEdit" name="description">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
<widget class="QGroupBox" name="verticalGroupBox_4">
|
||||
<property name="title">
|
||||
<string>Device Information</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="deviceID">
|
||||
<property name="text">
|
||||
<string>DeviceID</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="0" colspan="2">
|
||||
<widget class="QProgressBar" name="progressBar">
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="deviceACL">
|
||||
<property name="text">
|
||||
<string>ReadWrite</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2" rowspan="3">
|
||||
<widget class="QGraphicsView" name="devicePicture">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="QGraphicsView" name="gVDevice">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>160</width>
|
||||
@ -55,23 +33,71 @@
|
||||
<property name="styleSheet">
|
||||
<string notr="true">background: transparent</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="lblDevName">
|
||||
<property name="text">
|
||||
<string>lblDevName</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<widget class="QPushButton" name="verifyButton">
|
||||
<item>
|
||||
<widget class="QLabel" name="lblHWRev">
|
||||
<property name="text">
|
||||
<string>lblHWRev</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lbldevID">
|
||||
<property name="text">
|
||||
<string>DeviceID</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblAccess">
|
||||
<property name="text">
|
||||
<string>RW</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblBLVer">
|
||||
<property name="text">
|
||||
<string>BL Version</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblMaxCode">
|
||||
<property name="text">
|
||||
<string>MaxCodeSize</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pbLoad">
|
||||
<property name="toolTip">
|
||||
<string>Loads the firmware</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Load</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="updateButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Verify...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="2">
|
||||
<widget class="QPushButton" name="updateButton">
|
||||
<property name="toolTip">
|
||||
<string>Update the firmware on this board.</string>
|
||||
</property>
|
||||
@ -80,7 +106,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="retrieveButton">
|
||||
<property name="toolTip">
|
||||
<string>Download the current board firmware to your computer</string>
|
||||
@ -90,28 +116,18 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLabel" name="BLVersion">
|
||||
<property name="text">
|
||||
<string>BootLoaderVersion</string>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QProgressBar" name="progressBar">
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="fwCRC">
|
||||
<property name="text">
|
||||
<string>fwCRC</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLabel" name="maxCodeSize">
|
||||
<property name="text">
|
||||
<string>MaxCodeSize</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="statusIcon">
|
||||
@ -137,43 +153,157 @@
|
||||
<property name="text">
|
||||
<string>Status</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="commitTag">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="youdont">
|
||||
<property name="text">
|
||||
<string>Commit tag</string>
|
||||
<string>I know what I'm doing</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0" colspan="2">
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="verticalGroupBox_3">
|
||||
<property name="title">
|
||||
<string>Firmware currently on the device</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<item>
|
||||
<widget class="QLabel" name="lblBuildDate">
|
||||
<property name="text">
|
||||
<string>lblBuildDate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblCRC">
|
||||
<property name="text">
|
||||
<string>lblCRC</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblGitTag">
|
||||
<property name="text">
|
||||
<string>lblGitTag</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblBrdName">
|
||||
<property name="text">
|
||||
<string>lblBrdName</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblCertified">
|
||||
<property name="text">
|
||||
<string>lblCertified</string>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblDescription">
|
||||
<property name="text">
|
||||
<string>lblDescription</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="verticalGroupBox_loaded">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Loaded Firmware</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="certifiedFW">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="lblBuildDateL">
|
||||
<property name="text">
|
||||
<string>certified</string>
|
||||
<string>lblBuildDate</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>
|
||||
<widget class="QLabel" name="lblCRCL">
|
||||
<property name="text">
|
||||
<string>buildDate</string>
|
||||
<string>lblCRC</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblGitTagL">
|
||||
<property name="text">
|
||||
<string>lblGitTag</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblBrdNameL">
|
||||
<property name="text">
|
||||
<string>lblBrdName</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="lblCertifiedL">
|
||||
<property name="text">
|
||||
<string>lblCertifiedL</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="lblDescriptionL">
|
||||
<property name="text">
|
||||
<string>Description:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="description"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
102
ground/openpilotgcs/src/plugins/uploader/images/warning.svg
Normal file
102
ground/openpilotgcs/src/plugins/uploader/images/warning.svg
Normal file
@ -0,0 +1,102 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Generator: Adobe Illustrator 15.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
id="Layer_1"
|
||||
x="0px"
|
||||
y="0px"
|
||||
width="51.537998"
|
||||
height="46.021885"
|
||||
viewBox="0 0 51.538001 46.021886"
|
||||
enable-background="new 0 0 514.475 473.977"
|
||||
xml:space="preserve"
|
||||
inkscape:version="0.48.1 "
|
||||
sodipodi:docname="warning_s.svg"><metadata
|
||||
id="metadata3095"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title /></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs3093" /><sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1280"
|
||||
inkscape:window-height="738"
|
||||
id="namedview3091"
|
||||
showgrid="false"
|
||||
inkscape:zoom="1.0949899"
|
||||
inkscape:cx="249.10624"
|
||||
inkscape:cy="125.11088"
|
||||
inkscape:window-x="-8"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="Layer_1"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0" />
|
||||
<radialGradient
|
||||
id="SVGID_1_"
|
||||
cx="255.45261"
|
||||
cy="231.6748"
|
||||
r="206.35049"
|
||||
gradientTransform="matrix(0.1182761,0,0,0.12913623,-4.4457028,-6.9088686)"
|
||||
gradientUnits="userSpaceOnUse">
|
||||
<stop
|
||||
offset="0"
|
||||
style="stop-color:#FFDE17"
|
||||
id="stop3074" />
|
||||
<stop
|
||||
offset="1"
|
||||
style="stop-color:#ABA01F"
|
||||
id="stop3076" />
|
||||
</radialGradient>
|
||||
<path
|
||||
stroke-miterlimit="10"
|
||||
d="M 1.2974519,42.730481 C -1.4443604,39.150401 21.620352,1.0717714 25.887967,1.0717714 c 4.269682,0 27.060213,38.8621096 24.35608,41.6587096 -3.013913,3.11312 -46.8075615,2.80177 -48.9465951,0 z"
|
||||
id="path3078"
|
||||
style="fill:url(#SVGID_1_);stroke:#000000;stroke-width:2.14355946;stroke-miterlimit:10"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
d="m 22.987071,36.405661 c 0,-1.55651 1.465096,-2.59423 3.118544,-2.59423 1.674394,0 3.013911,1.03772 3.013911,2.59423 0,1.55658 -1.255794,2.59427 -3.118542,2.59427 -1.674391,0 -3.034841,-1.03769 -3.034841,-2.59427 z m 1.465096,-5.24042 c -0.627898,-0.77824 -1.67439,-20.36495 -0.627898,-21.3507596 0.837188,-0.77831 3.872026,-0.77831 4.604571,0 0.8372,0.7782796 -0.209304,20.8059796 -0.627897,21.3507596 -0.418602,0.51889 -2.762741,0.51889 -3.265057,0 z"
|
||||
id="path3080"
|
||||
inkscape:connector-curvature="0" />
|
||||
<linearGradient
|
||||
id="SVGID_2_"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
x1="256.45209"
|
||||
y1="304.9277"
|
||||
x2="256.45209"
|
||||
y2="48.449699"
|
||||
gradientTransform="matrix(0.11827613,0,0,0.10761355,-4.4457031,-1.9220086)">
|
||||
<stop
|
||||
offset="0"
|
||||
style="stop-color:#FFFFFF"
|
||||
id="stop3083" />
|
||||
<stop
|
||||
offset="0.0896"
|
||||
style="stop-color:#FFFFFF;stop-opacity:0.9104"
|
||||
id="stop3085" />
|
||||
<stop
|
||||
offset="1"
|
||||
style="stop-color:#FFFFFF;stop-opacity:0"
|
||||
id="stop3087" />
|
||||
</linearGradient>
|
||||
<path
|
||||
d="M 10.709612,23.014111 C 16.695555,12.974321 23.623336,3.2976914 25.779115,3.2976914 c 2.197635,0 9.313793,10.2991996 15.320665,20.7021496 5.651063,9.75447 -36.2902985,8.92436 -30.396443,-1.03772 z"
|
||||
id="path3089"
|
||||
style="opacity:0.31999996;fill:url(#SVGID_2_)"
|
||||
inkscape:connector-curvature="0" />
|
||||
</svg>
|
After Width: | Height: | Size: 3.6 KiB |
@ -718,7 +718,7 @@ OP_DFU::Status DFUObject::UploadFirmwareT(const QString &sfile, const bool &veri
|
||||
return OP_DFU::abort;;
|
||||
}
|
||||
|
||||
quint32 crc=CRCFromQBArray(arr,devices[device].SizeOfCode);
|
||||
quint32 crc=DFUObject::CRCFromQBArray(arr,devices[device].SizeOfCode);
|
||||
if (debug)
|
||||
qDebug() << "NEW FIRMWARE CRC=" << crc;
|
||||
|
||||
@ -817,7 +817,7 @@ OP_DFU::Status DFUObject::CompareFirmware(const QString &sfile, const CompareTyp
|
||||
}
|
||||
if(type==OP_DFU::crccompare)
|
||||
{
|
||||
quint32 crc=CRCFromQBArray(arr,devices[device].SizeOfCode);
|
||||
quint32 crc=DFUObject::CRCFromQBArray(arr,devices[device].SizeOfCode);
|
||||
if(crc==devices[device].FW_CRC)
|
||||
{
|
||||
cout<<"Compare Successfull CRC MATCH!\n";
|
||||
@ -971,7 +971,7 @@ quint32 DFUObject::CRCFromQBArray(QByteArray array, quint32 Size)
|
||||
aux+=(char)array[x*4+0]&0xFF;
|
||||
t[x]=aux;
|
||||
}
|
||||
return CRC32WideFast(0xFFFFFFFF,Size/4,(quint32*)t);
|
||||
return DFUObject::CRC32WideFast(0xFFFFFFFF,Size/4,(quint32*)t);
|
||||
}
|
||||
|
||||
|
||||
|
@ -108,7 +108,7 @@ namespace OP_DFU {
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
|
||||
static quint32 CRCFromQBArray(QByteArray array, quint32 Size);
|
||||
//DFUObject(bool debug);
|
||||
DFUObject(bool debug,bool use_serial,QString port);
|
||||
|
||||
@ -152,7 +152,7 @@ namespace OP_DFU {
|
||||
|
||||
// Helper functions:
|
||||
QString StatusToString(OP_DFU::Status const & status);
|
||||
quint32 CRC32WideFast(quint32 Crc, quint32 Size, quint32 *Buffer);
|
||||
static quint32 CRC32WideFast(quint32 Crc, quint32 Size, quint32 *Buffer);
|
||||
|
||||
|
||||
|
||||
@ -179,7 +179,7 @@ namespace OP_DFU {
|
||||
// USB Bootloader:
|
||||
pjrc_rawhid hidHandle;
|
||||
int setStartBit(int command){ return command|0x20; }
|
||||
quint32 CRCFromQBArray(QByteArray array, quint32 Size);
|
||||
|
||||
void CopyWords(char * source, char* destination, int count);
|
||||
void printProgBar( int const & percent,QString const& label);
|
||||
bool StartUpload(qint32 const &numberOfBytes, TransferTypes const & type,quint32 crc);
|
||||
|
@ -25,7 +25,8 @@
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include "runningdevicewidget.h"
|
||||
|
||||
#include "devicedescriptorstruct.h"
|
||||
#include "uploadergadgetwidget.h"
|
||||
runningDeviceWidget::runningDeviceWidget(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
{
|
||||
@ -102,9 +103,12 @@ void runningDeviceWidget::populate()
|
||||
QString serial = utilMngr->getBoardCPUSerial().toHex();
|
||||
myDevice->cpuSerial->setText(serial);
|
||||
|
||||
QString description = utilMngr->getBoardDescription();
|
||||
myDevice->description->setText(description);
|
||||
|
||||
QByteArray description = utilMngr->getBoardDescription();
|
||||
deviceDescriptorStruct devDesc;
|
||||
UploaderGadgetWidget::descriptionToStructure(description,&devDesc);
|
||||
myDevice->description->setText(devDesc.description);
|
||||
myDevice->lblGitTag->setText(QString("Git Tag:")+devDesc.gitTag);
|
||||
myDevice->lblFwDate->setText(QString("FW Build Date:")+devDesc.buildDate);
|
||||
status("Ready...", STATUSICON_INFO);
|
||||
|
||||
}
|
||||
|
@ -29,7 +29,7 @@
|
||||
#define RUNNINGDEVICEWIDGET_H
|
||||
|
||||
#include "ui_runningdevicewidget.h"
|
||||
#include "uploadergadgetwidget.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QErrorMessage>
|
||||
#include <QtSvg/QGraphicsSvgItem>
|
||||
|
@ -16,7 +16,7 @@
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="6" column="0" colspan="2">
|
||||
<item row="8" column="0" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="statusIcon">
|
||||
@ -90,6 +90,20 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="lblGitTag">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="lblFwDate">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -22,7 +22,8 @@ HEADERS += uploadergadget.h \
|
||||
SSP/qssp.h \
|
||||
SSP/qsspt.h \
|
||||
SSP/common.h \
|
||||
runningdevicewidget.h
|
||||
runningdevicewidget.h \
|
||||
devicedescriptorstruct.h
|
||||
SOURCES += uploadergadget.cpp \
|
||||
uploadergadgetconfiguration.cpp \
|
||||
uploadergadgetfactory.cpp \
|
||||
@ -35,7 +36,8 @@ SOURCES += uploadergadget.cpp \
|
||||
SSP/port.cpp \
|
||||
SSP/qssp.cpp \
|
||||
SSP/qsspt.cpp \
|
||||
runningdevicewidget.cpp
|
||||
runningdevicewidget.cpp \
|
||||
devicedescriptorstruct.cpp
|
||||
OTHER_FILES += Uploader.pluginspec
|
||||
|
||||
FORMS += \
|
||||
|
@ -10,5 +10,6 @@
|
||||
<file>images/deviceID-0201.svg</file>
|
||||
<file>images/deviceID-0101.svg</file>
|
||||
<file>images/application-certificate.svg</file>
|
||||
<file>images/warning.svg</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -27,7 +27,44 @@
|
||||
#include "uploadergadgetwidget.h"
|
||||
|
||||
#define DFU_DEBUG true
|
||||
bool UploaderGadgetWidget::descriptionToStructure(QByteArray desc,deviceDescriptorStruct * struc)
|
||||
{
|
||||
if (desc.startsWith("OpFw")) {
|
||||
// This looks like a binary with a description at the end
|
||||
/*
|
||||
# 4 bytes: header: "OpFw"
|
||||
# 4 bytes: GIT commit tag (short version of SHA1)
|
||||
# 4 bytes: Unix timestamp of compile time
|
||||
# 2 bytes: target platform. Should follow same rule as BOARD_TYPE and BOARD_REVISION in board define files.
|
||||
# 26 bytes: commit tag if it is there, otherwise "Unreleased". Zero-padded
|
||||
# ---- 40 bytes limit ---
|
||||
# 20 bytes: SHA1 sum of the firmware.
|
||||
# 40 bytes: free for now.
|
||||
*/
|
||||
|
||||
// Note: the ARM binary is big-endian:
|
||||
quint32 gitCommitTag = desc.at(7)&0xFF;
|
||||
for (int i=1;i<4;i++) {
|
||||
gitCommitTag = gitCommitTag<<8;
|
||||
gitCommitTag += desc.at(7-i) & 0xFF;
|
||||
}
|
||||
struc->gitTag="0x" + QString::number(gitCommitTag,16);
|
||||
quint32 buildDate = desc.at(11)&0xFF;
|
||||
for (int i=1;i<4;i++) {
|
||||
buildDate = buildDate<<8;
|
||||
buildDate += desc.at(11-i) & 0xFF;
|
||||
}
|
||||
struc->buildDate= QDateTime::fromTime_t(buildDate).toString();
|
||||
QByteArray targetPlatform = desc.mid(12,2);
|
||||
// TODO: check platform compatibility
|
||||
QString dscText = QString(desc.mid(14,26));
|
||||
struc->boardType=(int)targetPlatform.at(0);
|
||||
struc->boardRevision=(int)targetPlatform.at(1);
|
||||
struc->description=dscText;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
UploaderGadgetWidget::UploaderGadgetWidget(QWidget *parent) : QWidget(parent)
|
||||
{
|
||||
m_config = new Ui_UploaderWidget();
|
||||
|
@ -52,20 +52,23 @@
|
||||
#include <QThread>
|
||||
#include <QMessageBox>
|
||||
#include <QTimer>
|
||||
|
||||
#include "devicedescriptorstruct.h"
|
||||
#include <QProgressDialog>
|
||||
|
||||
using namespace OP_DFU;
|
||||
|
||||
|
||||
class UploaderGadgetWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
||||
public:
|
||||
UploaderGadgetWidget(QWidget *parent = 0);
|
||||
~UploaderGadgetWidget();
|
||||
typedef enum { IAP_STATE_READY, IAP_STATE_STEP_1, IAP_STATE_STEP_2, IAP_STEP_RESET, IAP_STATE_BOOTLOADER} IAPStep;
|
||||
void log(QString str);
|
||||
static bool descriptionToStructure(QByteArray desc,deviceDescriptorStruct * struc);
|
||||
|
||||
public slots:
|
||||
void onAutopilotConnect();
|
||||
|
Loading…
Reference in New Issue
Block a user