mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-15 07:29:15 +01:00
OP-1629 Added option to erase when autoupdating formware.
Option added to Wizard and Uploader plugin.
This commit is contained in:
parent
da0c3917c1
commit
57beb3d36c
@ -16,7 +16,7 @@ AutoUpdatePage::AutoUpdatePage(SetupWizard *wizard, QWidget *parent) :
|
||||
UploaderGadgetFactory *uploader = pm->getObject<UploaderGadgetFactory>();
|
||||
Q_ASSERT(uploader);
|
||||
connect(ui->startUpdate, SIGNAL(clicked()), this, SLOT(disableButtons()));
|
||||
connect(ui->startUpdate, SIGNAL(clicked()), uploader, SIGNAL(autoUpdate()));
|
||||
connect(ui->startUpdate, SIGNAL(clicked()), this, SLOT(autoUpdate()));
|
||||
connect(uploader, SIGNAL(autoUpdateSignal(uploader::AutoUpdateStep, QVariant)), this, SLOT(updateStatus(uploader::AutoUpdateStep, QVariant)));
|
||||
}
|
||||
|
||||
@ -35,6 +35,15 @@ void AutoUpdatePage::enableButtons(bool enable = false)
|
||||
QApplication::processEvents();
|
||||
}
|
||||
|
||||
void AutoUpdatePage::autoUpdate()
|
||||
{
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
Q_ASSERT(pm);
|
||||
UploaderGadgetFactory *uploader = pm->getObject<UploaderGadgetFactory>();
|
||||
Q_ASSERT(uploader);
|
||||
uploader->autoUpdate(ui->eraseSettings->isChecked());
|
||||
}
|
||||
|
||||
void AutoUpdatePage::updateStatus(uploader::AutoUpdateStep status, QVariant value)
|
||||
{
|
||||
QString msg;
|
||||
@ -48,16 +57,6 @@ void AutoUpdatePage::updateStatus(uploader::AutoUpdateStep status, QVariant valu
|
||||
ui->levellinProgressBar->setValue(value.toInt());
|
||||
break;
|
||||
case uploader::WAITING_CONNECT:
|
||||
// Note:
|
||||
// the following commented out lines were probably added to fix an issue when uploader opened a popup requesting
|
||||
// user to disconnect all boards
|
||||
// Side effect is that the wizard dialog flickers
|
||||
// the uploader was changed to avoid popups alltogether and that fix is not need anymore
|
||||
// same commented fix can be found in FAILURE case and they are kept for future ref.
|
||||
// getWizard()->setWindowFlags(getWizard()->windowFlags() | Qt::WindowStaysOnTopHint);
|
||||
// getWizard()->setWindowIcon(qApp->windowIcon());
|
||||
// getWizard()->show();
|
||||
// End of Note
|
||||
disableButtons();
|
||||
ui->statusLabel->setText(tr("Please connect the board to the USB port (don't use external supply)."));
|
||||
// TODO get rid of magic number 20s (should use UploaderGadgetWidget::BOARD_EVENT_TIMEOUT)
|
||||
@ -65,7 +64,8 @@ void AutoUpdatePage::updateStatus(uploader::AutoUpdateStep status, QVariant valu
|
||||
ui->levellinProgressBar->setValue(value.toInt());
|
||||
break;
|
||||
case uploader::JUMP_TO_BL:
|
||||
ui->levellinProgressBar->setValue(0);
|
||||
ui->levellinProgressBar->setValue(value.toInt());
|
||||
ui->levellinProgressBar->setMaximum(5);
|
||||
ui->statusLabel->setText(tr("Board going into bootloader mode."));
|
||||
break;
|
||||
case uploader::LOADING_FW:
|
||||
@ -87,8 +87,6 @@ void AutoUpdatePage::updateStatus(uploader::AutoUpdateStep status, QVariant valu
|
||||
ui->statusLabel->setText(tr("Board updated, please press 'Next' to continue."));
|
||||
break;
|
||||
case uploader::FAILURE:
|
||||
// getWizard()->setWindowFlags(getWizard()->windowFlags() | Qt::WindowStaysOnTopHint);
|
||||
// getWizard()->setWindowIcon(qApp->windowIcon());
|
||||
enableButtons(true);
|
||||
QString msg = value.toString();
|
||||
if (msg.isEmpty()) {
|
||||
|
@ -52,6 +52,7 @@ private slots:
|
||||
enableButtons(false);
|
||||
}
|
||||
void enableButtons(bool enable);
|
||||
void autoUpdate();
|
||||
|
||||
private:
|
||||
Ui::AutoUpdatePage *ui;
|
||||
|
@ -20,13 +20,11 @@
|
||||
<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:'Cantarell'; font-size:11pt; font-weight:400; font-style:normal;">
|
||||
</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;">
|
||||
<p align="center" style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:12pt; font-weight:600;">Firmware Update</span></p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:10pt;">It is necessary that your firmware and ground control software are the same version.</span></p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:10pt;">To update your firmware to the correct version now:</span></p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:10pt;">- Unplug all batteries and USB from OpenPilot</span></p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:10pt;">- Ensure your board is powered down &amp; no LED's are active.</span></p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:10pt;">When you are ready you can start the upgrade below by pushing the button and follow the onscreen prompts, it is critical that nothing disturbs the board while the firmware is being written.</span></p></body></html></string>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:10pt;">When you are ready you can start the upgrade below by pushing the button. It is critical that nothing disturbs the board while the firmware is being written.</span></p>
|
||||
<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'MS Shell Dlg 2'; font-size:10pt;">It is recommended that you erase all settings on the board when upgrading firmware. Using saved settings for a previous version of the firmware </span><span style=" font-family:'MS Shell Dlg 2'; font-size:10pt; font-weight:600;">may result in undefined behaviour</span><span style=" font-family:'MS Shell Dlg 2'; font-size:10pt;"> and in worst case danger. It is possible to suppress the erase by deselecting the check box below.</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
@ -49,6 +47,16 @@ p, li { white-space: pre-wrap; }
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item alignment="Qt::AlignHCenter">
|
||||
<widget class="QCheckBox" name="eraseSettings">
|
||||
<property name="text">
|
||||
<string>Erase all settings</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
|
@ -70,7 +70,7 @@
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="horizontalSpacing">
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="3" colspan="2">
|
||||
@ -268,6 +268,16 @@ Rescue is possible in USB mode only.</string>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="autoUpdateEraseButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Auto Update && Erase</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
@ -326,17 +336,17 @@ Rescue is possible in USB mode only.</string>
|
||||
<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:'MS Shell Dlg 2'; font-size:8.25pt; 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:'Ubuntu'; font-size:11pt;">To upgrade the firmware in your boards,</span></p>
|
||||
<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:'Ubuntu'; font-size:11pt;">press Auto Update and follow instructions</span></p>
|
||||
<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:'Ubuntu'; font-size:11pt;">or</span></p>
|
||||
<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:'Ubuntu'; font-size:11pt;">proceed as follows:</span></p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt;"><br /></p>
|
||||
<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:'Ubuntu'; font-size:11pt;">- Connect telemetry</span></p>
|
||||
<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:'Ubuntu'; font-size:11pt;">- Once telemetry is running, press &quot;Halt&quot; above</span></p>
|
||||
<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:'Ubuntu'; font-size:11pt;">- You will get a list of devices.</span></p>
|
||||
<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:'Ubuntu'; font-size:11pt;">- You can then upload/download to/from each board as you wish</span></p>
|
||||
<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:'Ubuntu'; font-size:11pt;">- You can resume operations by pressing &quot;Boot&quot;</span></p></body></html></string>
|
||||
</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;">To upgrade the firmware in your boards,</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">press Auto Update and follow instructions</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">or</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">proceed as follows:</p>
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">- Connect telemetry</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">- Once telemetry is running, press &quot;Halt&quot; above</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">- You will get a list of devices.</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">- You can then upload/download to/from each board as you wish</p>
|
||||
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">- You can resume operations by pressing &quot;Boot&quot;</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -351,8 +361,8 @@ p, li { white-space: pre-wrap; }
|
||||
<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:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt;"><br /></p></body></html></string>
|
||||
</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;">
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
|
@ -44,7 +44,7 @@ Core::IUAVGadget *UploaderGadgetFactory::createGadget(QWidget *parent)
|
||||
UploaderGadgetWidget *gadgetWidget = new UploaderGadgetWidget(parent);
|
||||
|
||||
isautocapable = gadgetWidget->autoUpdateCapable();
|
||||
connect(this, SIGNAL(autoUpdate()), gadgetWidget, SLOT(autoUpdate()));
|
||||
connect(this, SIGNAL(autoUpdate(bool)), gadgetWidget, SLOT(autoUpdate(bool)));
|
||||
connect(gadgetWidget, SIGNAL(autoUpdateSignal(uploader::AutoUpdateStep, QVariant)), this, SIGNAL(autoUpdateSignal(uploader::AutoUpdateStep, QVariant)));
|
||||
return new UploaderGadget(QString("Uploader"), gadgetWidget, parent);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ private:
|
||||
bool isautocapable;
|
||||
signals:
|
||||
void autoUpdateSignal(uploader::AutoUpdateStep, QVariant);
|
||||
void autoUpdate();
|
||||
void autoUpdate(bool erase);
|
||||
};
|
||||
|
||||
#endif // UPLOADERGADGETFACTORY_H
|
||||
|
@ -157,8 +157,10 @@ UploaderGadgetWidget::UploaderGadgetWidget(QWidget *parent) : QWidget(parent)
|
||||
getSerialPorts();
|
||||
|
||||
connect(m_config->autoUpdateButton, SIGNAL(clicked()), this, SLOT(startAutoUpdate()));
|
||||
connect(m_config->autoUpdateEraseButton, SIGNAL(clicked()), this, SLOT(startAutoUpdateErase()));
|
||||
connect(m_config->autoUpdateOkButton, SIGNAL(clicked()), this, SLOT(closeAutoUpdate()));
|
||||
m_config->autoUpdateButton->setEnabled(autoUpdateCapable());
|
||||
m_config->autoUpdateEraseButton->setEnabled(autoUpdateCapable());
|
||||
m_config->autoUpdateGroupBox->setVisible(false);
|
||||
|
||||
m_config->refreshPorts->setIcon(QIcon(":uploader/images/view-refresh.svg"));
|
||||
@ -606,7 +608,7 @@ bool UploaderGadgetWidget::autoUpdateCapable()
|
||||
return QDir(":/firmware").exists();
|
||||
}
|
||||
|
||||
bool UploaderGadgetWidget::autoUpdate()
|
||||
bool UploaderGadgetWidget::autoUpdate(bool erase)
|
||||
{
|
||||
goToBootloader();
|
||||
|
||||
@ -705,7 +707,7 @@ bool UploaderGadgetWidget::autoUpdate()
|
||||
emit autoUpdateSignal(FAILURE, QVariant());
|
||||
return false;
|
||||
}
|
||||
systemBoot();
|
||||
commonSystemBoot(false, erase);
|
||||
emit autoUpdateSignal(SUCCESS, QVariant());
|
||||
return true;
|
||||
}
|
||||
@ -876,6 +878,16 @@ void UploaderGadgetWidget::downloadEnded(bool succeed)
|
||||
}
|
||||
|
||||
void UploaderGadgetWidget::startAutoUpdate()
|
||||
{
|
||||
startAutoUpdate(false);
|
||||
}
|
||||
|
||||
void UploaderGadgetWidget::startAutoUpdateErase()
|
||||
{
|
||||
startAutoUpdate(true);
|
||||
}
|
||||
|
||||
void UploaderGadgetWidget::startAutoUpdate(bool erase)
|
||||
{
|
||||
m_config->autoUpdateProgressBar->setValue(0);
|
||||
autoUpdateStatus(uploader::JUMP_TO_BL, QVariant());
|
||||
@ -885,7 +897,7 @@ void UploaderGadgetWidget::startAutoUpdate()
|
||||
m_config->autoUpdateOkButton->setEnabled(false);
|
||||
|
||||
connect(this, SIGNAL(autoUpdateSignal(uploader::AutoUpdateStep, QVariant)), this, SLOT(autoUpdateStatus(uploader::AutoUpdateStep, QVariant)));
|
||||
autoUpdate();
|
||||
autoUpdate(erase);
|
||||
}
|
||||
|
||||
void UploaderGadgetWidget::finishAutoUpdate()
|
||||
|
@ -109,7 +109,6 @@ public slots:
|
||||
void onAutopilotDisconnect();
|
||||
void populate();
|
||||
void openHelp();
|
||||
bool autoUpdate();
|
||||
void autoUpdateDisconnectProgress(int);
|
||||
void autoUpdateConnectProgress(int);
|
||||
void autoUpdateFlashProgress(int);
|
||||
@ -133,6 +132,7 @@ private:
|
||||
int confirmEraseSettingsMessageBox();
|
||||
int cannotHaltMessageBox();
|
||||
int cannotResetMessageBox();
|
||||
void startAutoUpdate(bool erase);
|
||||
|
||||
private slots:
|
||||
void onPhysicalHWConnect();
|
||||
@ -150,6 +150,8 @@ private slots:
|
||||
void downloadStarted();
|
||||
void downloadEnded(bool succeed);
|
||||
void startAutoUpdate();
|
||||
void startAutoUpdateErase();
|
||||
bool autoUpdate(bool erase);
|
||||
void finishAutoUpdate();
|
||||
void closeAutoUpdate();
|
||||
void autoUpdateStatus(uploader::AutoUpdateStep status, QVariant value);
|
||||
|
Loading…
x
Reference in New Issue
Block a user