mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-02-20 10:54:14 +01:00
GCS-Made autouploader fetch fw from fw bundle
Fw bundle is built with "make package_resource". This target is a dependency of the package target but needs testing on the different systems. If the bundle is not present the build will not fail and the wizard will jump the autoupdate page (not working FIXME)
This commit is contained in:
parent
f6443fc995
commit
4ef8b78ff8
@ -13,6 +13,8 @@ AutoUpdatePage::AutoUpdatePage(SetupWizard *wizard, QWidget *parent) :
|
|||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
ExtensionSystem::PluginManager *pm=ExtensionSystem::PluginManager::instance();
|
ExtensionSystem::PluginManager *pm=ExtensionSystem::PluginManager::instance();
|
||||||
UploaderGadgetFactory * uploader=pm->getObject<UploaderGadgetFactory>();
|
UploaderGadgetFactory * uploader=pm->getObject<UploaderGadgetFactory>();
|
||||||
|
if(!uploader->isAutoUpdateCapable())
|
||||||
|
wizard->next();//FIXME DOESN'T WORK
|
||||||
connect(ui->startUpdate,SIGNAL(clicked()),uploader,SIGNAL(autoUpdate()));
|
connect(ui->startUpdate,SIGNAL(clicked()),uploader,SIGNAL(autoUpdate()));
|
||||||
connect(uploader,SIGNAL(autoUpdateSignal(uploader::AutoUpdateStep,QVariant)),this,SLOT(updateStatus(uploader::AutoUpdateStep,QVariant)));
|
connect(uploader,SIGNAL(autoUpdateSignal(uploader::AutoUpdateStep,QVariant)),this,SLOT(updateStatus(uploader::AutoUpdateStep,QVariant)));
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
@ -43,6 +43,6 @@ FORMS += \
|
|||||||
|
|
||||||
RESOURCES += \
|
RESOURCES += \
|
||||||
uploader.qrc
|
uploader.qrc
|
||||||
exists( ../../../../build/ground/opfw_resource/opfw_resource.qrc ) {
|
exists( ../../../../../build/ground/opfw_resource/opfw_resource.qrc ) {
|
||||||
\ ../../../../build/ground/opfw_resource/opfw_resource.qrc
|
RESOURCES += ../../../../build/ground/opfw_resource/opfw_resource.qrc
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,4 @@
|
|||||||
<file>images/gcs-board-cc3d.png</file>
|
<file>images/gcs-board-cc3d.png</file>
|
||||||
<file>images/pipx.png</file>
|
<file>images/pipx.png</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
<qresource prefix="/firmware">
|
|
||||||
<file>firmware/fw_coptercontrol.opfw</file>
|
|
||||||
</qresource>
|
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
#include "uploadergadgetwidget.h"
|
#include "uploadergadgetwidget.h"
|
||||||
|
|
||||||
UploaderGadgetFactory::UploaderGadgetFactory(QObject *parent) :
|
UploaderGadgetFactory::UploaderGadgetFactory(QObject *parent) :
|
||||||
IUAVGadgetFactory(QString("Uploader"), tr("Uploader"), parent)
|
IUAVGadgetFactory(QString("Uploader"), tr("Uploader"), parent),isautocapable(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,6 +44,7 @@ UploaderGadgetFactory::~UploaderGadgetFactory()
|
|||||||
Core::IUAVGadget* UploaderGadgetFactory::createGadget(QWidget *parent)
|
Core::IUAVGadget* UploaderGadgetFactory::createGadget(QWidget *parent)
|
||||||
{
|
{
|
||||||
UploaderGadgetWidget* gadgetWidget = new UploaderGadgetWidget(parent);
|
UploaderGadgetWidget* gadgetWidget = new UploaderGadgetWidget(parent);
|
||||||
|
isautocapable=gadgetWidget->autoUpdateCapable();
|
||||||
connect(this,SIGNAL(autoUpdate()),gadgetWidget,SLOT(autoUpdate()));
|
connect(this,SIGNAL(autoUpdate()),gadgetWidget,SLOT(autoUpdate()));
|
||||||
connect(gadgetWidget,SIGNAL(autoUpdateSignal(uploader::AutoUpdateStep,QVariant)),this,SIGNAL(autoUpdateSignal(uploader::AutoUpdateStep,QVariant)));
|
connect(gadgetWidget,SIGNAL(autoUpdateSignal(uploader::AutoUpdateStep,QVariant)),this,SIGNAL(autoUpdateSignal(uploader::AutoUpdateStep,QVariant)));
|
||||||
return new UploaderGadget(QString("Uploader"), gadgetWidget, parent);
|
return new UploaderGadget(QString("Uploader"), gadgetWidget, parent);
|
||||||
@ -53,4 +54,7 @@ IUAVGadgetConfiguration *UploaderGadgetFactory::createConfiguration(QSettings* q
|
|||||||
{
|
{
|
||||||
return new UploaderGadgetConfiguration(QString("Uploader"), qSettings);
|
return new UploaderGadgetConfiguration(QString("Uploader"), qSettings);
|
||||||
}
|
}
|
||||||
|
bool UploaderGadgetFactory::isAutoUpdateCapable()
|
||||||
|
{
|
||||||
|
return isautocapable;
|
||||||
|
}
|
||||||
|
@ -47,6 +47,9 @@ public:
|
|||||||
|
|
||||||
Core::IUAVGadget *createGadget(QWidget *parent);
|
Core::IUAVGadget *createGadget(QWidget *parent);
|
||||||
IUAVGadgetConfiguration *createConfiguration(QSettings* qSettings);
|
IUAVGadgetConfiguration *createConfiguration(QSettings* qSettings);
|
||||||
|
bool isAutoUpdateCapable();
|
||||||
|
private:
|
||||||
|
bool isautocapable;
|
||||||
signals:
|
signals:
|
||||||
void autoUpdateSignal(uploader::AutoUpdateStep,QVariant);
|
void autoUpdateSignal(uploader::AutoUpdateStep,QVariant);
|
||||||
void autoUpdate();
|
void autoUpdate();
|
||||||
|
@ -432,6 +432,11 @@ void UploaderGadgetWidget::commonSystemBoot(bool safeboot)
|
|||||||
delete dfu; // Frees up the USB/Serial port too
|
delete dfu; // Frees up the USB/Serial port too
|
||||||
dfu = NULL;
|
dfu = NULL;
|
||||||
}
|
}
|
||||||
|
bool UploaderGadgetWidget::autoUpdateCapable()
|
||||||
|
{
|
||||||
|
return QFile::exists(":/build/fw_coptercontrol/fw_coptercontrol.opfw");
|
||||||
|
}
|
||||||
|
|
||||||
bool UploaderGadgetWidget::autoUpdate()
|
bool UploaderGadgetWidget::autoUpdate()
|
||||||
{
|
{
|
||||||
Core::ConnectionManager *cm = Core::ICore::instance()->connectionManager();
|
Core::ConnectionManager *cm = Core::ICore::instance()->connectionManager();
|
||||||
@ -495,18 +500,23 @@ bool UploaderGadgetWidget::autoUpdate()
|
|||||||
switch (dfu->devices[0].ID)
|
switch (dfu->devices[0].ID)
|
||||||
{
|
{
|
||||||
case 0x401:
|
case 0x401:
|
||||||
filename="fw_coptercontrol.opfw";
|
filename="fw_coptercontrol";
|
||||||
break;
|
break;
|
||||||
case 0x402:
|
case 0x402:
|
||||||
filename="fw_coptercontrol.opfw";
|
filename="fw_coptercontrol";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
emit autoUpdateSignal(FAILURE,QVariant());
|
emit autoUpdateSignal(FAILURE,QVariant());
|
||||||
return false;
|
return false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
filename=":/firmware/firmware/"+filename;
|
filename=":/build/"+filename+"/"+filename+".opfw";
|
||||||
QByteArray firmware;
|
QByteArray firmware;
|
||||||
|
if(!QFile::exists(filename))
|
||||||
|
{
|
||||||
|
emit autoUpdateSignal(FAILURE,QVariant());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
QFile file(filename);
|
QFile file(filename);
|
||||||
if (!file.open(QIODevice::ReadOnly)) {
|
if (!file.open(QIODevice::ReadOnly)) {
|
||||||
emit autoUpdateSignal(FAILURE,QVariant());
|
emit autoUpdateSignal(FAILURE,QVariant());
|
||||||
|
@ -70,7 +70,7 @@ public:
|
|||||||
UploaderGadgetWidget(QWidget *parent = 0);
|
UploaderGadgetWidget(QWidget *parent = 0);
|
||||||
~UploaderGadgetWidget();
|
~UploaderGadgetWidget();
|
||||||
void log(QString str);
|
void log(QString str);
|
||||||
|
bool autoUpdateCapable();
|
||||||
public slots:
|
public slots:
|
||||||
void onAutopilotConnect();
|
void onAutopilotConnect();
|
||||||
void onAutopilotDisconnect();
|
void onAutopilotDisconnect();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user