Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
97039eb6
Commit
97039eb6
authored
May 27, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rework RadioCal unit test to Qml RadioCal
parent
20df7ebf
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
181 additions
and
184 deletions
+181
-184
QGCApplication.pro
QGCApplication.pro
+2
-4
RadioComponentController.cc
src/AutoPilotPlugins/PX4/RadioComponentController.cc
+10
-0
RadioComponentController.h
src/AutoPilotPlugins/PX4/RadioComponentController.h
+7
-2
PX4RCCalibrationTest.cc
src/qgcunittest/PX4RCCalibrationTest.cc
+147
-158
PX4RCCalibrationTest.h
src/qgcunittest/PX4RCCalibrationTest.h
+15
-20
No files found.
QGCApplication.pro
View file @
97039eb6
...
...
@@ -515,8 +515,7 @@ HEADERS += \
src
/
qgcunittest
/
UnitTest
.
h
\
src
/
VehicleSetup
/
SetupViewTest
.
h
\
src
/
qgcunittest
/
FileManagerTest
.
h
\
#
src
/
qgcunittest
/
PX4RCCalibrationTest
.
h
\
src
/
qgcunittest
/
PX4RCCalibrationTest
.
h
\
SOURCES
+=
\
src
/
qgcunittest
/
FlightGearTest
.
cc
\
...
...
@@ -534,8 +533,7 @@ SOURCES += \
src
/
qgcunittest
/
UnitTest
.
cc
\
src
/
VehicleSetup
/
SetupViewTest
.
cc
\
src
/
qgcunittest
/
FileManagerTest
.
cc
\
#
src
/
qgcunittest
/
PX4RCCalibrationTest
.
cc
\
src
/
qgcunittest
/
PX4RCCalibrationTest
.
cc
\
}
#
DebugBuild
|
WindowsDebugAndRelease
}
#
AndroidBuild
...
...
src/AutoPilotPlugins/PX4/RadioComponentController.cc
View file @
97039eb6
...
...
@@ -34,6 +34,11 @@
QGC_LOGGING_CATEGORY
(
RadioComponentControllerLog
,
"RadioComponentControllerLog"
)
#ifdef UNITTEST_BUILD
// Nasty hack to expose controller to unit test code
RadioComponentController
*
RadioComponentController
::
_unitTestController
=
NULL
;
#endif
const
int
RadioComponentController
::
_updateInterval
=
150
;
///< Interval for timer which updates radio channel widgets
const
int
RadioComponentController
::
_rcCalPWMCenterPoint
=
((
RadioComponentController
::
_rcCalPWMValidMaxValue
-
RadioComponentController
::
_rcCalPWMValidMinValue
)
/
2.0
f
)
+
RadioComponentController
::
_rcCalPWMValidMinValue
;
// FIXME: Double check these mins againt 150% throws
...
...
@@ -93,6 +98,11 @@ RadioComponentController::RadioComponentController(void) :
_nextButton
(
NULL
),
_skipButton
(
NULL
)
{
#ifdef UNITTEST_BUILD
// Nasty hack to expose controller to unit test code
_unitTestController
=
this
;
#endif
connect
(
_uas
,
&
UASInterface
::
remoteControlChannelRawChanged
,
this
,
&
RadioComponentController
::
_remoteControlChannelRawChanged
);
_loadSettings
();
...
...
src/AutoPilotPlugins/PX4/RadioComponentController.h
View file @
97039eb6
...
...
@@ -38,7 +38,7 @@
Q_DECLARE_LOGGING_CATEGORY
(
RadioComponentControllerLog
)
//class RadioComponentControllerT
est;
class
RadioConfig
est
;
namespace
Ui
{
class
RadioComponentController
;
...
...
@@ -49,7 +49,7 @@ class RadioComponentController : public FactPanelController
{
Q_OBJECT
//friend class RadioComponentController
Test; ///< This allows our unit test to access internal information needed.
friend
class
RadioConfig
Test
;
///< This allows our unit test to access internal information needed.
public:
RadioComponentController
(
void
);
...
...
@@ -324,6 +324,11 @@ private:
QQuickItem
*
_skipButton
;
QString
_imageHelp
;
#ifdef UNITTEST_BUILD
// Nasty hack to expose controller to unit test code
static
RadioComponentController
*
_unitTestController
;
#endif
};
#endif // RadioComponentController_H
src/qgcunittest/PX4RCCalibrationTest.cc
View file @
97039eb6
This diff is collapsed.
Click to expand it.
src/qgcunittest/PX4RCCalibrationTest.h
View file @
97039eb6
...
...
@@ -21,30 +21,30 @@
======================================================================*/
#ifndef
PX4RCCALIBRATIONTEST
_H
#define
PX4RCCALIBRATIONTEST
_H
#ifndef
RadioConfigTest
_H
#define
RadioConfigTest
_H
#include "UnitTest.h"
#include "MockLink.h"
#include "MultiSignalSpy.h"
#include "
px4_configuration/PX4RCCalibration
.h"
#include "
RadioComponentController
.h"
#include "QGCLoggingCategory.h"
#include "AutoPilotPlugin.h"
#include "QGCQmlWidgetHolder.h"
/// @file
/// @brief
PX4RCCalibration Widget
unit test
/// @brief
Radio Config
unit test
///
/// @author Don Gagne <don@thegagnes.com>
Q_DECLARE_LOGGING_CATEGORY
(
PX4RCCalibration
TestLog
)
Q_DECLARE_LOGGING_CATEGORY
(
RadioConfig
TestLog
)
/// @brief PX4RCCalibration Widget unit test
class
PX4RCCalibrationTest
:
public
UnitTest
class
RadioConfigTest
:
public
UnitTest
{
Q_OBJECT
public:
PX4RCCalibration
Test
(
void
);
RadioConfig
Test
(
void
);
private
slots
:
void
init
(
void
);
...
...
@@ -71,10 +71,10 @@ private:
void
_minRCChannels
(
void
);
void
_beginCalibration
(
void
);
void
_stickMoveWaitForSettle
(
int
channel
,
int
value
);
void
_stickMoveAutoStep
(
const
char
*
functionStr
,
enum
PX4RCCalibration
::
rcCalFunctions
function
,
enum
MoveToDirection
direction
,
bool
identifyStep
);
void
_stickMoveAutoStep
(
const
char
*
functionStr
,
enum
RadioComponentController
::
rcCalFunctions
function
,
enum
MoveToDirection
direction
,
bool
identifyStep
);
void
_switchMinMaxStep
(
void
);
void
_flapsDetectStep
(
void
);
void
_switchSelectAutoStep
(
const
char
*
functionStr
,
PX4RCCalibration
::
rcCalFunctions
function
);
void
_switchSelectAutoStep
(
const
char
*
functionStr
,
RadioComponentController
::
rcCalFunctions
function
);
enum
{
validateMinMaxMask
=
1
<<
0
,
...
...
@@ -97,7 +97,7 @@ private:
MockLink
*
_mockLink
;
AutoPilotPlugin
*
_autopilot
;
PX4RCCalibration
*
_calWidget
;
QGCQmlWidgetHolder
*
_calWidget
;
enum
{
nextButtonMask
=
1
<<
0
,
...
...
@@ -105,13 +105,6 @@ private:
skipButtonMask
=
1
<<
2
};
QPushButton
*
_nextButton
;
QPushButton
*
_cancelButton
;
QPushButton
*
_skipButton
;
QLabel
*
_statusLabel
;
RCValueWidget
*
_rgValueWidget
[
PX4RCCalibration
::
_chanMax
];
const
char
*
_rgSignals
[
1
];
MultiSignalSpy
*
_multiSpyNextButtonMessageBox
;
...
...
@@ -125,9 +118,11 @@ private:
static
const
int
_stickSettleWait
;
static
const
struct
ChannelSettings
_rgChannelSettings
[
_availableChannels
];
static
const
struct
ChannelSettings
_rgChannelSettingsValidate
[
PX4RCCalibration
::
_chanMax
];
static
const
struct
ChannelSettings
_rgChannelSettingsValidate
[
RadioComponentController
::
_chanMax
];
int
_rgFunctionChannelMap
[
PX4RCCalibration
::
rcCalFunctionMax
];
int
_rgFunctionChannelMap
[
RadioComponentController
::
rcCalFunctionMax
];
RadioComponentController
*
_controller
;
};
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment