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

OP-474: Config gadget option for the "spinning while armed" check box

This commit is contained in:
James Cotton 2011-05-03 00:41:06 -05:00
parent 401a989c63
commit bd06f156da
3 changed files with 47 additions and 17 deletions

View File

@ -144,20 +144,22 @@ ConfigOutputWidget::ConfigOutputWidget(QWidget *parent) : ConfigTaskWidget(paren
firstUpdate = true;
enableControls(false);
connect(m_config->spinningArmed, SIGNAL(toggled(bool)), this, SLOT(setSpinningArmed(bool)));
// 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()));
}
}
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()));
}
}
}
ConfigOutputWidget::~ConfigOutputWidget()
@ -307,7 +309,17 @@ void ConfigOutputWidget::assignOutputChannel(UAVDataObject *obj, QString str)
}
}
/**
* Set the "Spin motors at neutral when armed" flag in ActuatorSettings
*/
void ConfigOutputWidget::setSpinningArmed(bool val)
{
UAVDataObject *obj = dynamic_cast<UAVDataObject*>(getObjectManager()->getObject(QString("ActuatorSettings")));
if (!obj) return;
UAVObjectField *field = obj->getField("MotorsSpinWhileArmed");
if (!field) return;
field->setValue(val);
}
/**
Sends the channel value to the UAV to move the servo.
@ -400,6 +412,10 @@ void ConfigOutputWidget::requestRCOutputUpdate()
}
}
// Get the SpinWhileArmed setting
field = obj->getField(QString("MotorsSpinWhileArmed"));
m_config->spinningArmed->setChecked(field->getValue().toBool());
// Get Output rates for both banks
field = obj->getField(QString("ChannelUpdateFreq"));
m_config->outputRate1->setValue(field->getValue(0).toInt());

View File

@ -85,6 +85,7 @@ private slots:
void setChOutRange();
void reverseChannel(bool state);
void linkToggled(bool state);
void setSpinningArmed(bool val);
};
#endif

View File

@ -838,7 +838,7 @@ p, li { white-space: pre-wrap; }
<widget class="QPushButton" name="saveRCOutputToSD">
<property name="geometry">
<rect>
<x>490</x>
<x>530</x>
<y>310</y>
<width>93</width>
<height>27</height>
@ -855,7 +855,7 @@ Applies and Saves all settings to SD</string>
<widget class="QPushButton" name="getRCOutputCurrent">
<property name="geometry">
<rect>
<x>270</x>
<x>330</x>
<y>310</y>
<width>93</width>
<height>27</height>
@ -871,7 +871,7 @@ Applies and Saves all settings to SD</string>
<widget class="QPushButton" name="saveRCOutputToRAM">
<property name="geometry">
<rect>
<x>380</x>
<x>430</x>
<y>310</y>
<width>93</width>
<height>27</height>
@ -1443,6 +1443,19 @@ p, li { white-space: pre-wrap; }
<string/>
</property>
</widget>
<widget class="QCheckBox" name="spinningArmed">
<property name="geometry">
<rect>
<x>10</x>
<y>310</y>
<width>301</width>
<height>31</height>
</rect>
</property>
<property name="text">
<string>Motors at neutral (spinning) when armed</string>
</property>
</widget>
</widget>
</widget>
</item>