1
0
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:
PT_Dreamer 2012-10-06 01:41:50 +01:00
parent 2c4f50c4f5
commit 5d24bc55a6
8 changed files with 252 additions and 4 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -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>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:10pt;&quot;&gt;please disconnect all fucking boards press the fucking button and follow instructions.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</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>

View File

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

View File

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

View File

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