1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-02 10:24:11 +01:00

Improve Uploader gadget widget behaviour when clicking on halt & boot (prevent double clicking)

This commit is contained in:
elafargue 2011-05-16 20:03:41 +02:00
parent 50f1e15f54
commit 65201ec81c
2 changed files with 6 additions and 2 deletions

View File

@ -100,7 +100,7 @@ DFUObject::DFUObject(bool _debug,bool _use_serial,QString portname):
if (devices.length()==1) { if (devices.length()==1) {
hidHandle.open(1,devices.first().vendorID,devices.first().productID,0,0); hidHandle.open(1,devices.first().vendorID,devices.first().productID,0,0);
} else { } else {
qDebug() << "More than one device, don't know what to do!"; qDebug() << devices.length() << " device(s) detected, don't know what to do!";
mready = false; mready = false;
} }

View File

@ -161,6 +161,7 @@ void UploaderGadgetWidget::goToBootloader(UAVObject* callerObj, bool success)
switch (currentStep) { switch (currentStep) {
case IAP_STATE_READY: case IAP_STATE_READY:
m_config->haltButton->setEnabled(false);
getSerialPorts(); // Useful in case a new serial port appeared since the initial list, getSerialPorts(); // Useful in case a new serial port appeared since the initial list,
// otherwise we won't find it when we stop the board. // otherwise we won't find it when we stop the board.
// The board is running, send the 1st IAP Reset order: // The board is running, send the 1st IAP Reset order:
@ -179,6 +180,7 @@ void UploaderGadgetWidget::goToBootloader(UAVObject* callerObj, bool success)
log("Reset did NOT happen"); log("Reset did NOT happen");
currentStep = IAP_STATE_READY; currentStep = IAP_STATE_READY;
disconnect(fwIAP, SIGNAL(transactionCompleted(UAVObject*,bool)),this,SLOT(goToBootloader(UAVObject*, bool))); disconnect(fwIAP, SIGNAL(transactionCompleted(UAVObject*,bool)),this,SLOT(goToBootloader(UAVObject*, bool)));
m_config->haltButton->setEnabled(true);
break; break;
} }
delay::msleep(600); delay::msleep(600);
@ -193,6 +195,7 @@ void UploaderGadgetWidget::goToBootloader(UAVObject* callerObj, bool success)
log("Reset did NOT happen"); log("Reset did NOT happen");
currentStep = IAP_STATE_READY; currentStep = IAP_STATE_READY;
disconnect(fwIAP, SIGNAL(transactionCompleted(UAVObject*,bool)),this,SLOT(goToBootloader(UAVObject*, bool))); disconnect(fwIAP, SIGNAL(transactionCompleted(UAVObject*,bool)),this,SLOT(goToBootloader(UAVObject*, bool)));
m_config->haltButton->setEnabled(true);
break; break;
} }
delay::msleep(600); delay::msleep(600);
@ -208,6 +211,7 @@ void UploaderGadgetWidget::goToBootloader(UAVObject* callerObj, bool success)
log("Oops, failure step 3"); log("Oops, failure step 3");
log("Reset did NOT happen"); log("Reset did NOT happen");
disconnect(fwIAP, SIGNAL(transactionCompleted(UAVObject*,bool)),this,SLOT(goToBootloader(UAVObject*, bool))); disconnect(fwIAP, SIGNAL(transactionCompleted(UAVObject*,bool)),this,SLOT(goToBootloader(UAVObject*, bool)));
m_config->haltButton->setEnabled(true);
break; break;
} }
@ -247,6 +251,7 @@ void UploaderGadgetWidget::goToBootloader(UAVObject* callerObj, bool success)
cm->resumePolling(); cm->resumePolling();
currentStep = IAP_STATE_READY; currentStep = IAP_STATE_READY;
m_config->boardStatus->setText("Bootloader?"); m_config->boardStatus->setText("Bootloader?");
m_config->haltButton->setEnabled(true);
return; return;
} }
dfu->AbortOperation(); dfu->AbortOperation();
@ -353,7 +358,6 @@ void UploaderGadgetWidget::systemBoot()
log("Could not enter DFU mode."); log("Could not enter DFU mode.");
delete dfu; delete dfu;
dfu = NULL; dfu = NULL;
m_config->bootButton->setEnabled(true);
return; return;
} }
log("Booting system..."); log("Booting system...");