(objManager->getObject(QString("ActuatorSettings")));
Q_ASSERT(obj);
- obj->requestUpdate();
+ // obj->requestUpdate();
MinField = obj->getField(QString("ChannelMin"));
NeutralField = obj->getField(QString("ChannelNeutral"));
MaxField = obj->getField(QString("ChannelMax"));
@@ -1561,8 +1559,7 @@ void ConfigccpmWidget::SwashLvlFinishButtonPressed()
}
obj->updated();
-
- updateObjectPersistance(ObjectPersistence::OPERATION_SAVE, obj);
+ saveObjectToSD(obj);
//restore Flight control of ActuatorCommand
enableSwashplateLevellingControl(false);
@@ -1591,7 +1588,7 @@ int ConfigccpmWidget::ShowDisclaimer(int messageID)
break;
case 1:
// Not Tested disclaimer
- msgBox.setInformativeText("The CCPM mixer code has not been used to fly a helicopter!
Use it at your own risk!
Do you wish to continue?");
+ msgBox.setInformativeText("
The CCPM mixer code needs more testing!
Use it at your own risk!
Do you wish to continue?");
msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel);
msgBox.setDefaultButton(QMessageBox::Cancel);
msgBox.setIcon(QMessageBox::Warning);
diff --git a/ground/openpilotgcs/src/plugins/config/configccpmwidget.h b/ground/openpilotgcs/src/plugins/config/configccpmwidget.h
index 7eb95a5f1..12390a0f2 100644
--- a/ground/openpilotgcs/src/plugins/config/configccpmwidget.h
+++ b/ground/openpilotgcs/src/plugins/config/configccpmwidget.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();
@@ -109,10 +110,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);
diff --git a/ground/openpilotgcs/src/plugins/config/configgadgetwidget.cpp b/ground/openpilotgcs/src/plugins/config/configgadgetwidget.cpp
index b49ccf1df..f19b414c4 100644
--- a/ground/openpilotgcs/src/plugins/config/configgadgetwidget.cpp
+++ b/ground/openpilotgcs/src/plugins/config/configgadgetwidget.cpp
@@ -90,10 +90,11 @@ ConfigGadgetWidget::ConfigGadgetWidget(QWidget *parent) : QWidget(parent)
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
TelemetryManager* telMngr = pm->getObject();
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();
}
diff --git a/ground/openpilotgcs/src/plugins/config/configgadgetwidget.h b/ground/openpilotgcs/src/plugins/config/configgadgetwidget.h
index 2520458eb..43db58429 100644
--- a/ground/openpilotgcs/src/plugins/config/configgadgetwidget.h
+++ b/ground/openpilotgcs/src/plugins/config/configgadgetwidget.h
@@ -52,9 +52,11 @@ public:
public slots:
void onAutopilotConnect();
+ void onAutopilotDisconnect();
signals:
void autopilotConnected();
+ void autopilotDisconnected();
protected:
void resizeEvent(QResizeEvent * event);
diff --git a/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp b/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp
index 9ee8f6bb7..da1038c03 100644
--- a/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp
+++ b/ground/openpilotgcs/src/plugins/config/configinputwidget.cpp
@@ -38,13 +38,15 @@
#include
#include
+#include "manualcontrolsettings.h"
+
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();
+ ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
+ UAVObjectManager *objManager = pm->getObject();
// First of all, put all the channel widgets into lists, so that we can
// manipulate those:
@@ -68,15 +70,6 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) : ConfigTaskWidget(parent)
<< m_config->ch6Min
<< m_config->ch7Min;
- inNeuLabels << m_config->ch0Cur
- << m_config->ch1Cur
- << m_config->ch2Cur
- << m_config->ch3Cur
- << m_config->ch4Cur
- << m_config->ch5Cur
- << m_config->ch6Cur
- << m_config->ch7Cur;
-
inSliders << m_config->inSlider0
<< m_config->inSlider1
<< m_config->inSlider2
@@ -95,12 +88,24 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) : ConfigTaskWidget(parent)
<< m_config->ch6Rev
<< m_config->ch7Rev;
+ inChannelAssign << m_config->ch0Assign
+ << m_config->ch1Assign
+ << m_config->ch2Assign
+ << m_config->ch3Assign
+ << m_config->ch4Assign
+ << m_config->ch5Assign
+ << m_config->ch6Assign
+ << m_config->ch7Assign;
// Now connect the widget to the ManualControlCommand / Channel UAVObject
-
UAVDataObject* obj = dynamic_cast(objManager->getObject(QString("ManualControlCommand")));
connect(obj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(updateChannels(UAVObject*)));
+ // Register for ManualControlSettings changes:
+ obj = dynamic_cast(objManager->getObject(QString("ManualControlSettings")));
+ connect(obj,SIGNAL(objectUpdated(UAVObject*)),this,SLOT(refreshValues()));
+
+
// Get the receiver types supported by OpenPilot and fill the corresponding
// dropdown menu:
obj = dynamic_cast(objManager->getObject(QString("ManualControlSettings")));
@@ -151,22 +156,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(m_config->getRCInputCurrent, SIGNAL(clicked()), this, SLOT(requestRCInputUpdate()));
- connect(parent, SIGNAL(autopilotConnected()),this, SLOT(requestRCInputUpdate()));
-
- connect(m_config->inSlider0, SIGNAL(valueChanged(int)),this, SLOT(onInSliderValueChanged0(int)));
- connect(m_config->inSlider1, SIGNAL(valueChanged(int)),this, SLOT(onInSliderValueChanged1(int)));
- connect(m_config->inSlider2, SIGNAL(valueChanged(int)),this, SLOT(onInSliderValueChanged2(int)));
- connect(m_config->inSlider3, SIGNAL(valueChanged(int)),this, SLOT(onInSliderValueChanged3(int)));
- connect(m_config->inSlider4, SIGNAL(valueChanged(int)),this, SLOT(onInSliderValueChanged4(int)));
- connect(m_config->inSlider5, SIGNAL(valueChanged(int)),this, SLOT(onInSliderValueChanged5(int)));
- connect(m_config->inSlider6, SIGNAL(valueChanged(int)),this, SLOT(onInSliderValueChanged6(int)));
- connect(m_config->inSlider7, SIGNAL(valueChanged(int)),this, SLOT(onInSliderValueChanged7(int)));
+ enableControls(false);
+ refreshValues();
+ connect(parent, SIGNAL(autopilotConnected()),this, SLOT(onAutopilotConnect()));
+ connect(parent, SIGNAL(autopilotDisconnected()), this, SLOT(onAutopilotDisconnect()));
connect(m_config->ch0Rev, SIGNAL(toggled(bool)), this, SLOT(reverseCheckboxClicked(bool)));
connect(m_config->ch1Rev, SIGNAL(toggled(bool)), this, SLOT(reverseCheckboxClicked(bool)));
@@ -179,19 +176,6 @@ ConfigInputWidget::ConfigInputWidget(QWidget *parent) : ConfigTaskWidget(parent)
firstUpdate = true;
- enableControls(false);
-
- // Listen to telemetry connection events
- if (pm) {
- TelemetryManager *tm = pm->getObject();
- 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->inputHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
}
@@ -219,89 +203,19 @@ void ConfigInputWidget::reverseCheckboxClicked(bool state)
}
}
-// ************************************
-// slider value changed signals
-
-void ConfigInputWidget::onInSliderValueChanged0(int value)
-{
- inNeuLabels[0]->setText(QString::number(value));
-}
-
-void ConfigInputWidget::onInSliderValueChanged1(int value)
-{
- inNeuLabels[1]->setText(QString::number(value));
-}
-
-void ConfigInputWidget::onInSliderValueChanged2(int value)
-{
- inNeuLabels[2]->setText(QString::number(value));
-}
-
-void ConfigInputWidget::onInSliderValueChanged3(int value)
-{
- inNeuLabels[3]->setText(QString::number(value));
-}
-
-void ConfigInputWidget::onInSliderValueChanged4(int value)
-{
- inNeuLabels[4]->setText(QString::number(value));
-}
-
-void ConfigInputWidget::onInSliderValueChanged5(int value)
-{
- inNeuLabels[5]->setText(QString::number(value));
-}
-
-void ConfigInputWidget::onInSliderValueChanged6(int value)
-{
- inNeuLabels[6]->setText(QString::number(value));
-}
-
-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);
-}
// ************************************
+/*
+ Enable or disable some controls depending on whether we are connected
+ or not to the board. Actually, this i mostly useless IMHO, I don't
+ know who added this into the code (Ed's note)
+ */
void ConfigInputWidget::enableControls(bool enable)
{
- m_config->getRCInputCurrent->setEnabled(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);
}
@@ -312,11 +226,11 @@ void ConfigInputWidget::enableControls(bool enable)
/**
Request the current config from the board
*/
-void ConfigInputWidget::requestRCInputUpdate()
+void ConfigInputWidget::refreshValues()
{
UAVDataObject* obj = dynamic_cast(getObjectManager()->getObject(QString("ManualControlSettings")));
Q_ASSERT(obj);
- obj->requestUpdate();
+ //obj->requestUpdate();
UAVObjectField *field;
// Now update all the slider values:
@@ -350,14 +264,9 @@ void ConfigInputWidget::requestRCInputUpdate()
m_config->receiverType->setCurrentIndex(m_config->receiverType->findText(field->getValue().toString()));
// Reset all channel assignement dropdowns:
- m_config->ch0Assign->setCurrentIndex(0);
- m_config->ch1Assign->setCurrentIndex(0);
- m_config->ch2Assign->setCurrentIndex(0);
- m_config->ch3Assign->setCurrentIndex(0);
- m_config->ch4Assign->setCurrentIndex(0);
- m_config->ch5Assign->setCurrentIndex(0);
- m_config->ch6Assign->setCurrentIndex(0);
- m_config->ch7Assign->setCurrentIndex(0);
+ foreach (QComboBox *combo, inChannelAssign) {
+ combo->setCurrentIndex(0);
+ }
// Update all channels assignements
QList fieldList = obj->getFields();
@@ -508,11 +417,9 @@ void ConfigInputWidget::saveRCInputObject()
{
// Send update so that the latest value is saved
sendRCInputUpdate();
- ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
- UAVObjectManager *objManager = pm->getObject();
- UAVDataObject* obj = dynamic_cast(objManager->getObject(QString("ManualControlSettings")));
+ UAVDataObject* obj = dynamic_cast(getObjectManager()->getObject(QString("ManualControlSettings")));
Q_ASSERT(obj);
- updateObjectPersistance(ObjectPersistence::OPERATION_SAVE, obj);
+ saveObjectToSD(obj);
}
@@ -567,35 +474,38 @@ void ConfigInputWidget::updateChannels(UAVObject* controlCommand)
if (m_config->doRCInputCalibration->isChecked()) {
if (firstUpdate) {
- // Increase the data rate from the board so that the sliders
- // move faster
- UAVObject::Metadata mdata = controlCommand->getMetadata();
- mdata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_PERIODIC;
- mccDataRate = mdata.flightTelemetryUpdatePeriod;
- mdata.flightTelemetryUpdatePeriod = 150;
- controlCommand->setMetadata(mdata);
-
- // Also protect the user by setting all values to zero
- // and making the ActuatorCommand object readonly
- UAVDataObject* obj = dynamic_cast(getObjectManager()->getObject(QString("ActuatorCommand")));
- mdata = obj->getMetadata();
- mdata.flightAccess = UAVObject::ACCESS_READONLY;
- obj->setMetadata(mdata);
- UAVObjectField *field = obj->getField("Channel");
- for (int i=0; i< field->getNumElements(); i++) {
- field->setValue(0,i);
- }
- obj->updated();
+ // Increase the data rate from the board so that the sliders
+ // move faster
+ UAVObject::Metadata mdata = controlCommand->getMetadata();
+ mdata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_PERIODIC;
+ mccDataRate = mdata.flightTelemetryUpdatePeriod;
+ mdata.flightTelemetryUpdatePeriod = 150;
+ controlCommand->setMetadata(mdata);
+ // Also protect the user by setting all values to zero
+ // and making the ActuatorCommand object readonly
+ UAVDataObject* obj = dynamic_cast(getObjectManager()->getObject(QString("ActuatorCommand")));
+ mdata = obj->getMetadata();
+ mdata.flightAccess = UAVObject::ACCESS_READONLY;
+ obj->setMetadata(mdata);
+ UAVObjectField *field = obj->getField("Channel");
+ for (uint i=0; i< field->getNumElements(); i++) {
+ field->setValue(0,i);
}
+ obj->updated();
+
+ // Last, make sure the user won't apply/save during calibration
+ m_config->saveRCInputToRAM->setEnabled(false);
+ m_config->saveRCInputToSD->setEnabled(false);
+ }
field = controlCommand->getField(QString("Channel"));
for (int i = 0; i < 8; i++)
updateChannelInSlider(inSliders[i], inMinLabels[i], inMaxLabels[i], field->getValue(i).toInt(),inRevCheckboxes[i]->isChecked());
firstUpdate = false;
- }
- else {
- if (!firstUpdate) {
+ }
+ else {
+ if (!firstUpdate) {
// Restore original data rate from the board:
UAVObject::Metadata mdata = controlCommand->getMetadata();
mdata.flightTelemetryUpdateMode = UAVObject::UPDATEMODE_PERIODIC;
@@ -606,44 +516,83 @@ void ConfigInputWidget::updateChannels(UAVObject* controlCommand)
mdata = obj->getMetadata();
mdata.flightAccess = UAVObject::ACCESS_READWRITE;
obj->setMetadata(mdata);
+
+ // Set some slider values to better defaults
+ // Find what channel we used for throttle, set it 5% about min:
+ int throttleChannel = -1;
+ int fmChannel = -1;
+ for (int i=0; i < inChannelAssign.length(); i++) {
+ if (inChannelAssign.at(i)->currentText() == "Throttle") {
+ // TODO: this is very ugly, because this relies on the name of the
+ // channel input, everywhere else in the gadget we don't rely on the
+ // naming...
+ throttleChannel = i;
+ }
+ if (inChannelAssign.at(i)->currentText() == "FlightMode") {
+ // TODO: this is very ugly, because this relies on the name of the
+ // channel input, everywhere else in the gadget we don't rely on the
+ // naming...
+ fmChannel = i;
+ }
+ }
+
+ // Throttle neutral defaults to 2% of range
+ if (throttleChannel > -1) {
+ inSliders.at(throttleChannel)->setValue(
+ inSliders.at(throttleChannel)->minimum() +
+ (inSliders.at(throttleChannel)->maximum()-
+ inSliders.at(throttleChannel)->minimum())*0.02);
+ }
+
+ // Flight mode at 50% of range:
+ if (fmChannel > -1) {
+ inSliders.at(fmChannel)->setValue(
+ inSliders.at(fmChannel)->minimum()+
+ (inSliders.at(fmChannel)->maximum()-
+ inSliders.at(fmChannel)->minimum())*0.5);
+ }
+
+ m_config->saveRCInputToRAM->setEnabled(true);
+ m_config->saveRCInputToSD->setEnabled(true);
}
firstUpdate = true;
}
+
//Update the Flight mode channel slider
- UAVObject* obj = getObjectManager()->getObject("ManualControlSettings");
- // Find the channel currently assigned to flightmode
- field = obj->getField("FlightMode");
- int chIndex = field->getOptions().indexOf(field->getValue().toString());
- if (chIndex < field->getOptions().length() - 1) {
+ ManualControlSettings * manualSettings = ManualControlSettings::GetInstance(getObjectManager());
+ ManualControlSettings::DataFields manualSettingsData = manualSettings->getData();
+ uint chIndex = manualSettingsData.FlightMode;
+ if (chIndex < manualSettings->FLIGHTMODE_NONE) {
float valueScaled;
- int chMin = inSliders[chIndex]->minimum();
- int chMax = inSliders[chIndex]->maximum();
- int chNeutral = inSliders[chIndex]->value();
+ int chMin = manualSettingsData.ChannelMin[chIndex];
+ int chMax = manualSettingsData.ChannelMax[chIndex];
+ int chNeutral = manualSettingsData.ChannelNeutral[chIndex];
int value = controlCommand->getField("Channel")->getValue(chIndex).toInt();
if ((chMax > chMin && value >= chNeutral) || (chMin > chMax && value <= chNeutral))
{
- if (chMax != chNeutral)
- valueScaled = (float)(value - chNeutral) / (float)(chMax - chNeutral);
- else
- valueScaled = 0;
+ if (chMax != chNeutral)
+ valueScaled = (float)(value - chNeutral) / (float)(chMax - chNeutral);
+ else
+ valueScaled = 0;
}
else
{
- if (chMin != chNeutral)
- valueScaled = (float)(value - chNeutral) / (float)(chNeutral - chMin);
- else
- valueScaled = 0;
+ if (chMin != chNeutral)
+ valueScaled = (float)(value - chNeutral) / (float)(chNeutral - chMin);
+ else
+ valueScaled = 0;
}
- // Bound
- if (valueScaled > 1.0) valueScaled = 1.0;
- else
- if (valueScaled < -1.0) valueScaled = -1.0;
+ if(valueScaled < -(1.0 / 3.0))
+ m_config->fmsSlider->setValue(-100);
+ else if (valueScaled > (1.0/3.0))
+ m_config->fmsSlider->setValue(100);
+ else
+ m_config->fmsSlider->setValue(0);
- m_config->fmsSlider->setValue(valueScaled * 100);
- }
+ }
}
void ConfigInputWidget::updateChannelInSlider(QSlider *slider, QLabel *min, QLabel *max, int value, bool reversed)
diff --git a/ground/openpilotgcs/src/plugins/config/configinputwidget.h b/ground/openpilotgcs/src/plugins/config/configinputwidget.h
index 5747ee35d..3017c5677 100644
--- a/ground/openpilotgcs/src/plugins/config/configinputwidget.h
+++ b/ground/openpilotgcs/src/plugins/config/configinputwidget.h
@@ -46,19 +46,6 @@ public:
~ConfigInputWidget();
public slots:
- void onTelemetryStart();
- void onTelemetryStop();
- void onTelemetryConnect();
- void onTelemetryDisconnect();
-
- void onInSliderValueChanged0(int value);
- void onInSliderValueChanged1(int value);
- void onInSliderValueChanged2(int value);
- void onInSliderValueChanged3(int value);
- void onInSliderValueChanged4(int value);
- void onInSliderValueChanged5(int value);
- void onInSliderValueChanged6(int value);
- void onInSliderValueChanged7(int value);
private:
Ui_InputWidget *m_config;
@@ -79,14 +66,15 @@ private:
QList inMinLabels;
QList inNeuLabels;
QList inRevCheckboxes;
+ QList inChannelAssign;
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);
diff --git a/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp b/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp
index 27858e111..1a961805b 100644
--- a/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp
+++ b/ground/openpilotgcs/src/plugins/config/configoutputwidget.cpp
@@ -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(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()));
@@ -120,41 +119,23 @@ ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(paren
connect(m_config->channelOutTest, SIGNAL(toggled(bool)), this, SLOT(runChannelTests(bool)));
- for (int i = 0; i < links.count(); i++)
- links[i]->setChecked(false);
- for (int i = 0; i < links.count(); i++)
- connect(links[i], SIGNAL(toggled(bool)), this, SLOT(linkToggled(bool)));
-
- requestRCOutputUpdate();
+ for (int i = 0; i < links.count(); i++)
+ links[i]->setChecked(false);
+ for (int i = 0; i < links.count(); i++)
+ connect(links[i], SIGNAL(toggled(bool)), this, SLOT(linkToggled(bool)));
connect(m_config->saveRCOutputToSD, SIGNAL(clicked()), this, SLOT(saveRCOutputObject()));
connect(m_config->saveRCOutputToRAM, SIGNAL(clicked()), this, SLOT(sendRCOutputUpdate()));
- // Actually, this is not really needed since we are subscribing to the object updates already
- // TODO: remove those buttons on all config gadget panels.
- connect(m_config->getRCOutputCurrent, SIGNAL(clicked()), this, SLOT(requestRCOutputUpdate()));
-
- connect(parent, SIGNAL(autopilotConnected()),this, SLOT(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();
- 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()));
}
@@ -165,35 +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->getRCOutputCurrent->setEnabled(enable);
+ //m_config->saveRCOutputToRAM->setEnabled(enable);
}
// ************************************
@@ -203,29 +161,30 @@ void ConfigOutputWidget::enableControls(bool enable)
*/
void ConfigOutputWidget::linkToggled(bool state)
{
- // find the minimum slider value for the linked ones
- int min = 10000;
- int linked_count = 0;
- for (int i = 0; i < outSliders.count(); i++)
- {
- if (!links[i]->checkState()) continue;
- int value = outSliders[i]->value();
- if (min > value) min = value;
- linked_count++;
- }
+ Q_UNUSED(state)
+ // find the minimum slider value for the linked ones
+ int min = 10000;
+ int linked_count = 0;
+ for (int i = 0; i < outSliders.count(); i++)
+ {
+ if (!links[i]->checkState()) continue;
+ int value = outSliders[i]->value();
+ if (min > value) min = value;
+ linked_count++;
+ }
- if (linked_count <= 0)
- return; // no linked channels
+ if (linked_count <= 0)
+ return; // no linked channels
- if (!m_config->channelOutTest->checkState())
- return; // we are not in Test Output mode
+ if (!m_config->channelOutTest->checkState())
+ return; // we are not in Test Output mode
- // set the linked channels to the same value
- for (int i = 0; i < outSliders.count(); i++)
- {
- if (!links[i]->checkState()) continue;
- outSliders[i]->setValue(min);
- }
+ // set the linked channels to the same value
+ for (int i = 0; i < outSliders.count(); i++)
+ {
+ if (!links[i]->checkState()) continue;
+ outSliders[i]->setValue(min);
+ }
}
/**
@@ -237,7 +196,7 @@ void ConfigOutputWidget::runChannelTests(bool state)
// Confirm this is definitely what they want
if(state) {
QMessageBox mbox;
- mbox.setText(QString(tr("This option will requires you to be in the armed state and will start your motors by the amount selected on the sliders. It is recommended to remove any blades from motors. Are you sure you want to do this?")));
+ mbox.setText(QString(tr("This option will start your motors by the amount selected on the sliders regardless of transmitter. It is recommended to remove any blades from motors. Are you sure you want to do this?")));
mbox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
int retval = mbox.exec();
if(retval != QMessageBox::Yes) {
@@ -396,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();
@@ -534,11 +493,9 @@ void ConfigOutputWidget::saveRCOutputObject()
{
// Send update so that the latest value is saved
sendRCOutputUpdate();
- ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
- UAVObjectManager *objManager = pm->getObject();
- UAVDataObject* obj = dynamic_cast(objManager->getObject(QString("ActuatorSettings")));
+ UAVDataObject* obj = dynamic_cast(getObjectManager()->getObject(QString("ActuatorSettings")));
Q_ASSERT(obj);
- updateObjectPersistance(ObjectPersistence::OPERATION_SAVE, obj);
+ saveObjectToSD(obj);
}
@@ -547,8 +504,8 @@ void ConfigOutputWidget::saveRCOutputObject()
Sets the minimum/maximum value of the channel 0 to seven output sliders.
Have to do it here because setMinimum is not a slot.
- One added trick: if the slider is at either its max or its min when the value
- is changed, then keep it on the max/min.
+ One added trick: if the slider is at its min when the value
+ is changed, then keep it on the min.
*/
void ConfigOutputWidget::setChOutRange()
{
@@ -561,7 +518,7 @@ void ConfigOutputWidget::setChOutRange()
QSlider *slider = outSliders[index];
int oldMini = slider->minimum();
- int oldMaxi = slider->maximum();
+// int oldMaxi = slider->maximum();
if (outMin[index]->value()value())
{
diff --git a/ground/openpilotgcs/src/plugins/config/configoutputwidget.h b/ground/openpilotgcs/src/plugins/config/configoutputwidget.h
index bb18312f7..2a197e3ac 100644
--- a/ground/openpilotgcs/src/plugins/config/configoutputwidget.h
+++ b/ground/openpilotgcs/src/plugins/config/configoutputwidget.h
@@ -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);
diff --git a/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.cpp b/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.cpp
index dd172a599..f691cc22f 100644
--- a/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.cpp
+++ b/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.cpp
@@ -42,15 +42,18 @@ ConfigStabilizationWidget::ConfigStabilizationWidget(QWidget *parent) : ConfigTa
m_stabilization = new Ui_StabilizationWidget();
m_stabilization->setupUi(this);
- // Now connect the widget to the ManualControlCommand / Channel UAVObject
- //UAVObject *obj = dynamic_cast(getObjectManager()->getObject(QString("StabilizationSettings")));
- requestStabilizationUpdate();
connect(m_stabilization->saveStabilizationToSD, SIGNAL(clicked()), this, SLOT(saveStabilizationUpdate()));
connect(m_stabilization->saveStabilizationToRAM, SIGNAL(clicked()), this, SLOT(sendStabilizationUpdate()));
- connect(m_stabilization->getStabilizationCurrent, SIGNAL(clicked()), this, SLOT(requestStabilizationUpdate()));
- 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(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,11 @@ void ConfigStabilizationWidget::updatePitchILimit(double val)
/**
Request stabilization settings from the board
*/
-void ConfigStabilizationWidget::requestStabilizationUpdate()
+void ConfigStabilizationWidget::refreshValues()
{
- stabSettings->requestUpdate();
+ // 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();
// Now fill in all the fields, this is fairly tedious:
m_stabilization->rateRollKp->setValue(stabData.RollRatePI[StabilizationSettings::ROLLRATEPI_KP]);
@@ -211,6 +222,14 @@ void ConfigStabilizationWidget::requestStabilizationUpdate()
m_stabilization->pitchMax->setValue(stabData.PitchMax);
m_stabilization->yawMax->setValue(stabData.YawMax);
+ m_stabilization->manualRoll->setValue(stabData.ManualRate[StabilizationSettings::MANUALRATE_ROLL]);
+ m_stabilization->manualPitch->setValue(stabData.ManualRate[StabilizationSettings::MANUALRATE_PITCH]);
+ m_stabilization->manualYaw->setValue(stabData.ManualRate[StabilizationSettings::MANUALRATE_YAW]);
+
+ m_stabilization->maximumRoll->setValue(stabData.MaximumRate[StabilizationSettings::MAXIMUMRATE_ROLL]);
+ m_stabilization->maximumPitch->setValue(stabData.MaximumRate[StabilizationSettings::MAXIMUMRATE_PITCH]);
+ m_stabilization->maximumYaw->setValue(stabData.MaximumRate[StabilizationSettings::MAXIMUMRATE_YAW]);
+
}
@@ -250,6 +269,14 @@ void ConfigStabilizationWidget::sendStabilizationUpdate()
stabData.PitchMax = m_stabilization->pitchMax->value();
stabData.YawMax = m_stabilization->yawMax->value();
+ stabData.ManualRate[StabilizationSettings::MANUALRATE_ROLL] = m_stabilization->manualRoll->value();
+ stabData.ManualRate[StabilizationSettings::MANUALRATE_PITCH] = m_stabilization->manualPitch->value();
+ stabData.ManualRate[StabilizationSettings::MANUALRATE_YAW] = m_stabilization->manualYaw->value();
+
+ stabData.MaximumRate[StabilizationSettings::MAXIMUMRATE_ROLL] = m_stabilization->maximumRoll->value();
+ stabData.MaximumRate[StabilizationSettings::MAXIMUMRATE_PITCH] = m_stabilization->maximumPitch->value();
+ stabData.MaximumRate[StabilizationSettings::MAXIMUMRATE_YAW] = m_stabilization->maximumYaw->value();
+
stabSettings->setData(stabData); // this is atomic
}
@@ -262,20 +289,19 @@ void ConfigStabilizationWidget::saveStabilizationUpdate()
{
// Send update so that the latest value is saved
sendStabilizationUpdate();
- ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
- UAVObjectManager *objManager = pm->getObject();
- UAVDataObject* obj = dynamic_cast(objManager->getObject(QString("StabilizationSettings")));
+ UAVDataObject* obj = dynamic_cast(getObjectManager()->getObject(QString("StabilizationSettings")));
Q_ASSERT(obj);
- updateObjectPersistance(ObjectPersistence::OPERATION_SAVE, obj);
+ saveObjectToSD(obj);
}
void ConfigStabilizationWidget::realtimeUpdateToggle(bool state)
{
- if (state)
+ if (state) {
updateTimer.start(300);
- else
+ } else {
updateTimer.stop();
+ }
}
void ConfigStabilizationWidget::openHelp()
diff --git a/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.h b/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.h
index 5af92ae65..98db5530f 100644
--- a/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.h
+++ b/ground/openpilotgcs/src/plugins/config/configstabilizationwidget.h
@@ -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);
diff --git a/ground/openpilotgcs/src/plugins/config/configtaskwidget.cpp b/ground/openpilotgcs/src/plugins/config/configtaskwidget.cpp
index 8fb743ef0..bb598cba0 100644
--- a/ground/openpilotgcs/src/plugins/config/configtaskwidget.cpp
+++ b/ground/openpilotgcs/src/plugins/config/configtaskwidget.cpp
@@ -30,8 +30,6 @@
ConfigTaskWidget::ConfigTaskWidget(QWidget *parent) : QWidget(parent)
{
- saveState = IDLE;
- queue.clear();
}
ConfigTaskWidget::~ConfigTaskWidget()
@@ -41,100 +39,13 @@ ConfigTaskWidget::~ConfigTaskWidget()
void ConfigTaskWidget::saveObjectToSD(UAVObject *obj)
{
- // Add to queue
- queue.enqueue(obj);
- // If queue length is one, then start sending (call sendNextObject)
- // Otherwise, do nothing, it's sending anyway
- if (queue.length()==1)
- saveNextObject();
-
+ // saveObjectToSD is now handled by the UAVUtils plugin in one
+ // central place (and one central queue)
+ ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
+ UAVObjectUtilManager* utilMngr = pm->getObject();
+ utilMngr->saveObjectToSD(obj);
}
-void ConfigTaskWidget::saveNextObject()
-{
- if ( queue.isEmpty() )
- {
- return;
- }
-
- Q_ASSERT(saveState == IDLE);
-
- // Get next object from the queue
- UAVObject* obj = queue.head();
- ObjectPersistence* objper = dynamic_cast( getObjectManager()->getObject(ObjectPersistence::NAME) );
- connect(objper, SIGNAL(transactionCompleted(UAVObject*,bool)), this, SLOT(objectPersistenceTransactionCompleted(UAVObject*,bool)));
- connect(objper, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(objectPersistenceUpdated(UAVObject *)));
- saveState = AWAITING_ACK;
- if (obj != NULL)
- {
- ObjectPersistence::DataFields data;
- data.Operation = ObjectPersistence::OPERATION_SAVE;
- data.Selection = ObjectPersistence::SELECTION_SINGLEOBJECT;
- data.ObjectID = obj->getObjID();
- data.InstanceID = obj->getInstID();
- objper->setData(data);
- objper->updated();
- }
-}
-
-/**
- * @brief Process the transactionCompleted message from Telemetry indicating request sent successfully
- * @param[in] The object just transsacted. Must be ObjectPersistance
- * @param[in] success Indicates that the transaction did not time out
- *
- * After a failed transaction (usually timeout) resends the save request. After a succesful
- * transaction will then wait for a save completed update from the autopilot.
- */
-void ConfigTaskWidget::objectPersistenceTransactionCompleted(UAVObject* obj, bool success)
-{
- if(success) {
- Q_ASSERT(obj->getName().compare("ObjectPersistence") == 0);
- Q_ASSERT(saveState == AWAITING_ACK);
- saveState = AWAITING_COMPLETED;
- disconnect(obj, SIGNAL(transactionCompleted(UAVObject*,bool)), this, SLOT(objectPersistenceTransactionCompleted(UAVObject*,bool)));
- } else if (!success) {
- // Can be caused by timeout errors on sending. Send again.
- saveNextObject();
- }
-}
-
-/**
- * @brief Process the ObjectPersistence updated message to confirm the right object saved
- * then requests next object be saved.
- * @param[in] The object just received. Must be ObjectPersistance
- */
-void ConfigTaskWidget::objectPersistenceUpdated(UAVObject * obj)
-{
- Q_ASSERT(obj->getName().compare("ObjectPersistence") == 0);
- if(saveState == AWAITING_COMPLETED) {
- // Check flight is saying it completed. This is the only thing flight should do to trigger an update.
- Q_ASSERT( obj->getField("Operation")->getValue().toString().compare(QString("Completed")) == 0 );
-
- // Check right object saved
- UAVObject* savingObj = queue.head();
- Q_ASSERT( obj->getField("ObjectID")->getValue() == savingObj->getObjID() );
-
- obj->disconnect(this);
- queue.dequeue(); // We can now remove the object, it's done.
- saveState = IDLE;
- saveNextObject();
- }
-}
-
-void ConfigTaskWidget::updateObjectPersistance(ObjectPersistence::OperationOptions op, UAVObject *obj)
-{
- ObjectPersistence* objper = dynamic_cast( getObjectManager()->getObject(ObjectPersistence::NAME) );
- if (obj != NULL)
- {
- ObjectPersistence::DataFields data;
- data.Operation = op;
- data.Selection = ObjectPersistence::SELECTION_SINGLEOBJECT;
- data.ObjectID = obj->getObjID();
- data.InstanceID = obj->getInstID();
- objper->setData(data);
- objper->updated();
- }
-}
UAVObjectManager* ConfigTaskWidget::getObjectManager() {
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
@@ -151,6 +62,21 @@ double ConfigTaskWidget::listMean(QList list)
return accum / list.size();
}
+// ************************************
+// telemetry start/stop connect/disconnect signals
+
+void ConfigTaskWidget::onAutopilotDisconnect()
+{
+ enableControls(false);
+}
+
+void ConfigTaskWidget::onAutopilotConnect()
+{
+ enableControls(true);
+ refreshValues();
+}
+
+
/**
@}
diff --git a/ground/openpilotgcs/src/plugins/config/configtaskwidget.h b/ground/openpilotgcs/src/plugins/config/configtaskwidget.h
index 0650ddb25..6ffe15b70 100644
--- a/ground/openpilotgcs/src/plugins/config/configtaskwidget.h
+++ b/ground/openpilotgcs/src/plugins/config/configtaskwidget.h
@@ -31,7 +31,7 @@
#include "extensionsystem/pluginmanager.h"
#include "uavobjectmanager.h"
#include "uavobject.h"
-#include "objectpersistence.h"
+#include "uavobjectutilmanager.h"
#include
#include
#include
@@ -45,20 +45,18 @@ public:
ConfigTaskWidget(QWidget *parent = 0);
~ConfigTaskWidget();
void saveObjectToSD(UAVObject *obj);
- void updateObjectPersistance(ObjectPersistence::OperationOptions op, UAVObject *obj);
UAVObjectManager* getObjectManager();
-
static double listMean(QList list);
+public slots:
+ void onAutopilotDisconnect();
+ void onAutopilotConnect();
+
private slots:
- void objectPersistenceTransactionCompleted(UAVObject* obj, bool success);
- void objectPersistenceUpdated(UAVObject * obj);
+ virtual void refreshValues() = 0;
private:
- QQueue queue;
- void saveNextObject();
- enum {IDLE, AWAITING_ACK, AWAITING_COMPLETED} saveState;
-
+ virtual void enableControls(bool enable) = 0;
};
diff --git a/ground/openpilotgcs/src/plugins/config/configtelemetrywidget.cpp b/ground/openpilotgcs/src/plugins/config/configtelemetrywidget.cpp
index 843f94ffb..2b1a8e873 100644
--- a/ground/openpilotgcs/src/plugins/config/configtelemetrywidget.cpp
+++ b/ground/openpilotgcs/src/plugins/config/configtelemetrywidget.cpp
@@ -43,16 +43,18 @@ ConfigTelemetryWidget::ConfigTelemetryWidget(QWidget *parent) : ConfigTaskWidget
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
UAVObjectManager *objManager = pm->getObject();
- UAVObject *obj = dynamic_cast(objManager->getObject(QString("TelemetrySettings")));
+ UAVObject *obj = objManager->getObject(QString("TelemetrySettings"));
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(m_telemetry->getTelemetryCurrent, SIGNAL(clicked()), this, SLOT(requestTelemetryUpdate()));
+ connect(obj, SIGNAL(objectUpdated(UAVObject*)), this, SLOT(refreshValues()));
- connect(parent, SIGNAL(autopilotConnected()),this, SLOT(requestTelemetryUpdate()));
+ enableControls(false);
+ refreshValues();
+ connect(parent, SIGNAL(autopilotConnected()),this, SLOT(onAutopilotConnect()));
+ connect(parent, SIGNAL(autopilotDisconnected()),this, SLOT(onAutopilotDisconnect()));
}
ConfigTelemetryWidget::~ConfigTelemetryWidget()
@@ -65,16 +67,21 @@ 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();
UAVDataObject* obj = dynamic_cast(objManager->getObject(QString("TelemetrySettings")));
Q_ASSERT(obj);
- obj->requestUpdate();
UAVObjectField *field = obj->getField(QString("Speed"));
m_telemetry->telemetrySpeed->setCurrentIndex(m_telemetry->telemetrySpeed->findText(field->getValue().toString()));
}
@@ -84,9 +91,7 @@ void ConfigTelemetryWidget::requestTelemetryUpdate()
*/
void ConfigTelemetryWidget::sendTelemetryUpdate()
{
- ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
- UAVObjectManager *objManager = pm->getObject();
- UAVDataObject* obj = dynamic_cast(objManager->getObject(QString("TelemetrySettings")));
+ UAVDataObject* obj = dynamic_cast(getObjectManager()->getObject(QString("TelemetrySettings")));
Q_ASSERT(obj);
UAVObjectField* field = obj->getField(QString("Speed"));
field->setValue(m_telemetry->telemetrySpeed->currentText());
@@ -100,11 +105,7 @@ void ConfigTelemetryWidget::saveTelemetryUpdate()
{
// Send update so that the latest value is saved
sendTelemetryUpdate();
- ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
- UAVObjectManager *objManager = pm->getObject();
- UAVDataObject* obj = dynamic_cast(objManager->getObject(QString("TelemetrySettings")));
+ UAVDataObject* obj = dynamic_cast(getObjectManager()->getObject(QString("TelemetrySettings")));
Q_ASSERT(obj);
- updateObjectPersistance(ObjectPersistence::OPERATION_SAVE, obj);
+ saveObjectToSD(obj);
}
-
-
diff --git a/ground/openpilotgcs/src/plugins/config/configtelemetrywidget.h b/ground/openpilotgcs/src/plugins/config/configtelemetrywidget.h
index 3f38eef3b..f36ba1a4e 100644
--- a/ground/openpilotgcs/src/plugins/config/configtelemetrywidget.h
+++ b/ground/openpilotgcs/src/plugins/config/configtelemetrywidget.h
@@ -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();
diff --git a/ground/openpilotgcs/src/plugins/config/defaultattitudewidget.cpp b/ground/openpilotgcs/src/plugins/config/defaultattitudewidget.cpp
index 8fb68d910..4705bb02e 100644
--- a/ground/openpilotgcs/src/plugins/config/defaultattitudewidget.cpp
+++ b/ground/openpilotgcs/src/plugins/config/defaultattitudewidget.cpp
@@ -31,7 +31,7 @@
#include
DefaultAttitudeWidget::DefaultAttitudeWidget(QWidget *parent) :
- ConfigTaskWidget(parent),
+ QWidget(parent),
ui(new Ui_defaultattitude)
{
ui->setupUi(this);
diff --git a/ground/openpilotgcs/src/plugins/config/defaultattitudewidget.h b/ground/openpilotgcs/src/plugins/config/defaultattitudewidget.h
index 25b8809d4..5541eee37 100644
--- a/ground/openpilotgcs/src/plugins/config/defaultattitudewidget.h
+++ b/ground/openpilotgcs/src/plugins/config/defaultattitudewidget.h
@@ -38,7 +38,7 @@
class Ui_Widget;
-class DefaultAttitudeWidget : public ConfigTaskWidget
+class DefaultAttitudeWidget : public QWidget
{
Q_OBJECT
diff --git a/ground/openpilotgcs/src/plugins/config/input.ui b/ground/openpilotgcs/src/plugins/config/input.ui
index d3260e150..224424c4e 100644
--- a/ground/openpilotgcs/src/plugins/config/input.ui
+++ b/ground/openpilotgcs/src/plugins/config/input.ui
@@ -7,7 +7,7 @@
0
0
557
- 462
+ 467