1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-18 03:52:11 +01:00

Add dialog box to indicate when test outputs won't work.

This commit is contained in:
James Cotton 2011-10-20 07:20:23 -05:00
parent 46aa8916c6
commit 14fa739748

View File

@ -39,6 +39,7 @@
#include <QDesktopServices>
#include <QUrl>
#include "actuatorcommand.h"
#include "systemalarms.h"
ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(parent)
{
@ -202,6 +203,22 @@ void ConfigOutputWidget::linkToggled(bool state)
*/
void ConfigOutputWidget::runChannelTests(bool state)
{
SystemAlarms * systemAlarmsObj = SystemAlarms::GetInstance(getObjectManager());
SystemAlarms::DataFields systemAlarms = systemAlarmsObj->getData();
if(state && systemAlarms.Alarm[SystemAlarms::ALARM_ACTUATOR] != SystemAlarms::ALARM_OK) {
QMessageBox mbox;
mbox.setText(QString(tr("The actuator module is in an error state. This can also occur because there are no inputs. Please fix these before testing outputs.")));
mbox.setStandardButtons(QMessageBox::Ok);
mbox.exec();
// Unfortunately must cache this since callback will reoccur
accInitialData = ActuatorCommand::GetInstance(getObjectManager())->getMetadata();
m_config->channelOutTest->setChecked(false);
return;
}
// Confirm this is definitely what they want
if(state) {
QMessageBox mbox;
@ -216,11 +233,7 @@ void ConfigOutputWidget::runChannelTests(bool state)
}
}
qDebug() << "Running with state " << state;
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("ActuatorCommand")));
ActuatorCommand * obj = ActuatorCommand::GetInstance(getObjectManager());
UAVObject::Metadata mdata = obj->getMetadata();
if (state)
{