Commit 081af596 authored by Don Gagne's avatar Don Gagne

Added progress bar support back

parent fd6b895b
......@@ -14,6 +14,7 @@ Rectangle {
property var qgcPal: QGCPalette { colorGroupEnabled: true }
property FirmwareUpgradeController controller: FirmwareUpgradeController {
upgradeButton: upgradeButton
progressBar: progressBar
statusLog: statusTextArea
firmwareType: FirmwareUpgradeController.StableFirmware
}
......@@ -35,6 +36,21 @@ Rectangle {
width: 10
}
/*
_ui->statusLog->setText(tr("WARNING: BETA FIRMWARE\n"
- "This firmware version is ONLY intended for beta testers. "
- "Although it has received FLIGHT TESTING, it represents actively changed code. Do NOT use for normal operation.\n\n"
- SELECT_FIRMWARE_LICENSE));
- break;
-
- case 2:
- _ui->statusLog->setText(tr("WARNING: CONTINUOUS BUILD FIRMWARE\n"
- "This firmware has NOT BEEN FLIGHT TESTED. "
- "It is only intended for DEVELOPERS. Run bench tests without props first. "
- "Do NOT fly this without addional safety precautions. Follow the mailing "
- "list actively when using it.\n\n"
- SELECT_FIRMWARE_LICENSE));
*/
ExclusiveGroup { id: firmwareGroup }
QGCRadioButton {
......@@ -90,6 +106,11 @@ Rectangle {
width: 10
}
ProgressBar {
id: progressBar
width: parent.width
}
TextArea {
id: statusTextArea
width: parent.width
......
......@@ -50,15 +50,6 @@ FirmwareUpgradeController::FirmwareUpgradeController(void) :
_threadController = new PX4FirmwareUpgradeThreadController(this);
Q_CHECK_PTR(_threadController);
/*
// FIXME: NYI
// Connect standard ui elements
connect(_ui->tryAgain, &QPushButton::clicked, this, &FirmwareUpgradeController::_tryAgainButton);
connect(_ui->cancel, &QPushButton::clicked, this, &FirmwareUpgradeController::_cancelButton);
connect(_ui->next, &QPushButton::clicked, this, &FirmwareUpgradeController::_nextButton);
connect(_ui->firmwareCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(_firmwareSelected(int)));
*/
connect(_threadController, &PX4FirmwareUpgradeThreadController::foundBoard, this, &FirmwareUpgradeController::_foundBoard);
connect(_threadController, &PX4FirmwareUpgradeThreadController::foundBootloader, this, &FirmwareUpgradeController::_foundBootloader);
connect(_threadController, &PX4FirmwareUpgradeThreadController::bootloaderSyncFailed, this, &FirmwareUpgradeController::_bootloaderSyncFailed);
......@@ -309,9 +300,7 @@ void FirmwareUpgradeController::_downloadProgress(qint64 curr, qint64 total)
{
// Take care of cases where 0 / 0 is emitted as error return value
if (total > 0) {
// FIXME: NYI
Q_UNUSED(curr);
//_ui->progressBar->setValue((curr*100) / total);
_progressBar->setProperty("value", (float)curr / (float)total);
}
}
......@@ -569,10 +558,10 @@ void FirmwareUpgradeController::_error(const int command, const QString errorStr
/// @brief Updates the progress bar from long running bootloader commands
void FirmwareUpgradeController::_updateProgress(int curr, int total)
{
// FIXME: NYI
Q_UNUSED(curr);
Q_UNUSED(total);
// _ui->progressBar->setValue((curr*100) / total);
// Take care of cases where 0 / 0 is emitted as error return value
if (total > 0) {
_progressBar->setProperty("value", (float)curr / (float)total);
}
}
/// @brief Resets the state machine back to the beginning
......@@ -586,8 +575,7 @@ void FirmwareUpgradeController::_restart(void)
void FirmwareUpgradeController::_eraseProgressTick(void)
{
_eraseTickCount++;
// FIXME: NYI
// _ui->progressBar->setValue((_eraseTickCount*_eraseTickMsec*100) / _eraseTotalMsec);
_progressBar->setProperty("value", (float)(_eraseTickCount*_eraseTickMsec) / (float)_eraseTotalMsec);
}
void FirmwareUpgradeController::doFirmwareUpgrade(void)
......
......@@ -68,6 +68,9 @@ public:
/// TextArea for log output
Q_PROPERTY(QQuickItem* statusLog READ statusLog WRITE setStatusLog)
/// Progress bar for you know what
Q_PROPERTY(QQuickItem* progressBar READ progressBar WRITE setProgressBar)
/// Begins the firware upgrade process
Q_INVOKABLE void doFirmwareUpgrade(void);
......@@ -77,6 +80,9 @@ public:
QQuickItem* upgradeButton(void) { return _upgradeButton; }
void setUpgradeButton(QQuickItem* upgradeButton) { _upgradeButton = upgradeButton; }
QQuickItem* progressBar(void) { return _progressBar; }
void setProgressBar(QQuickItem* progressBar) { _progressBar = progressBar; }
QQuickItem* statusLog(void) { return _statusLog; }
void setStatusLog(QQuickItem* statusLog) { _statusLog = statusLog; }
......@@ -141,6 +147,7 @@ private:
FirmwareType_t _firmwareType; ///< Firmware type to load
QQuickItem* _upgradeButton; ///< Upgrade button in ui
QQuickItem* _statusLog; ///< Status log TextArea Qml control
QQuickItem* _progressBar;
bool _searchingForBoard; ///< true: searching for board, false: search for bootloader
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment