diff --git a/ground/openpilotgcs/src/plugins/plugins.pro b/ground/openpilotgcs/src/plugins/plugins.pro index a1653cf53..e2c70c5b7 100644 --- a/ground/openpilotgcs/src/plugins/plugins.pro +++ b/ground/openpilotgcs/src/plugins/plugins.pro @@ -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 diff --git a/ground/openpilotgcs/src/plugins/setupwizard/SetupWizard.pluginspec b/ground/openpilotgcs/src/plugins/setupwizard/SetupWizard.pluginspec index 8aa610ec8..693a224bb 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/SetupWizard.pluginspec +++ b/ground/openpilotgcs/src/plugins/setupwizard/SetupWizard.pluginspec @@ -8,5 +8,6 @@ + diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/autoupdatepage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/autoupdatepage.cpp new file mode 100644 index 000000000..f950c7ee5 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/autoupdatepage.cpp @@ -0,0 +1,60 @@ +#include "autoupdatepage.h" +#include "ui_autoupdatepage.h" +#include "setupwizard.h" +#include +#include +#include +#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(); + 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; + } +} diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/autoupdatepage.h b/ground/openpilotgcs/src/plugins/setupwizard/pages/autoupdatepage.h new file mode 100644 index 000000000..3e0e8143f --- /dev/null +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/autoupdatepage.h @@ -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 +#include +#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 diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/autoupdatepage.ui b/ground/openpilotgcs/src/plugins/setupwizard/pages/autoupdatepage.ui new file mode 100644 index 000000000..d3a3f22c2 --- /dev/null +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/autoupdatepage.ui @@ -0,0 +1,121 @@ + + + AutoUpdatePage + + + + 0 + 0 + 600 + 400 + + + + WizardPage + + + + + + <!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> + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + true + + + + + + + + + Calculate gyro and accelerometer bias + + + QToolButton { border: none } + + + Calculate + + + + :/setupwizard/resources/bttn-calculate-up.png + :/setupwizard/resources/bttn-calculate-down.png:/setupwizard/resources/bttn-calculate-up.png + + + + 200 + 70 + + + + + + + + + + + + Hidle + + + + + + + QProgressBar { + border: 2px solid grey; + border-radius: 5px; + text-align: center; + } +QProgressBar::chunk { + background-color: #3D6699; + width: 10px; + margin: 0.5px; + } + + + 0 + + + + + + + + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + diff --git a/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp b/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp index fd3b2a083..b18c491b2 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.cpp @@ -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)); diff --git a/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.h b/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.h index c6cf7e1ae..4e1dcbfd2 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.h +++ b/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.h @@ -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; diff --git a/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.pro b/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.pro index 6d336a888..321e9ef8c 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.pro +++ b/ground/openpilotgcs/src/plugins/setupwizard/setupwizard.pro @@ -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