1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-03-16 08:29:15 +01:00

GCS-Fix eventloop on the connect board while loop

This commit is contained in:
PT_Dreamer 2012-10-15 19:39:20 +01:00
parent e78cd29c5f
commit b318861619

View File

@ -446,14 +446,20 @@ bool UploaderGadgetWidget::autoUpdate()
delete dfu;
dfu = NULL;
}
QEventLoop loop;
QTimer timer;
timer.setSingleShot(true);
connect(&timer,SIGNAL(timeout()),&loop,SLOT(quit()));
while(USBMonitor::instance()->availableDevices(0x20a0,-1,-1,-1).length()>0)
{
emit autoUpdateSignal(WAITING_DISCONNECT,QVariant());
if(QMessageBox::warning(this,tr("OpenPilot Uploader"),tr("Please disconnect all openpilot boards"),QMessageBox::Ok,QMessageBox::Cancel)==QMessageBox::Cancel)
{
emit autoUpdateSignal(FAILURE,QVariant());
return false;
}
emit autoUpdateSignal(WAITING_DISCONNECT,QVariant());
if(QMessageBox::warning(this,tr("OpenPilot Uploader"),tr("Please disconnect all openpilot boards"),QMessageBox::Ok,QMessageBox::Cancel)==QMessageBox::Cancel)
{
emit autoUpdateSignal(FAILURE,QVariant());
return false;
}
timer.start(500);
loop.exec();
}
emit autoUpdateSignal(WAITING_CONNECT,0);
autoUpdateConnectTimeout=0;