diff --git a/src/VehicleSetup/FirmwareUpgrade.qml b/src/VehicleSetup/FirmwareUpgrade.qml index 8ae8b529e7dd04ba526b9a3ea20d69e9deb2ae10..23dbc8740b78dec99c89ef47e352e1e5664c9269 100644 --- a/src/VehicleSetup/FirmwareUpgrade.qml +++ b/src/VehicleSetup/FirmwareUpgrade.qml @@ -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 diff --git a/src/VehicleSetup/FirmwareUpgradeController.cc b/src/VehicleSetup/FirmwareUpgradeController.cc index 343549788b8739dcb33da8fbec20e98bf59c4310..6949fb749a9c44ed2a0c1744204709ad0ef59a08 100644 --- a/src/VehicleSetup/FirmwareUpgradeController.cc +++ b/src/VehicleSetup/FirmwareUpgradeController.cc @@ -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) diff --git a/src/VehicleSetup/FirmwareUpgradeController.h b/src/VehicleSetup/FirmwareUpgradeController.h index 3406aa0aca8d425e0b4ff3482b8fd0213ffc208d..f3d3cce9f8c27a162d4cc24e18ddcb2c0f5de73d 100644 --- a/src/VehicleSetup/FirmwareUpgradeController.h +++ b/src/VehicleSetup/FirmwareUpgradeController.h @@ -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 };