mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2024-11-29 07:24:13 +01:00
GCS - disable the boot and safeboot buttons during flash
This commit is contained in:
parent
9481be90af
commit
f753105c0f
@ -404,10 +404,12 @@ void deviceWidget::uploadFirmware()
|
||||
status("Starting firmware upload", STATUSICON_RUNNING);
|
||||
// We don't know which device was used previously, so we
|
||||
// are cautious and reenter DFU for this deviceID:
|
||||
emit uploadStarted();
|
||||
if(!m_dfu->enterDFU(deviceID))
|
||||
{
|
||||
status("Error:Could not enter DFU mode", STATUSICON_FAIL);
|
||||
myDevice->updateButton->setEnabled(true);
|
||||
emit uploadEnded(false);
|
||||
return;
|
||||
}
|
||||
OP_DFU::Status ret=m_dfu->StatusRequest();
|
||||
@ -421,6 +423,7 @@ void deviceWidget::uploadFirmware()
|
||||
if(!retstatus ) {
|
||||
status("Could not start upload", STATUSICON_FAIL);
|
||||
myDevice->updateButton->setEnabled(true);
|
||||
emit uploadEnded(false);
|
||||
return;
|
||||
}
|
||||
status("Uploading, please wait...", STATUSICON_RUNNING);
|
||||
@ -480,6 +483,7 @@ void deviceWidget::uploadFinished(OP_DFU::Status retstatus)
|
||||
disconnect(m_dfu, SIGNAL(operationProgress(QString)), this, SLOT(dfuStatus(QString)));
|
||||
if(retstatus != OP_DFU::Last_operation_Success) {
|
||||
status(QString("Upload failed with code: ") + m_dfu->StatusToString(retstatus).toLatin1().data(), STATUSICON_FAIL);
|
||||
emit uploadEnded(false);
|
||||
return;
|
||||
} else
|
||||
if (!descriptionArray.isEmpty()) {
|
||||
@ -489,6 +493,7 @@ void deviceWidget::uploadFinished(OP_DFU::Status retstatus)
|
||||
retstatus = m_dfu->UploadDescription(descriptionArray);
|
||||
if( retstatus != OP_DFU::Last_operation_Success) {
|
||||
status(QString("Upload failed with code: ") + m_dfu->StatusToString(retstatus).toLatin1().data(), STATUSICON_FAIL);
|
||||
emit uploadEnded(false);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -499,10 +504,12 @@ void deviceWidget::uploadFinished(OP_DFU::Status retstatus)
|
||||
retstatus = m_dfu->UploadDescription(myDevice->description->text());
|
||||
if( retstatus != OP_DFU::Last_operation_Success) {
|
||||
status(QString("Upload failed with code: ") + m_dfu->StatusToString(retstatus).toLatin1().data(), STATUSICON_FAIL);
|
||||
emit uploadEnded(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
populate();
|
||||
emit uploadEnded(true);
|
||||
status("Upload successful", STATUSICON_OK);
|
||||
|
||||
}
|
||||
|
@ -72,7 +72,8 @@ private:
|
||||
bool populateLoadedStructuredDescription(QByteArray arr);
|
||||
|
||||
signals:
|
||||
|
||||
void uploadStarted();
|
||||
void uploadEnded(bool success);
|
||||
public slots:
|
||||
void uploadFirmware();
|
||||
void loadFirmware();
|
||||
|
@ -116,6 +116,12 @@ QString UploaderGadgetWidget::getPortDevice(const QString &friendName)
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
void UploaderGadgetWidget::connectSignalSlot(QWidget *widget)
|
||||
{
|
||||
connect(qobject_cast<deviceWidget *>(widget),SIGNAL(uploadStarted()),this,SLOT(uploadStarted()));
|
||||
connect(qobject_cast<deviceWidget *>(widget),SIGNAL(uploadEnded(bool)),this,SLOT(uploadEnded(bool)));
|
||||
}
|
||||
void UploaderGadgetWidget::onPhisicalHWConnect()
|
||||
{
|
||||
m_config->bootButton->setEnabled(false);
|
||||
@ -305,6 +311,7 @@ void UploaderGadgetWidget::goToBootloader(UAVObject* callerObj, bool success)
|
||||
}
|
||||
for(int i=0;i<dfu->numberOfDevices;i++) {
|
||||
deviceWidget* dw = new deviceWidget(this);
|
||||
connectSignalSlot(dw);
|
||||
dw->setDeviceID(i);
|
||||
dw->setDfu(dfu);
|
||||
dw->populate();
|
||||
@ -540,6 +547,7 @@ void UploaderGadgetWidget::systemRescue()
|
||||
}
|
||||
for(int i=0;i<dfu->numberOfDevices;i++) {
|
||||
deviceWidget* dw = new deviceWidget(this);
|
||||
connectSignalSlot(dw);
|
||||
dw->setDeviceID(i);
|
||||
dw->setDfu(dfu);
|
||||
dw->populate();
|
||||
@ -567,6 +575,19 @@ void UploaderGadgetWidget::cancel()
|
||||
m_eventloop.exit();
|
||||
}
|
||||
|
||||
void UploaderGadgetWidget::uploadStarted()
|
||||
{
|
||||
m_config->bootButton->setEnabled(false);
|
||||
m_config->safeBootButton->setEnabled(false);
|
||||
}
|
||||
|
||||
void UploaderGadgetWidget::uploadEnded(bool succeed)
|
||||
{
|
||||
Q_UNUSED(succeed);
|
||||
m_config->bootButton->setEnabled(true);
|
||||
m_config->safeBootButton->setEnabled(true);
|
||||
}
|
||||
|
||||
/**
|
||||
Update log entry
|
||||
*/
|
||||
|
@ -88,6 +88,7 @@ private:
|
||||
QLineEdit* openFileNameLE;
|
||||
QEventLoop m_eventloop;
|
||||
QErrorMessage * msg;
|
||||
void connectSignalSlot(QWidget * widget);
|
||||
private slots:
|
||||
void onPhisicalHWConnect();
|
||||
void versionMatchCheck();
|
||||
@ -102,6 +103,8 @@ private slots:
|
||||
void getSerialPorts();
|
||||
void perform();
|
||||
void cancel();
|
||||
void uploadStarted();
|
||||
void uploadEnded(bool succeed);
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user