mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-12-02 10:24:11 +01:00
OP-893 Added Auto Update functionality to the firmware page.
This commit is contained in:
parent
649667d338
commit
864300d975
@ -77,7 +77,7 @@ void AutoUpdatePage::updateStatus(uploader::AutoUpdateStep status, QVariant valu
|
||||
getWizard()->setWindowIcon(qApp->windowIcon());
|
||||
enableButtons(true);
|
||||
getWizard()->show();
|
||||
ui->statusLabel->setText("Something went wrong, you will have to manualy upgrade the board using the uploader plugin");
|
||||
ui->statusLabel->setText("Something went wrong, you will have to manually upgrade the board using the uploader plugin");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -7,15 +7,67 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>822</width>
|
||||
<height>350</height>
|
||||
<height>523</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>804</width>
|
||||
<height>505</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QFrame" name="buttonFrame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="autoUpdateButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Start a guided procedure to manually
|
||||
recover a system which does not boot.
|
||||
|
||||
Rescue is possible in USB mode only.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Auto Update</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="haltButton">
|
||||
<property name="enabled">
|
||||
@ -32,6 +84,21 @@ through serial or USB)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="resetButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Reset the system.
|
||||
(Only enabled if telemetry link is established, either
|
||||
through serial or USB)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Reset</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="bootButton">
|
||||
<property name="enabled">
|
||||
@ -68,34 +135,6 @@ menu on the right.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="eraseBootButton">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Reboot the board and clear its settings memory.</p><p> Useful if the board cannot boot properly.</p><p> Blue led starts blinking quick for 20-30 seconds than the board will start normally</p><p><br/></p><p>If telemetry is not running, select the link using the dropdown</p><p>menu on the right.</p><p>PLEASE NOTE: Supported with bootloader versions 4.0 and earlier</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Erase settings</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="resetButton">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Reset the system.
|
||||
(Only enabled if telemetry link is established, either
|
||||
through serial or USB)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Reset</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="rescueButton">
|
||||
<property name="toolTip">
|
||||
@ -109,6 +148,19 @@ Rescue is possible in USB mode only.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="eraseBootButton">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p>Reboot the board and clear its settings memory.</p><p> Useful if the board cannot boot properly.</p><p> Blue led starts blinking quick for 20-30 seconds than the board will start normally</p><p><br/></p><p>If telemetry is not running, select the link using the dropdown</p><p>menu on the right.</p><p>PLEASE NOTE: Supported with bootloader versions 4.0 and earlier</p></body></html></string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Erase settings</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
@ -124,6 +176,12 @@ Rescue is possible in USB mode only.</string>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="telemetryLink">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>When telemetry is not connected, select the communication
|
||||
method using this combo box.
|
||||
@ -179,6 +237,42 @@ halting a running board.</string>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="autoUpdateGroupBox">
|
||||
<property name="title">
|
||||
<string>Auto update</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="1">
|
||||
<widget class="QPushButton" name="autoUpdateOkButton">
|
||||
<property name="text">
|
||||
<string>OK</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QProgressBar" name="autoUpdateProgressBar">
|
||||
<property name="value">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="textVisible">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QLabel" name="autoUpdateLabel">
|
||||
<property name="text">
|
||||
<string>Progress</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSplitter" name="splitter">
|
||||
<property name="orientation">
|
||||
@ -200,7 +294,10 @@ halting a running board.</string>
|
||||
<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, proceed as follows:</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;">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>
|
||||
@ -229,6 +326,10 @@ p, li { white-space: pre-wrap; }
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../coreplugin/core.qrc"/>
|
||||
</resources>
|
||||
|
@ -60,6 +60,11 @@ UploaderGadgetWidget::UploaderGadgetWidget(QWidget *parent) : QWidget(parent)
|
||||
connect(cm, SIGNAL(deviceConnected(QIODevice *)), this, SLOT(onPhisicalHWConnect()));
|
||||
getSerialPorts();
|
||||
|
||||
m_config->autoUpdateButton->setEnabled(autoUpdateCapable());
|
||||
connect(m_config->autoUpdateButton, SIGNAL(clicked()), this, SLOT(startAutoUpdate()));
|
||||
connect(m_config->autoUpdateOkButton, SIGNAL(clicked()), this, SLOT(closeAutoUpdate()));
|
||||
m_config->autoUpdateGroupBox->setVisible(false);
|
||||
|
||||
QIcon rbi;
|
||||
rbi.addFile(QString(":uploader/images/view-refresh.svg"));
|
||||
m_config->refreshPorts->setIcon(rbi);
|
||||
@ -816,6 +821,68 @@ void UploaderGadgetWidget::downloadEnded(bool succeed)
|
||||
m_config->rescueButton->setEnabled(true);
|
||||
}
|
||||
|
||||
void UploaderGadgetWidget::startAutoUpdate()
|
||||
{
|
||||
m_config->buttonFrame->setEnabled(false);
|
||||
m_config->splitter->setEnabled(false);
|
||||
m_config->autoUpdateGroupBox->setVisible(true);
|
||||
m_config->autoUpdateOkButton->setEnabled(false);
|
||||
connect(this, SIGNAL(autoUpdateSignal(uploader::AutoUpdateStep, QVariant)), this, SLOT(autoUpdateStatus(uploader::AutoUpdateStep, QVariant)));
|
||||
autoUpdate();
|
||||
}
|
||||
|
||||
void UploaderGadgetWidget::finishAutoUpdate()
|
||||
{
|
||||
disconnect(this, SIGNAL(autoUpdateSignal(uploader::AutoUpdateStep, QVariant)), this, SLOT(autoUpdateStatus(uploader::AutoUpdateStep, QVariant)));
|
||||
m_config->autoUpdateOkButton->setEnabled(true);
|
||||
}
|
||||
|
||||
void UploaderGadgetWidget::closeAutoUpdate()
|
||||
{
|
||||
m_config->autoUpdateGroupBox->setVisible(false);
|
||||
m_config->buttonFrame->setEnabled(true);
|
||||
m_config->splitter->setEnabled(true);
|
||||
}
|
||||
|
||||
void UploaderGadgetWidget::autoUpdateStatus(uploader::AutoUpdateStep status, QVariant value)
|
||||
{
|
||||
switch(status)
|
||||
{
|
||||
case uploader::WAITING_DISCONNECT:
|
||||
m_config->autoUpdateLabel->setText("Waiting for all OpenPilot boards to be disconnected from USB.");
|
||||
break;
|
||||
case uploader::WAITING_CONNECT:
|
||||
m_config->autoUpdateLabel->setText("Please connect the OpenPilot board to the USB port.");
|
||||
m_config->autoUpdateProgressBar->setValue(value.toInt());
|
||||
break;
|
||||
case uploader::JUMP_TO_BL:
|
||||
m_config->autoUpdateProgressBar->setValue(0);
|
||||
m_config->autoUpdateLabel->setText("Bringing the board into boot loader mode.");
|
||||
break;
|
||||
case uploader::LOADING_FW:
|
||||
m_config->autoUpdateLabel->setText("Preparing to upload firmware to the board.");
|
||||
break;
|
||||
case uploader::UPLOADING_FW:
|
||||
m_config->autoUpdateLabel->setText("Uploading firmware to the board.");
|
||||
m_config->autoUpdateProgressBar->setValue(value.toInt());
|
||||
break;
|
||||
case uploader::UPLOADING_DESC:
|
||||
m_config->autoUpdateLabel->setText("Uploading description of the new firmware to the board.");
|
||||
break;
|
||||
case uploader::BOOTING:
|
||||
m_config->autoUpdateLabel->setText("Rebooting the board.");
|
||||
break;
|
||||
case uploader::SUCCESS:
|
||||
m_config->autoUpdateLabel->setText("<font color='green'>Board was updated successfully, press OK to finish.</font>");
|
||||
finishAutoUpdate();
|
||||
break;
|
||||
case uploader::FAILURE:
|
||||
m_config->autoUpdateLabel->setText("<font color='red'>Something went wrong, you will have to manually upgrade the board. Press OK to continue.</font>");
|
||||
finishAutoUpdate();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Update log entry
|
||||
*/
|
||||
|
@ -118,6 +118,11 @@ private slots:
|
||||
void uploadEnded(bool succeed);
|
||||
void downloadStarted();
|
||||
void downloadEnded(bool succeed);
|
||||
void startAutoUpdate();
|
||||
void finishAutoUpdate();
|
||||
void closeAutoUpdate();
|
||||
void autoUpdateStatus(uploader::AutoUpdateStep status, QVariant value);
|
||||
|
||||
};
|
||||
|
||||
#endif // UPLOADERGADGETWIDGET_H
|
||||
|
Loading…
Reference in New Issue
Block a user