diff --git a/ground/openpilotgcs/src/plugins/uploader/op_dfu.cpp b/ground/openpilotgcs/src/plugins/uploader/op_dfu.cpp index bff5d04d5..dc08d94f2 100644 --- a/ground/openpilotgcs/src/plugins/uploader/op_dfu.cpp +++ b/ground/openpilotgcs/src/plugins/uploader/op_dfu.cpp @@ -90,6 +90,8 @@ DFUObject::DFUObject(bool _debug,bool _use_serial,QString portname): if (devices.length()==1 && hidHandle.open(1,devices.first().vendorID,devices.first().productID,0,0)==1) { qDebug()<<"OP_DFU detected first time"; mready=true; + QTimer::singleShot(200,&m_eventloop, SLOT(quit())); + m_eventloop.exec(); } else { // Wait for the board to appear on the USB bus: USBSignalFilter filter(0x20a0,-1,-1,USBMonitor::Bootloader); @@ -107,6 +109,8 @@ DFUObject::DFUObject(bool _debug,bool _use_serial,QString portname): if (devices.length()==1) { if(hidHandle.open(1,devices.first().vendorID,devices.first().productID,0,0)==1) { + QTimer::singleShot(200,&m_eventloop, SLOT(quit())); + m_eventloop.exec(); qDebug()<<"OP_DFU detected after delay"; mready=true; break; diff --git a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp index a1008306c..a692433b1 100755 --- a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp +++ b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp @@ -213,7 +213,8 @@ void UploaderGadgetWidget::goToBootloader(UAVObject* callerObj, bool success) m_config->haltButton->setEnabled(true); break; } - delay::msleep(600); + QTimer::singleShot(600, &m_eventloop, SLOT(quit())); + m_eventloop.exec(); fwIAP->getField("Command")->setValue("2233"); currentStep = IAP_STATE_STEP_2; log(QString("IAP Step 2")); @@ -228,7 +229,8 @@ void UploaderGadgetWidget::goToBootloader(UAVObject* callerObj, bool success) m_config->haltButton->setEnabled(true); break; } - delay::msleep(600); + QTimer::singleShot(600, &m_eventloop, SLOT(quit())); + m_eventloop.exec(); fwIAP->getField("Command")->setValue("3344"); currentStep = IAP_STEP_RESET; log(QString("IAP Step 3")); @@ -250,8 +252,12 @@ void UploaderGadgetWidget::goToBootloader(UAVObject* callerObj, bool success) QString dli = cm->getCurrentDevice().Name; QString dlj = cm->getCurrentDevice().devName; cm->disconnectDevice(); + QTimer::singleShot(200, &m_eventloop, SLOT(quit())); + m_eventloop.exec(); // Tell connections to stop their polling threads: otherwise it will mess up DFU cm->suspendPolling(); + QTimer::singleShot(200, &m_eventloop, SLOT(quit())); + m_eventloop.exec(); log("Board Halt"); m_config->boardStatus->setText("Bootloader"); if (dlj.startsWith("USB"))