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

OP-716 Replaced AccelTau checkbox with numeric spinbox. Max value was set to 0,20 and min value to 0,00, step size 0,01. Added tooltip hinting to set to 0 to disable.

This commit is contained in:
Fredrik Arvidsson 2012-11-20 19:25:57 +01:00
parent 1695fda4e2
commit a0cb604e32
3 changed files with 75 additions and 37 deletions

View File

@ -367,30 +367,90 @@ margin:1px;</string>
</spacer> </spacer>
</item> </item>
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_2"> <widget class="QCheckBox" name="zeroGyroBiasOnArming">
<item> <property name="toolTip">
<widget class="QCheckBox" name="zeroGyroBiasOnArming"> <string>If enabled, a fast recalibration of gyro zero point will be done
<property name="toolTip">
<string>If enabled, a fast recalibration of gyro zero point will be done
whenever the frame is armed. Do not move the airframe while whenever the frame is armed. Do not move the airframe while
arming it in that case!</string> arming it in that case!</string>
</property>
<property name="text">
<string>Zero gyros while arming aircraft</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_6">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_5">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Set value to 0 to disable accelerators filtering.</string>
</property> </property>
<property name="text"> <property name="text">
<string>Zero gyros while arming aircraft</string> <string>AccelTau</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QCheckBox" name="accelFiltering"> <spacer name="horizontalSpacer_12">
<property name="text"> <property name="orientation">
<string>Accel filtering</string> <enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>10</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDoubleSpinBox" name="accelTauSpinnbox">
<property name="minimumSize">
<size>
<width>60</width>
<height>0</height>
</size>
</property>
<property name="toolTip">
<string>Set value to 0 to disable accelerators filtering.</string>
</property>
<property name="decimals">
<number>2</number>
</property>
<property name="maximum">
<double>0.200000000000000</double>
</property>
<property name="singleStep">
<double>0.010000000000000</double>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
<item> <item>
<spacer name="horizontalSpacer_6"> <spacer name="horizontalSpacer_11">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>

View File

@ -57,8 +57,8 @@ ConfigCCAttitudeWidget::ConfigCCAttitudeWidget(QWidget *parent) :
// Connect the help button // Connect the help button
connect(ui->ccAttitudeHelp, SIGNAL(clicked()), this, SLOT(openHelp())); connect(ui->ccAttitudeHelp, SIGNAL(clicked()), this, SLOT(openHelp()));
connect(ui->accelFiltering, SIGNAL(toggled(bool)), this, SLOT(setAccelFiltering(bool)));
addUAVObjectToWidgetRelation("AttitudeSettings","ZeroDuringArming",ui->zeroGyroBiasOnArming); addUAVObjectToWidgetRelation("AttitudeSettings","ZeroDuringArming",ui->zeroGyroBiasOnArming);
addUAVObjectToWidgetRelation("AttitudeSettings", "AccelTau", ui->accelTauSpinnbox);
addUAVObjectToWidgetRelation("AttitudeSettings","BoardRotation",ui->rollBias,AttitudeSettings::BOARDROTATION_ROLL); addUAVObjectToWidgetRelation("AttitudeSettings","BoardRotation",ui->rollBias,AttitudeSettings::BOARDROTATION_ROLL);
addUAVObjectToWidgetRelation("AttitudeSettings","BoardRotation",ui->pitchBias,AttitudeSettings::BOARDROTATION_PITCH); addUAVObjectToWidgetRelation("AttitudeSettings","BoardRotation",ui->pitchBias,AttitudeSettings::BOARDROTATION_PITCH);
@ -75,8 +75,8 @@ ConfigCCAttitudeWidget::~ConfigCCAttitudeWidget()
void ConfigCCAttitudeWidget::sensorsUpdated(UAVObject * obj) { void ConfigCCAttitudeWidget::sensorsUpdated(UAVObject * obj) {
if (!timer.isActive()) { if (!timer.isActive()) {
// ignore updates that come in after the timer has expired // ignore updates that come in after the timer has expired
return; return;
} }
Accels * accels = Accels::GetInstance(getObjectManager()); Accels * accels = Accels::GetInstance(getObjectManager());
@ -222,33 +222,14 @@ void ConfigCCAttitudeWidget::enableControls(bool enable)
if(ui->zeroGyroBiasOnArming) { if(ui->zeroGyroBiasOnArming) {
ui->zeroGyroBiasOnArming->setEnabled(enable); ui->zeroGyroBiasOnArming->setEnabled(enable);
} }
if(ui->accelFiltering) { if(ui->accelTauSpinnbox) {
ui->accelFiltering->setEnabled(enable); ui->accelTauSpinnbox->setEnabled(enable);
} }
ConfigTaskWidget::enableControls(enable); ConfigTaskWidget::enableControls(enable);
} }
void ConfigCCAttitudeWidget::refreshWidgetsValues(UAVObject *obj)
{
AttitudeSettings* settings = AttitudeSettings::GetInstance(getObjectManager());
Q_ASSERT(settings);
AttitudeSettings::DataFields data = settings->getData();
ui->accelFiltering->setChecked(data.AccelTau > 0.0f);
ConfigTaskWidget::refreshWidgetsValues(obj);
}
void ConfigCCAttitudeWidget::updateObjectsFromWidgets() void ConfigCCAttitudeWidget::updateObjectsFromWidgets()
{ {
AttitudeSettings* settings = AttitudeSettings::GetInstance(getObjectManager());
Q_ASSERT(settings);
AttitudeSettings::DataFields data = settings->getData();
data.AccelTau = ui->accelFiltering->isChecked() ? DEFAULT_ENABLED_ACCEL_TAU : 0.0f;
settings->setData(data);
ConfigTaskWidget::updateObjectsFromWidgets(); ConfigTaskWidget::updateObjectsFromWidgets();
ui->zeroBiasProgress->setValue(0); ui->zeroBiasProgress->setValue(0);
} }

View File

@ -72,9 +72,6 @@ private:
protected: protected:
virtual void enableControls(bool enable); virtual void enableControls(bool enable);
protected slots:
void refreshWidgetsValues(UAVObject * obj=NULL);
}; };
#endif // CCATTITUDEWIDGET_H #endif // CCATTITUDEWIDGET_H