mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-17 02:52:12 +01:00
OP-502 If a board is not connected, the "Save" button is grayed out. The "Apply" button is still enable, which enables creating configurations purely offline.
This commit is contained in:
parent
81b29c2b51
commit
a7dccb6648
@ -218,23 +218,23 @@ ConfigAHRSWidget::ConfigAHRSWidget(QWidget *parent) : ConfigTaskWidget(parent)
|
||||
connect(m_ahrs->accelBiasStart, SIGNAL(clicked()), this, SLOT(launchAccelBiasCalibration()));
|
||||
|
||||
obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("AHRSSettings")));
|
||||
connect(obj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(ahrsSettingsRequest()));
|
||||
connect(obj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(refreshValues()));
|
||||
obj = getObjectManager()->getObject(QString("HomeLocation"));
|
||||
connect(obj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(ahrsSettingsRequest()));
|
||||
connect(obj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(refreshValues()));
|
||||
|
||||
/*
|
||||
connect(m_ahrs->algorithm, SIGNAL(currentIndexChanged(int)), this, SLOT(ahrsSettingsSave()));
|
||||
connect(m_ahrs->indoorFlight, SIGNAL(stateChanged(int)), this, SLOT(homeLocationSave()));
|
||||
connect(m_ahrs->homeLocation, SIGNAL(clicked()), this, SLOT(homeLocationSaveSD()));
|
||||
*/
|
||||
connect(m_ahrs->ahrsSettingsSaveRAM, SIGNAL(clicked()), this, SLOT(ahrsSettingsSaveRAM()));
|
||||
connect(m_ahrs->ahrsSettingsSaveSD, SIGNAL(clicked()), this, SLOT(ahrsSettingsSaveSD()));
|
||||
connect(m_ahrs->sixPointsStart, SIGNAL(clicked()), this, SLOT(multiPointCalibrationMode()));
|
||||
connect(m_ahrs->sixPointsSave, SIGNAL(clicked()), this, SLOT(savePositionData()));
|
||||
connect(m_ahrs->startDriftCalib, SIGNAL(clicked()),this, SLOT(launchGyroDriftCalibration()));
|
||||
|
||||
connect(parent, SIGNAL(autopilotConnected()),this, SLOT(ahrsSettingsRequest()));
|
||||
ahrsSettingsRequest();
|
||||
// Order is important: 1st request the settings (it will also enable the controls)
|
||||
// then explicitely disable them. They will be re-enabled right afterwards by the
|
||||
// configgadgetwidget if the autopilot is actually connected.
|
||||
refreshValues();
|
||||
// when the AHRS Widget is instanciated, the autopilot is always connected // enableControls(false);
|
||||
connect(parent, SIGNAL(autopilotConnected()),this, SLOT(onAutopilotConnect()));
|
||||
connect(parent, SIGNAL(autopilotDisconnected()), this, SLOT(onAutopilotDisconnect()));
|
||||
|
||||
// Connect the help button
|
||||
connect(m_ahrs->ahrsHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
|
||||
@ -263,6 +263,13 @@ void ConfigAHRSWidget::resizeEvent(QResizeEvent *event)
|
||||
m_ahrs->sixPointsHelp->fitInView(paperplane,Qt::KeepAspectRatio);
|
||||
}
|
||||
|
||||
|
||||
void ConfigAHRSWidget::enableControls(bool enable)
|
||||
{
|
||||
//m_ahrs->ahrsSettingsSaveRAM->setEnabled(enable);
|
||||
m_ahrs->ahrsSettingsSaveSD->setEnabled(enable);
|
||||
}
|
||||
|
||||
/**
|
||||
Starts an accelerometer bias calibration.
|
||||
*/
|
||||
@ -281,7 +288,7 @@ void ConfigAHRSWidget::launchAccelBiasCalibration()
|
||||
accel_accum_y.clear();
|
||||
accel_accum_z.clear();
|
||||
|
||||
UAVDataObject* ahrsCalib = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("AHRSCalibration")));
|
||||
// UAVDataObject* ahrsCalib = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("AHRSCalibration")));
|
||||
// ahrsCalib->getField("accel_bias")->setDouble(0,0);
|
||||
// ahrsCalib->getField("accel_bias")->setDouble(0,1);
|
||||
// ahrsCalib->getField("accel_bias")->setDouble(0,2);
|
||||
@ -416,6 +423,7 @@ void ConfigAHRSWidget::launchGyroDriftCalibration()
|
||||
*/
|
||||
void ConfigAHRSWidget::driftCalibrationAttitudeRawUpdated(UAVObject* obj) {
|
||||
|
||||
Q_UNUSED(obj)
|
||||
// This is necessary to prevent a race condition on disconnect signal and another update
|
||||
if (collectingData == true) {
|
||||
/**
|
||||
@ -1142,7 +1150,7 @@ void ConfigAHRSWidget::drawVariancesGraph()
|
||||
/**
|
||||
Request current settings from the AHRS
|
||||
*/
|
||||
void ConfigAHRSWidget::ahrsSettingsRequest()
|
||||
void ConfigAHRSWidget::refreshValues()
|
||||
{
|
||||
|
||||
UAVObject *obj = getObjectManager()->getObject(QString("AHRSSettings"));
|
||||
|
@ -55,6 +55,7 @@ public:
|
||||
private:
|
||||
void drawVariancesGraph();
|
||||
void displayPlane(QString elementID);
|
||||
virtual void enableControls(bool enable);
|
||||
|
||||
Ui_AHRSWidget *m_ahrs;
|
||||
QGraphicsSvgItem *paperplane;
|
||||
@ -130,7 +131,9 @@ private slots:
|
||||
void launchAccelBiasCalibration();
|
||||
void calibPhase2();
|
||||
void incrementProgress();
|
||||
void ahrsSettingsRequest();
|
||||
|
||||
virtual void refreshValues();
|
||||
//void ahrsSettingsRequest();
|
||||
void ahrsSettingsSaveRAM();
|
||||
void ahrsSettingsSaveSD();
|
||||
void savePositionData();
|
||||
|
@ -172,7 +172,6 @@ ConfigAirframeWidget::ConfigAirframeWidget(QWidget *parent) : ConfigTaskWidget(p
|
||||
connect(m_aircraft->fixedWingType, SIGNAL(currentIndexChanged(QString)), this, SLOT(setupAirframeUI(QString)));
|
||||
connect(m_aircraft->multirotorFrameType, SIGNAL(currentIndexChanged(QString)), this, SLOT(setupAirframeUI(QString)));
|
||||
connect(m_aircraft->aircraftType, SIGNAL(currentIndexChanged(int)), this, SLOT(switchAirframeType(int)));
|
||||
requestAircraftUpdate();
|
||||
|
||||
connect(m_aircraft->fwThrottleReset, SIGNAL(clicked()), this, SLOT(resetFwMixer()));
|
||||
connect(m_aircraft->mrThrottleCurveReset, SIGNAL(clicked()), this, SLOT(resetMrMixer()));
|
||||
@ -191,17 +190,22 @@ ConfigAirframeWidget::ConfigAirframeWidget(QWidget *parent) : ConfigTaskWidget(p
|
||||
connect(m_aircraft->ffTestBox2, SIGNAL(clicked(bool)), this, SLOT(enableFFTest()));
|
||||
connect(m_aircraft->ffTestBox3, SIGNAL(clicked(bool)), this, SLOT(enableFFTest()));
|
||||
|
||||
connect(parent, SIGNAL(autopilotConnected()),this, SLOT(requestAircraftUpdate()));
|
||||
enableControls(false);
|
||||
refreshValues();
|
||||
connect(parent, SIGNAL(autopilotConnected()),this, SLOT(onAutopilotConnect()));
|
||||
connect(parent, SIGNAL(autopilotDisconnected()), this, SLOT(onAutopilotDisconnect()));
|
||||
|
||||
// Register for ManualControlSettings changes:
|
||||
obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("SystemSettings")));
|
||||
connect(obj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(requestAircraftUpdate()));
|
||||
connect(obj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(refreshValues()));
|
||||
obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||
connect(obj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(requestAircraftUpdate()));
|
||||
connect(obj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(refreshValues()));
|
||||
obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("ActuatorSettings")));
|
||||
connect(obj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(requestAircraftUpdate()));
|
||||
connect(obj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(refreshValues()));
|
||||
|
||||
// Connect the help button
|
||||
connect(m_aircraft->airframeHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
|
||||
|
||||
}
|
||||
|
||||
ConfigAirframeWidget::~ConfigAirframeWidget()
|
||||
@ -209,6 +213,18 @@ ConfigAirframeWidget::~ConfigAirframeWidget()
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
/**
|
||||
Enable or disable controls depending on whether we're ronnected or not
|
||||
*/
|
||||
void ConfigAirframeWidget::enableControls(bool enable)
|
||||
{
|
||||
//m_aircraft->saveAircraftToRAM->setEnabled(enable);
|
||||
m_aircraft->saveAircraftToSD->setEnabled(enable);
|
||||
//m_aircraft->ffApply->setEnabled(enable);
|
||||
m_aircraft->ffSave->setEnabled(enable);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Slot for switching the airframe type. We do it explicitely
|
||||
rather than a signal in the UI, because we want to force a fitInView of the quad shapes.
|
||||
@ -446,14 +462,13 @@ void ConfigAirframeWidget::updateCustomThrottle2CurveValue(QList<double> list, d
|
||||
* Aircraft settings
|
||||
**************************/
|
||||
/**
|
||||
Request the current value of the SystemSettings which holds the aircraft type
|
||||
Refreshes the current value of the SystemSettings which holds the aircraft type
|
||||
*/
|
||||
void ConfigAirframeWidget::requestAircraftUpdate()
|
||||
void ConfigAirframeWidget::refreshValues()
|
||||
{
|
||||
// Get the Airframe type from the system settings:
|
||||
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("SystemSettings")));
|
||||
Q_ASSERT(obj);
|
||||
// obj->requestUpdate();
|
||||
UAVObjectField *field = obj->getField(QString("AirframeType"));
|
||||
Q_ASSERT(field);
|
||||
// At this stage, we will need to have some hardcoded settings in this code, this
|
||||
@ -463,7 +478,6 @@ void ConfigAirframeWidget::requestAircraftUpdate()
|
||||
|
||||
obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("MixerSettings")));
|
||||
Q_ASSERT(obj);
|
||||
//obj->requestUpdate();
|
||||
field = obj->getField(QString("ThrottleCurve1"));
|
||||
Q_ASSERT(field);
|
||||
QList<double> curveValues;
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "extensionsystem/pluginmanager.h"
|
||||
#include "uavobjectmanager.h"
|
||||
#include "uavobject.h"
|
||||
#include "uavtalk/telemetrymanager.h"
|
||||
#include <QtGui/QWidget>
|
||||
#include <QList>
|
||||
#include <QItemDelegate>
|
||||
@ -57,6 +58,7 @@ private:
|
||||
void updateCustomAirframeUI();
|
||||
bool setupMixer(double mixerFactors[8][3]);
|
||||
void setupMotors(QList<QString> motorList);
|
||||
virtual void enableControls(bool enable);
|
||||
|
||||
void resetField(UAVObjectField * field);
|
||||
void resetMixer (MixerCurveWidget *mixer, int numElements);
|
||||
@ -72,7 +74,7 @@ private:
|
||||
UAVObject::Metadata accInitialData;
|
||||
|
||||
private slots:
|
||||
void requestAircraftUpdate();
|
||||
virtual void refreshValues();
|
||||
void sendAircraftUpdate();
|
||||
void saveAircraftUpdate();
|
||||
void setupAirframeUI(QString type);
|
||||
|
@ -43,13 +43,18 @@ ConfigCCAttitudeWidget::ConfigCCAttitudeWidget(QWidget *parent) :
|
||||
connect(ui->applyButton,SIGNAL(clicked()),this,SLOT(applyAttitudeSettings()));
|
||||
|
||||
// Make it smart:
|
||||
connect(parent, SIGNAL(autopilotConnected()),this, SLOT(getCurrentAttitudeSettings()));
|
||||
getCurrentAttitudeSettings(); // The 1st time this panel is instanciated, the autopilot is already connected.
|
||||
connect(parent, SIGNAL(autopilotConnected()),this, SLOT(onAutopilotConnect()));
|
||||
connect(parent, SIGNAL(autopilotDisconnected()), this, SLOT(onAutopilotDisconnect()));
|
||||
|
||||
enableControls(true);
|
||||
refreshValues(); // The 1st time this panel is instanciated, the autopilot is already connected.
|
||||
UAVObject * settings = getObjectManager()->getObject(QString("AttitudeSettings"));
|
||||
connect(settings,SIGNAL(objectUpdated(UAVObject*)), this, SLOT(getCurrentAttitudeSettings()));
|
||||
connect(settings,SIGNAL(objectUpdated(UAVObject*)), this, SLOT(refreshValues()));
|
||||
|
||||
// Connect the help button
|
||||
connect(ui->ccAttitudeHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
|
||||
|
||||
|
||||
}
|
||||
|
||||
ConfigCCAttitudeWidget::~ConfigCCAttitudeWidget()
|
||||
@ -57,6 +62,12 @@ ConfigCCAttitudeWidget::~ConfigCCAttitudeWidget()
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void ConfigCCAttitudeWidget::enableControls(bool enable)
|
||||
{
|
||||
//ui->applyButton->setEnabled(enable);
|
||||
ui->saveButton->setEnabled(enable);
|
||||
}
|
||||
|
||||
void ConfigCCAttitudeWidget::attitudeRawUpdated(UAVObject * obj) {
|
||||
QMutexLocker locker(&startStop);
|
||||
|
||||
@ -127,7 +138,7 @@ void ConfigCCAttitudeWidget::applyAttitudeSettings() {
|
||||
settings->updated();
|
||||
}
|
||||
|
||||
void ConfigCCAttitudeWidget::getCurrentAttitudeSettings() {
|
||||
void ConfigCCAttitudeWidget::refreshValues() {
|
||||
UAVDataObject * settings = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("AttitudeSettings")));
|
||||
UAVObjectField * field = settings->getField("BoardRotation");
|
||||
ui->rollBias->setValue(field->getDouble(0));
|
||||
|
@ -52,7 +52,7 @@ private slots:
|
||||
void startAccelCalibration();
|
||||
void saveAttitudeSettings();
|
||||
void applyAttitudeSettings();
|
||||
void getCurrentAttitudeSettings();
|
||||
virtual void refreshValues();
|
||||
void openHelp();
|
||||
|
||||
private:
|
||||
@ -67,6 +67,8 @@ private:
|
||||
|
||||
static const int NUM_ACCEL_UPDATES = 60;
|
||||
static const float ACCEL_SCALE = 0.004f * 9.81f;
|
||||
virtual void enableControls(bool enable);
|
||||
|
||||
};
|
||||
|
||||
#endif // CCATTITUDEWIDGET_H
|
||||
|
@ -85,6 +85,7 @@ private:
|
||||
|
||||
int MixerChannelData[6];
|
||||
int ShowDisclaimer(int messageID);
|
||||
virtual void enableControls(bool enable) { Q_UNUSED(enable)}; // Not used by this widget
|
||||
|
||||
private slots:
|
||||
void ccpmSwashplateUpdate();
|
||||
@ -107,10 +108,14 @@ private:
|
||||
void setSwashplateLevel(int percent);
|
||||
void SwashLvlSpinBoxChanged(int value);
|
||||
void FocusChanged(QWidget *oldFocus, QWidget *newFocus);
|
||||
|
||||
virtual void refreshValues() {}; // Not used
|
||||
|
||||
public slots:
|
||||
void requestccpmUpdate();
|
||||
void sendccpmUpdate();
|
||||
void saveccpmUpdate();
|
||||
|
||||
protected:
|
||||
void showEvent(QShowEvent *event);
|
||||
void resizeEvent(QResizeEvent *event);
|
||||
|
@ -90,10 +90,11 @@ ConfigGadgetWidget::ConfigGadgetWidget(QWidget *parent) : QWidget(parent)
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
TelemetryManager* telMngr = pm->getObject<TelemetryManager>();
|
||||
connect(telMngr, SIGNAL(connected()), this, SLOT(onAutopilotConnect()));
|
||||
connect(telMngr, SIGNAL(disconnected()), this, SLOT(onAutopilotDisconnect()));
|
||||
|
||||
// And check whether by any chance we are not already connected
|
||||
if (telMngr->isConnected())
|
||||
onAutopilotConnect();
|
||||
onAutopilotConnect();
|
||||
|
||||
help = 0;
|
||||
}
|
||||
@ -111,6 +112,10 @@ void ConfigGadgetWidget::resizeEvent(QResizeEvent *event)
|
||||
QWidget::resizeEvent(event);
|
||||
}
|
||||
|
||||
void ConfigGadgetWidget::onAutopilotDisconnect() {
|
||||
emit autopilotDisconnected();
|
||||
}
|
||||
|
||||
void ConfigGadgetWidget::onAutopilotConnect() {
|
||||
|
||||
// First of all, check what Board type we are talking to, and
|
||||
@ -135,8 +140,6 @@ void ConfigGadgetWidget::onAutopilotConnect() {
|
||||
ftw->insertTab(3, qwd, QIcon(":/configgadget/images/AHRS-v1.3.png"), QString("INS"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
emit autopilotConnected();
|
||||
}
|
||||
|
||||
|
@ -52,9 +52,11 @@ public:
|
||||
|
||||
public slots:
|
||||
void onAutopilotConnect();
|
||||
void onAutopilotDisconnect();
|
||||
|
||||
signals:
|
||||
void autopilotConnected();
|
||||
void autopilotDisconnected();
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent * event);
|
||||
|
@ -43,8 +43,8 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) : ConfigTaskWidget(parent)
|
||||
m_config = new Ui_InputWidget();
|
||||
m_config->setupUi(this);
|
||||
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
||||
|
||||
// First of all, put all the channel widgets into lists, so that we can
|
||||
// manipulate those:
|
||||
@ -102,7 +102,7 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) : ConfigTaskWidget(parent)
|
||||
|
||||
// Register for ManualControlSettings changes:
|
||||
obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("ManualControlSettings")));
|
||||
connect(obj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(requestRCInputUpdate()));
|
||||
connect(obj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(refreshValues()));
|
||||
|
||||
|
||||
// Get the receiver types supported by OpenPilot and fill the corresponding
|
||||
@ -155,12 +155,14 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) : ConfigTaskWidget(parent)
|
||||
m_config->armControl->clear();
|
||||
m_config->armControl->addItems(field->getOptions());
|
||||
|
||||
requestRCInputUpdate();
|
||||
|
||||
connect(m_config->saveRCInputToSD, SIGNAL(clicked()), this, SLOT(saveRCInputObject()));
|
||||
connect(m_config->saveRCInputToRAM, SIGNAL(clicked()), this, SLOT(sendRCInputUpdate()));
|
||||
|
||||
connect(parent, SIGNAL(autopilotConnected()),this, SLOT(requestRCInputUpdate()));
|
||||
enableControls(false);
|
||||
refreshValues();
|
||||
connect(parent, SIGNAL(autopilotConnected()),this, SLOT(onAutopilotConnect()));
|
||||
connect(parent, SIGNAL(autopilotDisconnected()), this, SLOT(onAutopilotDisconnect()));
|
||||
|
||||
connect(m_config->inSlider0, SIGNAL(valueChanged(int)),this, SLOT(onInSliderValueChanged0(int)));
|
||||
connect(m_config->inSlider1, SIGNAL(valueChanged(int)),this, SLOT(onInSliderValueChanged1(int)));
|
||||
@ -182,20 +184,6 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) : ConfigTaskWidget(parent)
|
||||
|
||||
firstUpdate = true;
|
||||
|
||||
enableControls(false);
|
||||
|
||||
// Ed's note: don't know who added this, this goes against the design
|
||||
// of this plugin (there is a autopilotconnected event managed by the
|
||||
// parent.
|
||||
// Listen to telemetry connection events
|
||||
if (pm) {
|
||||
TelemetryManager *tm = pm->getObject<TelemetryManager>();
|
||||
if (tm) {
|
||||
connect(tm, SIGNAL(connected()), this, SLOT(onTelemetryConnect()));
|
||||
connect(tm, SIGNAL(disconnected()), this, SLOT(onTelemetryDisconnect()));
|
||||
}
|
||||
}
|
||||
|
||||
// Connect the help button
|
||||
connect(m_config->inputHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
|
||||
}
|
||||
@ -266,27 +254,6 @@ void ConfigInputWidget::onInSliderValueChanged7(int value)
|
||||
inNeuLabels[7]->setText(QString::number(value));
|
||||
}
|
||||
|
||||
// ************************************
|
||||
// telemetry start/stop connect/disconnect signals
|
||||
|
||||
void ConfigInputWidget::onTelemetryStart()
|
||||
{
|
||||
}
|
||||
|
||||
void ConfigInputWidget::onTelemetryStop()
|
||||
{
|
||||
}
|
||||
|
||||
void ConfigInputWidget::onTelemetryConnect()
|
||||
{
|
||||
enableControls(true);
|
||||
}
|
||||
|
||||
void ConfigInputWidget::onTelemetryDisconnect()
|
||||
{
|
||||
enableControls(false);
|
||||
m_config->doRCInputCalibration->setChecked(false);
|
||||
}
|
||||
|
||||
// ************************************
|
||||
|
||||
@ -297,21 +264,11 @@ void ConfigInputWidget::onTelemetryDisconnect()
|
||||
*/
|
||||
void ConfigInputWidget::enableControls(bool enable)
|
||||
{
|
||||
// m_config->saveRCInputToRAM->setEnabled(enable);
|
||||
//m_config->saveRCInputToRAM->setEnabled(enable);
|
||||
m_config->saveRCInputToSD->setEnabled(enable);
|
||||
|
||||
m_config->doRCInputCalibration->setEnabled(enable);
|
||||
|
||||
/*
|
||||
m_config->ch0Assign->setEnabled(enable);
|
||||
m_config->ch1Assign->setEnabled(enable);
|
||||
m_config->ch2Assign->setEnabled(enable);
|
||||
m_config->ch3Assign->setEnabled(enable);
|
||||
m_config->ch4Assign->setEnabled(enable);
|
||||
m_config->ch5Assign->setEnabled(enable);
|
||||
m_config->ch6Assign->setEnabled(enable);
|
||||
m_config->ch7Assign->setEnabled(enable);
|
||||
*/
|
||||
m_config->doRCInputCalibration->setChecked(false);
|
||||
}
|
||||
|
||||
|
||||
@ -322,7 +279,7 @@ void ConfigInputWidget::enableControls(bool enable)
|
||||
/**
|
||||
Request the current config from the board
|
||||
*/
|
||||
void ConfigInputWidget::requestRCInputUpdate()
|
||||
void ConfigInputWidget::refreshValues()
|
||||
{
|
||||
UAVDataObject* obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("ManualControlSettings")));
|
||||
Q_ASSERT(obj);
|
||||
|
@ -46,10 +46,6 @@ public:
|
||||
~ConfigInputWidget();
|
||||
|
||||
public slots:
|
||||
void onTelemetryStart();
|
||||
void onTelemetryStop();
|
||||
void onTelemetryConnect();
|
||||
void onTelemetryDisconnect();
|
||||
|
||||
void onInSliderValueChanged0(int value);
|
||||
void onInSliderValueChanged1(int value);
|
||||
@ -82,11 +78,11 @@ private:
|
||||
|
||||
bool firstUpdate;
|
||||
|
||||
void enableControls(bool enable);
|
||||
virtual void enableControls(bool enable);
|
||||
|
||||
private slots:
|
||||
void updateChannels(UAVObject* obj);
|
||||
void requestRCInputUpdate();
|
||||
virtual void refreshValues();
|
||||
void sendRCInputUpdate();
|
||||
void saveRCInputObject();
|
||||
void reverseCheckboxClicked(bool state);
|
||||
|
@ -97,18 +97,17 @@ ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(paren
|
||||
<< m_config->ch7Rev;
|
||||
|
||||
links << m_config->ch0Link
|
||||
<< m_config->ch1Link
|
||||
<< m_config->ch2Link
|
||||
<< m_config->ch3Link
|
||||
<< m_config->ch4Link
|
||||
<< m_config->ch5Link
|
||||
<< m_config->ch6Link
|
||||
<< m_config->ch7Link;
|
||||
<< m_config->ch1Link
|
||||
<< m_config->ch2Link
|
||||
<< m_config->ch3Link
|
||||
<< m_config->ch4Link
|
||||
<< m_config->ch5Link
|
||||
<< m_config->ch6Link
|
||||
<< m_config->ch7Link;
|
||||
|
||||
// Register for ActuatorSettings changes:
|
||||
UAVDataObject * obj = dynamic_cast<UAVDataObject*>(objManager->getObject(QString("ActuatorSettings")));
|
||||
connect(obj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(requestRCOutputUpdate()));
|
||||
|
||||
connect(obj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(refreshValues()));
|
||||
|
||||
for (int i = 0; i < 8; i++) {
|
||||
connect(outMin[i], SIGNAL(editingFinished()), this, SLOT(setChOutRange()));
|
||||
@ -128,28 +127,15 @@ ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(paren
|
||||
connect(m_config->saveRCOutputToSD, SIGNAL(clicked()), this, SLOT(saveRCOutputObject()));
|
||||
connect(m_config->saveRCOutputToRAM, SIGNAL(clicked()), this, SLOT(sendRCOutputUpdate()));
|
||||
|
||||
connect(parent, SIGNAL(autopilotConnected()),this, SLOT(requestRCOutputUpdate()));
|
||||
requestRCOutputUpdate();
|
||||
enableControls(false);
|
||||
refreshValues();
|
||||
connect(parent, SIGNAL(autopilotConnected()),this, SLOT(onAutopilotConnect()));
|
||||
connect(parent, SIGNAL(autopilotDisconnected()), this, SLOT(onAutopilotDisconnect()));
|
||||
|
||||
firstUpdate = true;
|
||||
|
||||
connect(m_config->spinningArmed, SIGNAL(toggled(bool)), this, SLOT(setSpinningArmed(bool)));
|
||||
|
||||
enableControls(false);
|
||||
|
||||
// Listen to telemetry connection events
|
||||
if (pm)
|
||||
{
|
||||
TelemetryManager *tm = pm->getObject<TelemetryManager>();
|
||||
if (tm)
|
||||
{
|
||||
connect(tm, SIGNAL(myStart()), this, SLOT(onTelemetryStart()));
|
||||
connect(tm, SIGNAL(myStop()), this, SLOT(onTelemetryStop()));
|
||||
connect(tm, SIGNAL(connected()), this, SLOT(onTelemetryConnect()));
|
||||
connect(tm, SIGNAL(disconnected()), this, SLOT(onTelemetryDisconnect()));
|
||||
}
|
||||
}
|
||||
|
||||
// Connect the help button
|
||||
connect(m_config->outputHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
|
||||
}
|
||||
@ -160,34 +146,12 @@ ConfigOutputWidget::~ConfigOutputWidget()
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ************************************
|
||||
// telemetry start/stop connect/disconnect signals
|
||||
|
||||
void ConfigOutputWidget::onTelemetryStart()
|
||||
{
|
||||
}
|
||||
|
||||
void ConfigOutputWidget::onTelemetryStop()
|
||||
{
|
||||
}
|
||||
|
||||
void ConfigOutputWidget::onTelemetryConnect()
|
||||
{
|
||||
enableControls(true);
|
||||
}
|
||||
|
||||
void ConfigOutputWidget::onTelemetryDisconnect()
|
||||
{
|
||||
enableControls(false);
|
||||
}
|
||||
|
||||
// ************************************
|
||||
|
||||
void ConfigOutputWidget::enableControls(bool enable)
|
||||
{
|
||||
m_config->saveRCOutputToSD->setEnabled(enable);
|
||||
m_config->saveRCOutputToRAM->setEnabled(enable);
|
||||
//m_config->saveRCOutputToRAM->setEnabled(enable);
|
||||
}
|
||||
|
||||
// ************************************
|
||||
@ -391,7 +355,7 @@ void ConfigOutputWidget::sendChannelTest(int value)
|
||||
/**
|
||||
Request the current config from the board (RC Output)
|
||||
*/
|
||||
void ConfigOutputWidget::requestRCOutputUpdate()
|
||||
void ConfigOutputWidget::refreshValues()
|
||||
{
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
||||
|
@ -46,12 +46,6 @@ public:
|
||||
ConfigOutputWidget(QWidget *parent = 0);
|
||||
~ConfigOutputWidget();
|
||||
|
||||
public slots:
|
||||
void onTelemetryStart();
|
||||
void onTelemetryStop();
|
||||
void onTelemetryConnect();
|
||||
void onTelemetryDisconnect();
|
||||
|
||||
private:
|
||||
Ui_OutputWidget *m_config;
|
||||
|
||||
@ -75,10 +69,10 @@ private:
|
||||
|
||||
bool firstUpdate;
|
||||
|
||||
void enableControls(bool enable);
|
||||
virtual void enableControls(bool enable);
|
||||
|
||||
private slots:
|
||||
void requestRCOutputUpdate();
|
||||
virtual void refreshValues();
|
||||
void sendRCOutputUpdate();
|
||||
void saveRCOutputObject();
|
||||
void runChannelTests(bool state);
|
||||
|
@ -43,14 +43,17 @@ ConfigStabilizationWidget::ConfigStabilizationWidget(QWidget *parent) : ConfigTa
|
||||
m_stabilization->setupUi(this);
|
||||
|
||||
|
||||
requestStabilizationUpdate();
|
||||
connect(m_stabilization->saveStabilizationToSD, SIGNAL(clicked()), this, SLOT(saveStabilizationUpdate()));
|
||||
connect(m_stabilization->saveStabilizationToRAM, SIGNAL(clicked()), this, SLOT(sendStabilizationUpdate()));
|
||||
|
||||
connect(parent, SIGNAL(autopilotConnected()),this, SLOT(requestStabilizationUpdate()));
|
||||
enableControls(false);
|
||||
refreshValues();
|
||||
connect(parent, SIGNAL(autopilotConnected()),this, SLOT(onAutopilotConnect()));
|
||||
connect(parent, SIGNAL(autopilotDisconnected()),this, SLOT(onAutopilotDisconnect()));
|
||||
|
||||
// Now connect the widget to the StabilizationSettings object
|
||||
UAVObject *obj = getObjectManager()->getObject(QString("StabilizationSettings"));
|
||||
connect(obj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(requestStabilizationUpdate()));
|
||||
connect(obj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(refreshValues()));
|
||||
|
||||
// Create a timer to regularly send the object update in case
|
||||
// we want realtime updates.
|
||||
@ -84,6 +87,12 @@ ConfigStabilizationWidget::~ConfigStabilizationWidget()
|
||||
}
|
||||
|
||||
|
||||
void ConfigStabilizationWidget::enableControls(bool enable)
|
||||
{
|
||||
//m_stabilization->saveStabilizationToRAM->setEnabled(enable);
|
||||
m_stabilization->saveStabilizationToSD->setEnabled(enable);
|
||||
}
|
||||
|
||||
void ConfigStabilizationWidget::updateRateRollKP(double val)
|
||||
{
|
||||
if (m_stabilization->linkRateRP->isChecked()) {
|
||||
@ -178,9 +187,9 @@ void ConfigStabilizationWidget::updatePitchILimit(double val)
|
||||
/**
|
||||
Request stabilization settings from the board
|
||||
*/
|
||||
void ConfigStabilizationWidget::requestStabilizationUpdate()
|
||||
void ConfigStabilizationWidget::refreshValues()
|
||||
{
|
||||
// Not needed anymore as this slot is called whenever we get
|
||||
// Not needed anymore as this slot is only called whenever we get
|
||||
// a signal that the object was just updated
|
||||
// stabSettings->requestUpdate();
|
||||
StabilizationSettings::DataFields stabData = stabSettings->getData();
|
||||
|
@ -49,9 +49,10 @@ private:
|
||||
Ui_StabilizationWidget *m_stabilization;
|
||||
StabilizationSettings* stabSettings;
|
||||
QTimer updateTimer;
|
||||
virtual void enableControls(bool enable);
|
||||
|
||||
private slots:
|
||||
void requestStabilizationUpdate();
|
||||
virtual void refreshValues();
|
||||
void sendStabilizationUpdate();
|
||||
void saveStabilizationUpdate();
|
||||
void realtimeUpdateToggle(bool);
|
||||
|
@ -62,6 +62,21 @@ double ConfigTaskWidget::listMean(QList<double> list)
|
||||
return accum / list.size();
|
||||
}
|
||||
|
||||
// ************************************
|
||||
// telemetry start/stop connect/disconnect signals
|
||||
|
||||
void ConfigTaskWidget::onAutopilotDisconnect()
|
||||
{
|
||||
enableControls(false);
|
||||
}
|
||||
|
||||
void ConfigTaskWidget::onAutopilotConnect()
|
||||
{
|
||||
enableControls(true);
|
||||
refreshValues();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@}
|
||||
|
@ -48,9 +48,15 @@ public:
|
||||
UAVObjectManager* getObjectManager();
|
||||
static double listMean(QList<double> list);
|
||||
|
||||
public slots:
|
||||
void onAutopilotDisconnect();
|
||||
void onAutopilotConnect();
|
||||
|
||||
private slots:
|
||||
virtual void refreshValues() = 0;
|
||||
|
||||
private:
|
||||
virtual void enableControls(bool enable) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
@ -47,13 +47,14 @@ ConfigTelemetryWidget::ConfigTelemetryWidget(QWidget *parent) : ConfigTaskWidget
|
||||
UAVObjectField *field = obj->getField(QString("Speed"));
|
||||
m_telemetry->telemetrySpeed->addItems(field->getOptions());
|
||||
|
||||
requestTelemetryUpdate();
|
||||
connect(m_telemetry->saveTelemetryToSD, SIGNAL(clicked()), this, SLOT(saveTelemetryUpdate()));
|
||||
connect(m_telemetry->saveTelemetryToRAM, SIGNAL(clicked()), this, SLOT(sendTelemetryUpdate()));
|
||||
connect(obj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(requestTelemetryUpdate()));
|
||||
connect(obj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(refreshValues()));
|
||||
|
||||
connect(parent, SIGNAL(autopilotConnected()),this, SLOT(requestTelemetryUpdate()));
|
||||
requestTelemetryUpdate();
|
||||
enableControls(false);
|
||||
refreshValues();
|
||||
connect(parent, SIGNAL(autopilotConnected()),this, SLOT(onAutopilotConnect()));
|
||||
connect(parent, SIGNAL(autopilotDisconnected()),this, SLOT(onAutopilotDisconnect()));
|
||||
}
|
||||
|
||||
ConfigTelemetryWidget::~ConfigTelemetryWidget()
|
||||
@ -66,10 +67,16 @@ ConfigTelemetryWidget::~ConfigTelemetryWidget()
|
||||
* Telemetry Settings
|
||||
*****************************/
|
||||
|
||||
void ConfigTelemetryWidget::enableControls(bool enable)
|
||||
{
|
||||
m_telemetry->saveTelemetryToSD->setEnabled(enable);
|
||||
//m_telemetry->saveTelemetryToRAM->setEnabled(enable);
|
||||
}
|
||||
|
||||
/**
|
||||
Request telemetry settings from the board
|
||||
*/
|
||||
void ConfigTelemetryWidget::requestTelemetryUpdate()
|
||||
void ConfigTelemetryWidget::refreshValues()
|
||||
{
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
UAVObjectManager *objManager = pm->getObject<UAVObjectManager>();
|
||||
@ -102,5 +109,3 @@ void ConfigTelemetryWidget::saveTelemetryUpdate()
|
||||
Q_ASSERT(obj);
|
||||
saveObjectToSD(obj);
|
||||
}
|
||||
|
||||
|
||||
|
@ -46,9 +46,10 @@ public:
|
||||
|
||||
private:
|
||||
Ui_TelemetryWidget *m_telemetry;
|
||||
void enableControls(bool enable);
|
||||
|
||||
private slots:
|
||||
void requestTelemetryUpdate();
|
||||
virtual void refreshValues();
|
||||
void sendTelemetryUpdate();
|
||||
void saveTelemetryUpdate();
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include <QDebug>
|
||||
|
||||
DefaultAttitudeWidget::DefaultAttitudeWidget(QWidget *parent) :
|
||||
ConfigTaskWidget(parent),
|
||||
QWidget(parent),
|
||||
ui(new Ui_defaultattitude)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
@ -38,7 +38,7 @@
|
||||
|
||||
class Ui_Widget;
|
||||
|
||||
class DefaultAttitudeWidget : public ConfigTaskWidget
|
||||
class DefaultAttitudeWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user