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

OP-690 Show dialog if halt is invoked and the board is armed or arming (not disarmed).

This commit is contained in:
Fredrik Arvidsson 2012-11-18 22:40:05 +01:00
parent 22173d96e5
commit 4a16909cb3
2 changed files with 27 additions and 3 deletions

View File

@ -28,6 +28,7 @@
#include "../../../../../build/ground/openpilotgcs/gcsversioninfo.h"
#include <coreplugin/coreconstants.h>
#include <QDebug>
#include "flightstatus.h"
#define DFU_DEBUG true
@ -49,7 +50,7 @@ UploaderGadgetWidget::UploaderGadgetWidget(QWidget *parent) : QWidget(parent)
connect(telMngr, SIGNAL(disconnected()), this, SLOT(onAutopilotDisconnect()));
connect(m_config->haltButton, SIGNAL(clicked()), this, SLOT(goToBootloader()));
connect(m_config->haltButton, SIGNAL(clicked()), this, SLOT(systemHalt()));
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()));
@ -348,6 +349,30 @@ void UploaderGadgetWidget::goToBootloader(UAVObject* callerObj, bool success)
}
void UploaderGadgetWidget::systemHalt()
{
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
Q_ASSERT(pm);
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
Q_ASSERT(objManager);
FlightStatus *status = dynamic_cast<FlightStatus*>(objManager->getObject(QString("FlightStatus")));
Q_ASSERT(status);
// The board can not be halted when in armed state.
// If board is armed, or arming. Show message with notice.
if (status->getArmed() == FlightStatus::ARMED_DISARMED) {
goToBootloader();
}
else {
QMessageBox mbox(this);
mbox.setText(QString(tr("The controller board is armed and can not be halted.\n"
"Please make sure the board is not armed and then press halt again to proceed.")));
mbox.setStandardButtons(QMessageBox::Ok);
mbox.setIcon(QMessageBox::Warning);
mbox.exec();
}
}
/**
Tell the mainboard to reset:
- Send the relevant IAP commands
@ -381,7 +406,6 @@ void UploaderGadgetWidget::systemSafeBoot()
*/
void UploaderGadgetWidget::commonSystemBoot(bool safeboot)
{
clearLog();
m_config->bootButton->setEnabled(false);
m_config->safeBootButton->setEnabled(false);
@ -828,6 +852,5 @@ void UploaderGadgetWidget::versionMatchCheck()
void UploaderGadgetWidget::openHelp()
{
QDesktopServices::openUrl( QUrl("http://wiki.openpilot.org/x/AoBZ", QUrl::StrictMode) );
}

View File

@ -100,6 +100,7 @@ private slots:
void error(QString errorString,int errorNumber);
void info(QString infoString,int infoNumber);
void goToBootloader(UAVObject* = NULL, bool = false);
void systemHalt();
void systemReset();
void systemBoot();
void systemSafeBoot();