diff --git a/ground/openpilotgcs/src/plugins/uploader/op_dfu.cpp b/ground/openpilotgcs/src/plugins/uploader/op_dfu.cpp
index 961103d22..0143a180b 100644
--- a/ground/openpilotgcs/src/plugins/uploader/op_dfu.cpp
+++ b/ground/openpilotgcs/src/plugins/uploader/op_dfu.cpp
@@ -509,7 +509,7 @@ int DFUObject::AbortOperation(void)
/**
Starts the firmware (leaves bootloader and boots the main software)
*/
-int DFUObject::JumpToApp()
+int DFUObject::JumpToApp(bool safeboot)
{
char buf[BUF_LEN];
buf[0] =0x02;//reportID
@@ -520,8 +520,17 @@ int DFUObject::JumpToApp()
buf[5] = 0;
buf[6] = 0;
buf[7] = 0;
- buf[8] = 0;
- buf[9] = 0;
+ if (safeboot)
+ {
+ /* force system to safe boot mode (hwsettings == defaults) */
+ buf[8] = 0x5A;
+ buf[9] = 0xFE;
+ }
+ else
+ {
+ buf[8] = 0;
+ buf[9] = 0;
+ }
return sendData(buf, BUF_LEN);
//return hidHandle.send(0,buf, BUF_LEN, 500);
diff --git a/ground/openpilotgcs/src/plugins/uploader/op_dfu.h b/ground/openpilotgcs/src/plugins/uploader/op_dfu.h
index 79624b546..812f3f2fb 100644
--- a/ground/openpilotgcs/src/plugins/uploader/op_dfu.h
+++ b/ground/openpilotgcs/src/plugins/uploader/op_dfu.h
@@ -129,7 +129,7 @@ namespace OP_DFU {
// Service commands:
bool enterDFU(int const &devNumber);
bool findDevices();
- int JumpToApp();
+ int JumpToApp(bool);
int ResetDevice(void);
OP_DFU::Status StatusRequest();
bool EndOperation();
diff --git a/ground/openpilotgcs/src/plugins/uploader/uploader.ui b/ground/openpilotgcs/src/plugins/uploader/uploader.ui
index d66fc02ef..b0dffd4a0 100644
--- a/ground/openpilotgcs/src/plugins/uploader/uploader.ui
+++ b/ground/openpilotgcs/src/plugins/uploader/uploader.ui
@@ -50,6 +50,24 @@ menu on the right.
+ -
+
+
+ true
+
+
+ Boots the system into safe mode (ie. default HwSettings).
+Only useful if the system is halted
+(mainboard blue LED blinking slowly, orange LED off)
+
+If telemetry is not running, select the link using the dropdown
+menu on the right.
+
+
+ Safe Boot
+
+
+
-
diff --git a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp
index c0a1aea90..bf0c66510 100755
--- a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp
+++ b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.cpp
@@ -52,6 +52,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()));
+ connect(m_config->safeBootButton, SIGNAL(clicked()), this, SLOT(systemSafeBoot()));
connect(m_config->rescueButton, SIGNAL(clicked()), this, SLOT(systemRescue()));
Core::ConnectionManager *cm = Core::ICore::instance()->connectionManager();
connect(cm,SIGNAL(deviceConnected(QIODevice*)),this,SLOT(onPhisicalHWConnect()));
@@ -117,6 +118,7 @@ QString UploaderGadgetWidget::getPortDevice(const QString &friendName)
void UploaderGadgetWidget::onPhisicalHWConnect()
{
m_config->bootButton->setEnabled(false);
+ m_config->safeBootButton->setEnabled(false);
m_config->rescueButton->setEnabled(false);
m_config->telemetryLink->setEnabled(false);
}
@@ -132,6 +134,7 @@ void UploaderGadgetWidget::populate()
{
m_config->haltButton->setEnabled(true);
m_config->resetButton->setEnabled(true);
+ m_config->safeBootButton->setEnabled(false);
m_config->bootButton->setEnabled(false);
m_config->rescueButton->setEnabled(false);
m_config->telemetryLink->setEnabled(false);
@@ -155,6 +158,7 @@ void UploaderGadgetWidget::onAutopilotDisconnect(){
m_config->haltButton->setEnabled(false);
m_config->resetButton->setEnabled(false);
m_config->bootButton->setEnabled(true);
+ m_config->safeBootButton->setEnabled(true);
if (currentStep == IAP_STATE_BOOTLOADER) {
m_config->rescueButton->setEnabled(false);
m_config->telemetryLink->setEnabled(false);
@@ -311,6 +315,7 @@ void UploaderGadgetWidget::goToBootloader(UAVObject* callerObj, bool success)
*/
// Need to re-enable in case we were not connected
m_config->bootButton->setEnabled(true);
+ m_config->safeBootButton->setEnabled(true);
/*
m_config->telemetryLink->setEnabled(false);
m_config->rescueButton->setEnabled(false);
@@ -348,14 +353,25 @@ void UploaderGadgetWidget::systemReset()
goToBootloader();
}
+void UploaderGadgetWidget::systemBoot()
+{
+ commonSystemBoot(false);
+}
+
+void UploaderGadgetWidget::systemSafeBoot()
+{
+ commonSystemBoot(true);
+}
+
/**
Tells the system to boot (from Bootloader state)
*/
-void UploaderGadgetWidget::systemBoot()
+void UploaderGadgetWidget::commonSystemBoot(bool safeboot)
{
clearLog();
m_config->bootButton->setEnabled(false);
+ m_config->safeBootButton->setEnabled(false);
// Suspend telemety & polling in case it is not done yet
Core::ConnectionManager *cm = Core::ICore::instance()->connectionManager();
@@ -379,11 +395,12 @@ void UploaderGadgetWidget::systemBoot()
delete dfu;
dfu = NULL;
m_config->bootButton->setEnabled(true);
+ m_config->safeBootButton->setEnabled(true);
m_config->rescueButton->setEnabled(true); // Boot not possible, maybe Rescue OK?
return;
}
log("Booting system...");
- dfu->JumpToApp();
+ dfu->JumpToApp(safeboot);
// Restart the polling thread
cm->resumePolling();
m_config->rescueButton->setEnabled(true);
@@ -530,6 +547,7 @@ void UploaderGadgetWidget::systemRescue()
m_config->haltButton->setEnabled(false);
m_config->resetButton->setEnabled(false);
m_config->bootButton->setEnabled(true);
+ m_config->safeBootButton->setEnabled(true);
m_config->rescueButton->setEnabled(false);
currentStep = IAP_STATE_BOOTLOADER; // So that we can boot from the GUI afterwards.
}
diff --git a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.h b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.h
index 9b1fa1433..998166d69 100755
--- a/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.h
+++ b/ground/openpilotgcs/src/plugins/uploader/uploadergadgetwidget.h
@@ -94,6 +94,8 @@ private slots:
void goToBootloader(UAVObject* = NULL, bool = false);
void systemReset();
void systemBoot();
+ void systemSafeBoot();
+ void commonSystemBoot(bool = false);
void systemRescue();
void getSerialPorts();
void perform();