mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-01 09:24:10 +01:00
GCS-Created wizard firmware autoupdate page
This commit is contained in:
parent
2c4f50c4f5
commit
5d24bc55a6
@ -228,6 +228,7 @@ plugin_setupwizard.subdir = setupwizard
|
||||
plugin_setupwizard.depends = plugin_coreplugin
|
||||
plugin_setupwizard.depends += plugin_uavobjects
|
||||
plugin_setupwizard.depends += plugin_config
|
||||
plugin_setupwizard.depends += plugin_uploader
|
||||
SUBDIRS += plugin_setupwizard
|
||||
|
||||
# Junsi Powerlog plugin
|
||||
|
@ -8,5 +8,6 @@
|
||||
<dependency name="Core" version="1.0.0"/>
|
||||
<dependency name="Config" version="1.0.0"/>
|
||||
<dependency name="UAVObjects" version="1.0.0"/>
|
||||
<dependency name="Uploader" version="1.0.0"/>
|
||||
</dependencyList>
|
||||
</plugin>
|
||||
|
@ -0,0 +1,60 @@
|
||||
#include "autoupdatepage.h"
|
||||
#include "ui_autoupdatepage.h"
|
||||
#include "setupwizard.h"
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <uavobjectutil/uavobjectutilmanager.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include "uploader/uploadergadgetfactory.h"
|
||||
|
||||
AutoUpdatePage::AutoUpdatePage(SetupWizard *wizard, QWidget *parent) :
|
||||
AbstractWizardPage(wizard, parent),
|
||||
ui(new Ui::AutoUpdatePage)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ExtensionSystem::PluginManager *pm=ExtensionSystem::PluginManager::instance();
|
||||
UploaderGadgetFactory * uploader=pm->getObject<UploaderGadgetFactory>();
|
||||
connect(ui->startUpdate,SIGNAL(clicked()),uploader,SIGNAL(autoUpdate()));
|
||||
connect(uploader,SIGNAL(autoUpdateSignal(uploader::AutoUpdateStep,QVariant)),this,SLOT(updateStatus(uploader::AutoUpdateStep,QVariant)));
|
||||
}
|
||||
|
||||
AutoUpdatePage::~AutoUpdatePage()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void AutoUpdatePage::updateStatus(uploader::AutoUpdateStep status, QVariant value)
|
||||
{
|
||||
switch(status)
|
||||
{
|
||||
case uploader::WAITING_DISCONNECT:
|
||||
ui->statusLabel->setText("Waiting for all OP boards to be disconnected");
|
||||
break;
|
||||
case uploader::WAITING_CONNECT:
|
||||
ui->statusLabel->setText("Please connect the board to the USB port (don't use external supply)");
|
||||
ui->levellinProgressBar->setValue(value.toInt());
|
||||
break;
|
||||
case uploader::JUMP_TO_BL:
|
||||
ui->levellinProgressBar->setValue(0);
|
||||
ui->statusLabel->setText("Board going into bootloader mode");
|
||||
break;
|
||||
case uploader::LOADING_FW:
|
||||
ui->statusLabel->setText("Loading firmware");
|
||||
break;
|
||||
case uploader::UPLOADING_FW:
|
||||
ui->statusLabel->setText("Uploading firmware");
|
||||
ui->levellinProgressBar->setValue(value.toInt());
|
||||
break;
|
||||
case uploader::UPLOADING_DESC:
|
||||
ui->statusLabel->setText("Uploading description");
|
||||
break;
|
||||
case uploader::BOOTING:
|
||||
ui->statusLabel->setText("Booting the board");
|
||||
break;
|
||||
case uploader::SUCCESS:
|
||||
ui->statusLabel->setText("Board Updated");
|
||||
break;
|
||||
case uploader::FAILURE:
|
||||
ui->statusLabel->setText("Something went wrong, you will have to manualy upgrade the board using the uploader plugin");
|
||||
break;
|
||||
}
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
/**
|
||||
******************************************************************************
|
||||
*
|
||||
* @file autoupdatepage.h
|
||||
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2012.
|
||||
* @addtogroup
|
||||
* @{
|
||||
* @addtogroup AutoUpdatePage
|
||||
* @{
|
||||
* @brief
|
||||
*****************************************************************************/
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef AUTOUPDATEPAGE_H
|
||||
#define AUTOUPDATEPAGE_H
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/connectionmanager.h>
|
||||
#include "setupwizard.h"
|
||||
#include "uavtalk/telemetrymanager.h"
|
||||
#include "abstractwizardpage.h"
|
||||
#include "uploader/enums.h"
|
||||
|
||||
namespace Ui {
|
||||
class AutoUpdatePage;
|
||||
}
|
||||
|
||||
class AutoUpdatePage : public AbstractWizardPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AutoUpdatePage(SetupWizard *wizard, QWidget *parent = 0);
|
||||
~AutoUpdatePage();
|
||||
|
||||
private slots:
|
||||
void updateStatus(uploader::AutoUpdateStep ,QVariant);
|
||||
|
||||
private:
|
||||
Ui::AutoUpdatePage *ui;
|
||||
};
|
||||
|
||||
#endif // AUTOUPDATEPAGE_H
|
@ -0,0 +1,121 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AutoUpdatePage</class>
|
||||
<widget class="QWizardPage" name="AutoUpdatePage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>600</width>
|
||||
<height>400</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>WizardPage</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;">
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:10pt;">please disconnect all fucking boards press the fucking button and follow instructions.</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QToolButton" name="startUpdate">
|
||||
<property name="toolTip">
|
||||
<string>Calculate gyro and accelerometer bias</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QToolButton { border: none }</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Calculate</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../wizardResources.qrc">
|
||||
<normaloff>:/setupwizard/resources/bttn-calculate-up.png</normaloff>
|
||||
<normalon>:/setupwizard/resources/bttn-calculate-down.png</normalon>:/setupwizard/resources/bttn-calculate-up.png</iconset>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>70</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="statusLabel">
|
||||
<property name="text">
|
||||
<string>Hidle</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QProgressBar" name="levellinProgressBar">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QProgressBar {
|
||||
border: 2px solid grey;
|
||||
border-radius: 5px;
|
||||
text-align: center;
|
||||
}
|
||||
QProgressBar::chunk {
|
||||
background-color: #3D6699;
|
||||
width: 10px;
|
||||
margin: 0.5px;
|
||||
}</string>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="format">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="progressLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../wizardResources.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
@ -45,6 +45,7 @@
|
||||
#include "extensionsystem/pluginmanager.h"
|
||||
#include "vehicleconfigurationhelper.h"
|
||||
#include "actuatorsettings.h"
|
||||
#include "pages/autoupdatepage.h"
|
||||
|
||||
SetupWizard::SetupWizard(QWidget *parent) : QWizard(parent), VehicleConfigurationSource(),
|
||||
m_controllerType(CONTROLLER_UNKNOWN),
|
||||
@ -66,6 +67,8 @@ int SetupWizard::nextId() const
|
||||
{
|
||||
switch (currentId()) {
|
||||
case PAGE_START:
|
||||
return PAGE_UPDATE;
|
||||
case PAGE_UPDATE:
|
||||
return PAGE_CONTROLLER;
|
||||
case PAGE_CONTROLLER: {
|
||||
switch(getControllerType())
|
||||
@ -257,6 +260,7 @@ QString SetupWizard::getSummaryText()
|
||||
void SetupWizard::createPages()
|
||||
{
|
||||
setPage(PAGE_START, new StartPage(this));
|
||||
setPage(PAGE_UPDATE, new AutoUpdatePage(this));
|
||||
setPage(PAGE_CONTROLLER, new ControllerPage(this));
|
||||
setPage(PAGE_VEHICLES, new VehiclePage(this));
|
||||
setPage(PAGE_MULTI, new MultiPage(this));
|
||||
|
@ -85,7 +85,7 @@ private slots:
|
||||
private:
|
||||
enum {PAGE_START, PAGE_CONTROLLER, PAGE_VEHICLES, PAGE_MULTI, PAGE_FIXEDWING,
|
||||
PAGE_HELI, PAGE_SURFACE, PAGE_INPUT, PAGE_OUTPUT, PAGE_LEVELLING, PAGE_CALIBRATION,
|
||||
PAGE_SAVE, PAGE_SUMMARY, PAGE_NOTYETIMPLEMENTED, PAGE_REBOOT, PAGE_END};
|
||||
PAGE_SAVE, PAGE_SUMMARY, PAGE_NOTYETIMPLEMENTED, PAGE_REBOOT, PAGE_END, PAGE_UPDATE};
|
||||
void createPages();
|
||||
bool saveHardwareSettings() const;
|
||||
|
||||
|
@ -7,6 +7,7 @@ include(../../openpilotgcsplugin.pri)
|
||||
include(../../plugins/coreplugin/coreplugin.pri)
|
||||
include(../../plugins/uavobjectutil/uavobjectutil.pri)
|
||||
include(../../plugins/config/config.pri)
|
||||
include(../../plugins/uploader/uploader.pri)
|
||||
|
||||
HEADERS += setupwizardplugin.h \
|
||||
setupwizard.h \
|
||||
@ -31,7 +32,8 @@ HEADERS += setupwizardplugin.h \
|
||||
pages/outputcalibrationpage.h \
|
||||
outputcalibrationutil.h \
|
||||
pages/rebootpage.h \
|
||||
pages/savepage.h
|
||||
pages/savepage.h \
|
||||
pages/autoupdatepage.h
|
||||
|
||||
SOURCES += setupwizardplugin.cpp \
|
||||
setupwizard.cpp \
|
||||
@ -56,7 +58,8 @@ SOURCES += setupwizardplugin.cpp \
|
||||
pages/outputcalibrationpage.cpp \
|
||||
outputcalibrationutil.cpp \
|
||||
pages/rebootpage.cpp \
|
||||
pages/savepage.cpp
|
||||
pages/savepage.cpp \
|
||||
pages/autoupdatepage.cpp
|
||||
|
||||
OTHER_FILES += SetupWizard.pluginspec
|
||||
|
||||
@ -77,7 +80,8 @@ FORMS += \
|
||||
connectiondiagram.ui \
|
||||
pages/outputcalibrationpage.ui \
|
||||
pages/rebootpage.ui \
|
||||
pages/savepage.ui
|
||||
pages/savepage.ui \
|
||||
pages/autoupdatepage.ui
|
||||
|
||||
RESOURCES += \
|
||||
wizardResources.qrc
|
||||
|
Loading…
Reference in New Issue
Block a user