1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-02-05 21:52:10 +01:00

OP-234 Reset button now works again. Slightly tighter timing on board detection, if you get issues on Windows or MacOS, please let me know!

git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2330 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
edouard 2011-01-04 22:03:27 +00:00 committed by edouard
parent b463bd2a09
commit 609b244007

View File

@ -189,12 +189,19 @@ void UploaderGadgetWidget::goToBootloader(UAVObject* callerObj, bool success)
disconnect(fwIAP, SIGNAL(transactionCompleted(UAVObject*,bool)),this,SLOT(goToBootloader(UAVObject*, bool))); disconnect(fwIAP, SIGNAL(transactionCompleted(UAVObject*,bool)),this,SLOT(goToBootloader(UAVObject*, bool)));
break; break;
} }
// stop the polling thread: otherwise it will mess up DFU
// Do it now, because otherwise it will send bad stuff to
// the board before we have time to stop it.
RawHIDConnection *cnx = pm->getObject<RawHIDConnection>();
cnx->suspendPolling();
// The board is now reset: we have to disconnect telemetry // The board is now reset: we have to disconnect telemetry
Core::ConnectionManager *cm = Core::ICore::instance()->connectionManager(); Core::ConnectionManager *cm = Core::ICore::instance()->connectionManager();
QString dli = cm->getCurrentDevice().devName; QString dli = cm->getCurrentDevice().devName;
QString dlj = cm->getCurrentDevice().displayedName; QString dlj = cm->getCurrentDevice().displayedName;
cm->disconnectDevice(); cm->disconnectDevice();
log("Board Reset"); log("Board Halt");
m_config->boardStatus->setText("Bootloader");
if (dlj.startsWith("USB")) if (dlj.startsWith("USB"))
m_config->telemetryLink->setCurrentIndex(m_config->telemetryLink->findText("USB")); m_config->telemetryLink->setCurrentIndex(m_config->telemetryLink->findText("USB"));
else else
@ -202,19 +209,20 @@ void UploaderGadgetWidget::goToBootloader(UAVObject* callerObj, bool success)
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
disconnect(fwIAP, SIGNAL(transactionCompleted(UAVObject*,bool)),this,SLOT(goToBootloader(UAVObject*, bool))); disconnect(fwIAP, SIGNAL(transactionCompleted(UAVObject*,bool)),this,SLOT(goToBootloader(UAVObject*, bool)));
if (resetOnly) { if (resetOnly) {
resetOnly=false; resetOnly=false;
delay::msleep(3500);
systemBoot();
break; break;
} }
// stop the polling thread: otherwise it will mess up DFU
RawHIDConnection *cnx = pm->getObject<RawHIDConnection>(); currentStep = IAP_STATE_BOOTLOADER;
cnx->suspendPolling();
// Tell the mainboard to get into bootloader state: // Tell the mainboard to get into bootloader state:
log("Going into Bootloader mode, please wait 5 seconds..."); log("Detecting devices, please wait 3 seconds...");
this->repaint(); this->repaint();
delay::msleep(5000); // Required to let the board settle, otherwise we delay::msleep(3100); // Required to let the board settle
// get garbage on the USB HID pipe for the 1st request. Why ???
if (!dfu) { if (!dfu) {
if (dlj.startsWith("USB")) if (dlj.startsWith("USB"))
dfu = new DFUObject(DFU_DEBUG, false, QString()); dfu = new DFUObject(DFU_DEBUG, false, QString());
@ -227,8 +235,6 @@ void UploaderGadgetWidget::goToBootloader(UAVObject* callerObj, bool success)
log("Could not enter DFU mode."); log("Could not enter DFU mode.");
return; return;
} }
m_config->boardStatus->setText("Bootloader");
currentStep = IAP_STATE_BOOTLOADER;
//dfu.StatusRequest(); //dfu.StatusRequest();
dfu->findDevices(); dfu->findDevices();
log(QString("Found ") + QString::number(dfu->numberOfDevices) + QString(" device(s).")); log(QString("Found ") + QString::number(dfu->numberOfDevices) + QString(" device(s)."));
@ -269,6 +275,10 @@ void UploaderGadgetWidget::goToBootloader(UAVObject* callerObj, bool success)
void UploaderGadgetWidget::systemReset() void UploaderGadgetWidget::systemReset()
{ {
resetOnly = true; resetOnly = true;
if (dfu) {
delete dfu;
dfu = NULL;
}
m_config->textBrowser->clear(); m_config->textBrowser->clear();
log("Board Reset initiated."); log("Board Reset initiated.");
goToBootloader(); goToBootloader();
@ -281,8 +291,6 @@ void UploaderGadgetWidget::systemBoot()
{ {
clearLog(); clearLog();
if (currentStep != IAP_STATE_BOOTLOADER) { if (currentStep != IAP_STATE_BOOTLOADER) {
log("Did not go into bootloader from this interface");
log("I assume you know what you're doing...");
this->repaint(); this->repaint();
// Stop the polling thread just in case (really necessary) // Stop the polling thread just in case (really necessary)
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance(); ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();