Commit 0b1f2f63 authored by Don Gagne's avatar Don Gagne

RCCalibration updates

- Updated to use RCChannelWidget
- Removed attitude control widgets
- Previous calibration values now shown when not actively calibrating
parent 091cc1eb
......@@ -38,7 +38,7 @@ class MockQGCUASParamManager : public QGCUASParamManagerInterface
signals:
// The following QGCSUASParamManagerInterface signals are supported
// currently none
void parameterListUpToDate(); // You can connect to this signal, but it will never be emitted
public:
// Implemented QGCSUASParamManager overrides
......
......@@ -97,32 +97,13 @@ void PX4RCCalibrationTest::init(void)
_statusLabel = _calWidget->findChild<QLabel*>("rcCalStatus");
Q_ASSERT(_statusLabel);
// Need to make sure standard channel indices are less then 4. Otherwise our _rgRadioWidget array won't work correctly.
Q_ASSERT(PX4RCCalibration::rcCalFunctionRoll >= 0 && PX4RCCalibration::rcCalFunctionRoll < 4);
Q_ASSERT(PX4RCCalibration::rcCalFunctionPitch >= 0 && PX4RCCalibration::rcCalFunctionPitch < 4);
Q_ASSERT(PX4RCCalibration::rcCalFunctionYaw >= 0 && PX4RCCalibration::rcCalFunctionYaw < 4);
Q_ASSERT(PX4RCCalibration::rcCalFunctionThrottle >= 0 && PX4RCCalibration::rcCalFunctionThrottle < 4);
_rgAttitudeRadioWidget[PX4RCCalibration::rcCalFunctionRoll] = _calWidget->findChild<QGCRadioChannelDisplay*>("rollWidget");
_rgAttitudeRadioWidget[PX4RCCalibration::rcCalFunctionPitch] = _calWidget->findChild<QGCRadioChannelDisplay*>("pitchWidget");
_rgAttitudeRadioWidget[PX4RCCalibration::rcCalFunctionYaw] = _calWidget->findChild<QGCRadioChannelDisplay*>("yawWidget");
_rgAttitudeRadioWidget[PX4RCCalibration::rcCalFunctionThrottle] = _calWidget->findChild<QGCRadioChannelDisplay*>("throttleWidget");
Q_ASSERT(_rgAttitudeRadioWidget[PX4RCCalibration::rcCalFunctionRoll]);
Q_ASSERT(_rgAttitudeRadioWidget[PX4RCCalibration::rcCalFunctionPitch]);
Q_ASSERT(_rgAttitudeRadioWidget[PX4RCCalibration::rcCalFunctionYaw]);
Q_ASSERT(_rgAttitudeRadioWidget[PX4RCCalibration::rcCalFunctionThrottle]);
for (size_t i=0; i<PX4RCCalibration::_chanMax; i++) {
QString radioWidgetName("radio%1Widget");
QString radioWidgetUserName("Radio %1");
QGCRadioChannelDisplay* radioWidget = _calWidget->findChild<QGCRadioChannelDisplay*>(radioWidgetName.arg(i+1));
RCChannelWidget* radioWidget = _calWidget->findChild<RCChannelWidget*>(radioWidgetName.arg(i+1));
Q_ASSERT(radioWidget);
radioWidget->setOrientation(Qt::Horizontal);
radioWidget->setName(radioWidgetUserName.arg(i+1));
_rgRadioWidget[i] = radioWidget;
}
}
......@@ -177,7 +158,7 @@ void PX4RCCalibrationTest::_liveRC_test(void)
}
for (int i=0; i<PX4RCCalibration::_chanMax; i++) {
QGCRadioChannelDisplay* radioWidget = _rgRadioWidget[i];
RCChannelWidget* radioWidget = _rgRadioWidget[i];
Q_ASSERT(radioWidget);
QCOMPARE(radioWidget->value(), PX4RCCalibration::_rcCalPWMValidMinValue);
......@@ -323,20 +304,9 @@ StartOver:
CHK_BUTTONS(cancelButtonMask);
// Also at this point the radio channel widgets should be displaying the current min/max we just set.
// Check both the Attitude Control widgets as well as generic channel widgets.
Q_ASSERT(PX4RCCalibration::rcCalFunctionFirstAttitudeFunction == 0);
for (int i=0; i<PX4RCCalibration::rcCalFunctionLastAttitudeFunction; i++) {
QGCRadioChannelDisplay* radioWidget = _rgAttitudeRadioWidget[i];
Q_ASSERT(radioWidget);
QCOMPARE(radioWidget->isMinMaxShown(), true);
QCOMPARE(radioWidget->min(), PX4RCCalibration::_rcCalPWMValidMinValue);
QCOMPARE(radioWidget->max(), PX4RCCalibration::_rcCalPWMValidMaxValue);
}
for (int i=0; i<PX4RCCalibration::_chanMax; i++) {
QGCRadioChannelDisplay* radioWidget = _rgRadioWidget[i];
RCChannelWidget* radioWidget = _rgRadioWidget[i];
Q_ASSERT(radioWidget);
QCOMPARE(radioWidget->isMinMaxShown(), true);
......
......@@ -93,8 +93,7 @@ private:
QPushButton* _tryAgainButton;
QLabel* _statusLabel;
QGCRadioChannelDisplay* _rgAttitudeRadioWidget[4];
QGCRadioChannelDisplay* _rgRadioWidget[PX4RCCalibration::_chanMax];
RCChannelWidget* _rgRadioWidget[PX4RCCalibration::_chanMax];
};
DECLARE_TEST(PX4RCCalibrationTest)
......
......@@ -65,6 +65,8 @@ private slots:
void _setActiveUAS(UASInterface* uas);
void _toggleSpektrumPairing(bool enabled);
void _parameterListUpToDate(void);
private:
/// @brief These identify the various controls functions. They are also used as indices into the _rgFunctioInfo
/// aray.
......@@ -124,7 +126,8 @@ private:
void _writeCalibration(bool trimsOnly);
void _resetInternalCalibrationValues(void);
void _copyAndSetTrims(void);
void _setInternalCalibrationValuesFromParameters(void);
void _initializeTrims(void);
void _rcCalChannelWait(bool firstTime);
void _rcCalBegin(void);
......@@ -138,6 +141,7 @@ private:
void _rcCalSaveCurrentValues(void);
void _showMinMaxOnRadioWidgets(bool show);
void _showTrimOnRadioWidgets(bool show);
void _unitTestForceCalState(enum rcCalStates state);
......@@ -171,10 +175,12 @@ private:
float _rcRawValue[_chanMax]; ///< Current set of raw channel values
QGCRadioChannelDisplay* _rgAttitudeRadioWidget[4]; ///< Array of Attitide Function radio channel widgets
QGCRadioChannelDisplay* _rgRadioWidget[_chanMax]; ///< Array of radio channel widgets
RCChannelWidget* _rgRadioWidget[_chanMax]; ///< Array of radio channel widgets
UASInterface* _mav; ///< The current MAV
QGCUASParamManagerInterface* _paramMgr;
bool _parameterListUpToDateSignalled; ///< true: we have received a parameterListUpToDate signal
Ui::PX4RCCalibration* _ui;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment