diff --git a/ground/openpilotgcs/src/plugins/setupwizard/pages/autoupdatepage.cpp b/ground/openpilotgcs/src/plugins/setupwizard/pages/autoupdatepage.cpp index 6506fde34..ca67102fa 100644 --- a/ground/openpilotgcs/src/plugins/setupwizard/pages/autoupdatepage.cpp +++ b/ground/openpilotgcs/src/plugins/setupwizard/pages/autoupdatepage.cpp @@ -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; } } diff --git a/ground/openpilotgcs/src/plugins/uploader/uploader.ui b/ground/openpilotgcs/src/plugins/uploader/uploader.ui index 3a8d21c8a..253d579b3 100644 --- a/ground/openpilotgcs/src/plugins/uploader/uploader.ui +++ b/ground/openpilotgcs/src/plugins/uploader/uploader.ui @@ -7,7 +7,7 @@ 0 0 822 - 350 + 523 @@ -15,215 +15,316 @@ - - - - - false - - - Tells the mainboard to go down + + + QFrame::NoFrame + + + true + + + + + 0 + 0 + 804 + 505 + + + + + + + QFrame::NoFrame + + + QFrame::Raised + + + 0 + + + + 0 + + + 0 + + + + + + + false + + + Start a guided procedure to manually +recover a system which does not boot. + +Rescue is possible in USB mode only. + + + Auto Update + + + + + + + false + + + Tells the mainboard to go down to bootloader mode. (Only enabled if telemetry link is established, either through serial or USB) - - - Halt - - - - - - - true - - - Boots the system. + + + Halt + + + + + + + false + + + Reset the system. +(Only enabled if telemetry link is established, either +through serial or USB) + + + Reset + + + + + + + true + + + Boots the system. Only useful if the system is halted (mainboard blue LED blinking slowly, green LED on) If telemetry is not running, select the link using the dropdown menu on the right. - - - Boot - - - - - - - true - - - Boots the system into safe mode (ie. default HwSettings). + + + Boot + + + + + + + true + + + Boots the system into safe mode (ie. default HwSettings). Only useful if the system is halted (mainboard blue LED blinking slowly, orange LED off) If telemetry is not running, select the link using the dropdown menu on the right. - - - Safe Boot - - - - - - - true - - - <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> - - - Erase settings - - - - - - - false - - - Reset the system. -(Only enabled if telemetry link is established, either -through serial or USB) - - - Reset - - - - - - - Start a guided procedure to manually + + + Safe Boot + + + + + + + Start a guided procedure to manually recover a system which does not boot. Rescue is possible in USB mode only. - - - Rescue - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - When telemetry is not connected, select the communication + + + Rescue + + + + + + + true + + + <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> + + + Erase settings + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + When telemetry is not connected, select the communication method using this combo box. You can use this to force a communication channel when doing a "Boot" (button on the left). It is updated automatically when halting a running board. - - - - - - - Refresh the list of serial ports - - - ... - - - - - - - - 75 - true - - - - Running - - - - - - - - - - - :/core/images/helpicon.svg:/core/images/helpicon.svg - - - - 30 - 30 - - - - true - - - - - - - - - Qt::Vertical - - - - 0 - - - - Mainboard - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> + + + + + + + Refresh the list of serial ports + + + ... + + + + + + + + 75 + true + + + + Running + + + + + + + + + + + :/core/images/helpicon.svg:/core/images/helpicon.svg + + + + 30 + 30 + + + + true + + + + + + + + + + + + Auto update + + + + + + OK + + + + + + + 0 + + + false + + + + + + + Progress + + + + + + + + + + Qt::Vertical + + + + 0 + + + + Mainboard + + + + + + <!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, 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> <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> - + + + + + - - - - - - - Qt::ScrollBarAlwaysOff - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> + + + Qt::ScrollBarAlwaysOff + + + <!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> - + + + + + diff --git a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp index 7ecc1cf91..2ac6de747 100644 --- a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp @@ -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("Board was updated successfully, press OK to finish."); + finishAutoUpdate(); + break; + case uploader::FAILURE: + m_config->autoUpdateLabel->setText("Something went wrong, you will have to manually upgrade the board. Press OK to continue."); + finishAutoUpdate(); + break; + } +} + /** Update log entry */ diff --git a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.h b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.h index 4f088c9aa..faea5678d 100644 --- a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.h +++ b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.h @@ -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