mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-15 07:29:15 +01:00
OP-35 Boot button enabled, to get out of bootloader mode.
git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@2056 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
8d2c9c37fb
commit
1e0c2eef22
@ -37,6 +37,7 @@ UploaderGadgetWidget::UploaderGadgetWidget(QWidget *parent) : QWidget(parent)
|
||||
|
||||
connect(m_config->haltButton, SIGNAL(clicked()), this, SLOT(goToBootloader()));
|
||||
connect(m_config->resetButton, SIGNAL(clicked()), this, SLOT(systemReset()));
|
||||
connect(m_config->bootButton, SIGNAL(clicked()), this, SLOT(systemBoot()));
|
||||
|
||||
|
||||
}
|
||||
@ -120,6 +121,7 @@ void UploaderGadgetWidget::goToBootloader(UAVObject* callerObj, bool success)
|
||||
{
|
||||
log("Could not enter DFU mode.");
|
||||
}
|
||||
currentStep = IAP_STATE_BOOTLOADER;
|
||||
OP_DFU::Status ret=dfu.StatusRequest();
|
||||
dfu.findDevices();
|
||||
log(QString("Found ") + QString::number(dfu.numberOfDevices) + QString(" device(s)."));
|
||||
@ -132,11 +134,10 @@ void UploaderGadgetWidget::goToBootloader(UAVObject* callerObj, bool success)
|
||||
for(int i=0;i<dfu.numberOfDevices;i++) {
|
||||
deviceWidget* dw = new deviceWidget();
|
||||
m_config->systemElements->addTab(dw, QString("Device") + QString::number(i));
|
||||
|
||||
}
|
||||
m_config->bootButton->setEnabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -152,6 +153,32 @@ void UploaderGadgetWidget::systemReset()
|
||||
goToBootloader();
|
||||
}
|
||||
|
||||
/**
|
||||
Tells the system to boot (from Bootloader state)
|
||||
*/
|
||||
void UploaderGadgetWidget::systemBoot()
|
||||
{
|
||||
if (currentStep == IAP_STATE_BOOTLOADER) {
|
||||
OP_DFU dfu(true);
|
||||
dfu.AbortOperation();
|
||||
if(!dfu.enterDFU(0))
|
||||
{
|
||||
log("Could not enter DFU mode.");
|
||||
}
|
||||
log("Booting system...");
|
||||
dfu.JumpToApp();
|
||||
currentStep = IAP_STATE_READY;
|
||||
// stop the polling thread: otherwise it will mess up DFU
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
RawHIDConnection *cnx = pm->getObject<RawHIDConnection>();
|
||||
cnx->resumePolling();
|
||||
m_config->bootButton->setEnabled(false);
|
||||
} else {
|
||||
log("Not in bootloader mode!");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
Update status
|
||||
*/
|
||||
|
@ -58,7 +58,7 @@ class UploaderGadgetWidget : public QWidget
|
||||
public:
|
||||
UploaderGadgetWidget(QWidget *parent = 0);
|
||||
~UploaderGadgetWidget();
|
||||
typedef enum { IAP_STATE_READY, IAP_STATE_STEP_1, IAP_STATE_STEP_2, IAP_STEP_RESET} IAPStep;
|
||||
typedef enum { IAP_STATE_READY, IAP_STATE_STEP_1, IAP_STATE_STEP_2, IAP_STEP_RESET, IAP_STATE_BOOTLOADER} IAPStep;
|
||||
|
||||
void setPort(QextSerialPort* port);
|
||||
|
||||
@ -84,6 +84,7 @@ private slots:
|
||||
void updatePercSlot(int);
|
||||
void goToBootloader(UAVObject* = NULL, bool = false);
|
||||
void systemReset();
|
||||
void systemBoot();
|
||||
};
|
||||
|
||||
#endif // UPLOADERGADGETWIDGET_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user