From 092a5e0e9f8d57b6b37ca787a3f0a32a41a9cc20 Mon Sep 17 00:00:00 2001 From: Don Gagne Date: Sun, 22 Nov 2020 10:11:09 -0800 Subject: [PATCH] Fix SiK Radio flash (#9189) --- src/VehicleSetup/Bootloader.cc | 1 - src/VehicleSetup/FirmwareUpgrade.qml | 4 ++-- src/VehicleSetup/FirmwareUpgradeController.cc | 19 ++++++------------- src/VehicleSetup/FirmwareUpgradeController.h | 2 +- 4 files changed, 9 insertions(+), 17 deletions(-) diff --git a/src/VehicleSetup/Bootloader.cc b/src/VehicleSetup/Bootloader.cc index 72d937e..69a3fa1 100644 --- a/src/VehicleSetup/Bootloader.cc +++ b/src/VehicleSetup/Bootloader.cc @@ -108,7 +108,6 @@ bool Bootloader::getBoardInfo(uint32_t& bootloaderVersion, uint32_t& boardID, ui QString boardIdStr = _getNextLine(2000); bool ok = false; _boardID = boardIdStr.toInt(&ok); - _boardID = 130; if (boardIdStr.isEmpty() || !ok) { _errorString = tr("Radio did not return board id"); goto Error; diff --git a/src/VehicleSetup/FirmwareUpgrade.qml b/src/VehicleSetup/FirmwareUpgrade.qml index 5869be4..bcecb13 100644 --- a/src/VehicleSetup/FirmwareUpgrade.qml +++ b/src/VehicleSetup/FirmwareUpgrade.qml @@ -136,8 +136,8 @@ SetupPage { } } - onBootloaderFound: mainWindow.showComponentDialog(firmwareSelectDialogComponent, title, mainWindow.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel) - onError: statusTextArea.append(flashFailText) + onShowFirmwareSelectDlg: mainWindow.showComponentDialog(firmwareSelectDialogComponent, title, mainWindow.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel) + onError: statusTextArea.append(flashFailText) } Component { diff --git a/src/VehicleSetup/FirmwareUpgradeController.cc b/src/VehicleSetup/FirmwareUpgradeController.cc index 5874560..d8aea63 100644 --- a/src/VehicleSetup/FirmwareUpgradeController.cc +++ b/src/VehicleSetup/FirmwareUpgradeController.cc @@ -135,7 +135,7 @@ void FirmwareUpgradeController::flash(AutoPilotStackType_t stackType, FirmwareBuildType_t firmwareType, FirmwareVehicleType_t vehicleType) { - qCDebug(FirmwareUpgradeLog) << "_flash stackType:firmwareType:vehicleType" << stackType << firmwareType << vehicleType; + qCDebug(FirmwareUpgradeLog) << "FirmwareUpgradeController::flash stackType:firmwareType:vehicleType" << stackType << firmwareType << vehicleType; FirmwareIdentifier firmwareId = FirmwareIdentifier(stackType, firmwareType, vehicleType); if (_bootloaderFound) { _getFirmwareFile(firmwareId); @@ -243,13 +243,12 @@ void FirmwareUpgradeController::_foundBoardInfo(int bootloaderVersion, int board if (_startFlashWhenBootloaderFound) { flash(_startFlashWhenBootloaderFoundFirmwareIdentity); + } else { + if (_rgManifestFirmwareInfo.count()) { + _buildAPMFirmwareNames(); + } + emit showFirmwareSelectDlg(); } - - if (_rgManifestFirmwareInfo.count()) { - _buildAPMFirmwareNames(); - } - - emit bootloaderFound(); } @@ -499,12 +498,6 @@ void FirmwareUpgradeController::_initFirmwareHash() const FirmwareToUrlElement_t& element = rg3DRRadioFirmwareArray[i]; _rg3DRRadioFirmware.insert(FirmwareIdentifier(element.stackType, element.firmwareType, element.vehicleType), element.url); } - - size = sizeof(rg3DRRadioFirmwareArray)/sizeof(rg3DRRadioFirmwareArray[0]); - for (int i = 0; i < size; i++) { - const FirmwareToUrlElement_t& element = rg3DRRadioFirmwareArray[i]; - _rg3DRRadioFirmware.insert(FirmwareIdentifier(element.stackType, element.firmwareType, element.vehicleType), element.url); - } } /// @brief Called when the findBootloader process is unable to sync to the bootloader. Moves the state diff --git a/src/VehicleSetup/FirmwareUpgradeController.h b/src/VehicleSetup/FirmwareUpgradeController.h index b21a374..3ce4ae3 100644 --- a/src/VehicleSetup/FirmwareUpgradeController.h +++ b/src/VehicleSetup/FirmwareUpgradeController.h @@ -155,7 +155,7 @@ public: signals: void boardFound (void); - void bootloaderFound (void); + void showFirmwareSelectDlg (void); void noBoardFound (void); void boardGone (void); void flashComplete (void);