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
e411b95c
Commit
e411b95c
authored
Feb 12, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1228 from DonLakeFlyer/FixSetupView
Fix SetupView to work with latest mavlink headers
parents
53349ffc
303050ed
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
187 additions
and
20 deletions
+187
-20
qgroundcontrol.pro
qgroundcontrol.pro
+2
-0
AirframeComponent.cc
src/AutoPilotPlugins/PX4/AirframeComponent.cc
+22
-1
SetupViewTest.cc
src/VehicleSetup/SetupViewTest.cc
+97
-0
SetupViewTest.h
src/VehicleSetup/SetupViewTest.h
+51
-0
MainWindowTest.cc
src/qgcunittest/MainWindowTest.cc
+12
-15
MainWindowTest.h
src/qgcunittest/MainWindowTest.h
+0
-1
MockLink.param
src/qgcunittest/MockLink.param
+3
-3
No files found.
qgroundcontrol.pro
View file @
e411b95c
...
...
@@ -681,6 +681,7 @@ HEADERS += \
src
/
FactSystem
/
FactSystemTestPX4
.
h
\
src
/
FactSystem
/
FactSystemTestGeneric
.
h
\
src
/
QmlControls
/
QmlTestWidget
.
h
\
src
/
VehicleSetup
/
SetupViewTest
.
h
\
SOURCES
+=
\
src
/
qgcunittest
/
UnitTest
.
cc
\
...
...
@@ -706,6 +707,7 @@ SOURCES += \
src
/
FactSystem
/
FactSystemTestPX4
.
cc
\
src
/
FactSystem
/
FactSystemTestGeneric
.
cc
\
src
/
QmlControls
/
QmlTestWidget
.
cc
\
src
/
VehicleSetup
/
SetupViewTest
.
cc
\
}
...
...
src/AutoPilotPlugins/PX4/AirframeComponent.cc
View file @
e411b95c
...
...
@@ -30,6 +30,9 @@
/// @brief Parameters which signal a change in setupComplete state
static
const
char
*
triggerParams
[]
=
{
"SYS_AUTOSTART"
,
NULL
};
#if 0
// Broken by latest mavlink module changes. Not used yet. Comment out for now.
// Discussing mavlink fix.
struct mavType {
int type;
const char* description;
...
...
@@ -58,17 +61,28 @@ static const struct mavType mavTypeInfo[] = {
{ MAV_TYPE_ONBOARD_CONTROLLER, "Onbard companion controller" },
{ MAV_TYPE_VTOL_DUOROTOR, "Two-rotor VTOL" },
{ MAV_TYPE_VTOL_QUADROTOR, "Quad-rotor VTOL" },
{ MAV_TYPE_VTOL_RESERVED1, "Reserved" },
{ MAV_TYPE_VTOL_RESERVED2, "Reserved" },
{ MAV_TYPE_VTOL_RESERVED3, "Reserved" },
{ MAV_TYPE_VTOL_RESERVED4, "Reserved" },
{ MAV_TYPE_VTOL_RESERVED5, "Reserved" },
{ MAV_TYPE_GIMBAL, "Gimbal" },
};
static size_t cMavTypes = sizeof(mavTypeInfo) / sizeof(mavTypeInfo[0]);
#endif
AirframeComponent
::
AirframeComponent
(
UASInterface
*
uas
,
AutoPilotPlugin
*
autopilot
,
QObject
*
parent
)
:
PX4Component
(
uas
,
autopilot
,
parent
),
_name
(
tr
(
"Airframe"
))
{
#if 0
// Broken by latest mavlink module changes. Not used yet. Comment out for now.
// Discussing mavlink fix.
Q_UNUSED(mavTypeInfo); // Keeping this around for later use
// Validate that our mavTypeInfo array hasn't gotten out of sync
qDebug() << cMavTypes << MAV_TYPE_ENUM_END;
Q_ASSERT(cMavTypes == MAV_TYPE_ENUM_END);
static const int mavTypes[] = {
...
...
@@ -92,13 +106,20 @@ AirframeComponent::AirframeComponent(UASInterface* uas, AutoPilotPlugin* autopil
MAV_TYPE_KITE,
MAV_TYPE_ONBOARD_CONTROLLER,
MAV_TYPE_VTOL_DUOROTOR,
MAV_TYPE_VTOL_QUADROTOR
MAV_TYPE_VTOL_QUADROTOR,
MAV_TYPE_VTOL_RESERVED1,
MAV_TYPE_VTOL_RESERVED2,
MAV_TYPE_VTOL_RESERVED3,
MAV_TYPE_VTOL_RESERVED4,
MAV_TYPE_VTOL_RESERVED5,
MAV_TYPE_GIMBAL,
};
Q_UNUSED(mavTypes); // Keeping this around for later use
for (size_t i=0; i<cMavTypes; i++) {
Q_ASSERT(mavTypeInfo[i].type == mavTypes[i]);
}
#endif
}
QString
AirframeComponent
::
name
(
void
)
const
...
...
src/VehicleSetup/SetupViewTest.cc
0 → 100644
View file @
e411b95c
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/// @file
/// @author Don Gagne <don@thegagnes.com>
#include "SetupViewTest.h"
#include "MockLink.h"
#include "QGCMessageBox.h"
UT_REGISTER_TEST
(
SetupViewTest
)
SetupViewTest
::
SetupViewTest
(
void
)
{
}
void
SetupViewTest
::
init
(
void
)
{
UnitTest
::
init
();
_mainWindow
=
MainWindow
::
_create
(
NULL
);
Q_CHECK_PTR
(
_mainWindow
);
}
void
SetupViewTest
::
cleanup
(
void
)
{
_mainWindow
->
close
();
delete
_mainWindow
;
UnitTest
::
cleanup
();
}
void
SetupViewTest
::
_clickThrough_test
(
void
)
{
LinkManager
*
linkMgr
=
LinkManager
::
instance
();
Q_CHECK_PTR
(
linkMgr
);
MockLink
*
link
=
new
MockLink
();
Q_CHECK_PTR
(
link
);
link
->
setAutopilotType
(
MAV_AUTOPILOT_PX4
);
LinkManager
::
instance
()
->
addLink
(
link
);
linkMgr
->
connectLink
(
link
);
QTest
::
qWait
(
5000
);
// Give enough time for UI to settle and heartbeats to go through
// Find the Setup button and click it
QGCToolBar
*
toolbar
=
_mainWindow
->
findChild
<
QGCToolBar
*>
();
Q_ASSERT
(
toolbar
);
QList
<
QToolButton
*>
buttons
=
toolbar
->
findChildren
<
QToolButton
*>
();
QToolButton
*
setupButton
=
NULL
;
foreach
(
QToolButton
*
button
,
buttons
)
{
if
(
button
->
text
()
==
"Setup"
)
{
setupButton
=
button
;
break
;
}
}
Q_ASSERT
(
setupButton
);
QTest
::
mouseClick
(
setupButton
,
Qt
::
LeftButton
);
QTest
::
qWait
(
1000
);
// Click through all the setup buttons
// FIXME: NYI
// On MainWindow close we should get a message box telling the user to disconnect first. Disconnect will then pop
// the log file save dialog.
setExpectedMessageBox
(
QGCMessageBox
::
Yes
);
setExpectedFileDialog
(
getSaveFileName
,
QStringList
());
_mainWindow
->
close
();
QTest
::
qWait
(
1000
);
// Need to allow signals to move between threads
checkExpectedMessageBox
();
checkExpectedFileDialog
();
}
src/VehicleSetup/SetupViewTest.h
0 → 100644
View file @
e411b95c
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
/// @file
/// @author Don Gagne <don@thegagnes.com>
#ifndef SetupViewTest_H
#define SetupViewTest_H
#include "UnitTest.h"
#include "MainWindow.h"
/// Click through test for Setup View buttons
class
SetupViewTest
:
public
UnitTest
{
Q_OBJECT
public:
SetupViewTest
(
void
);
private
slots
:
void
init
(
void
);
void
cleanup
(
void
);
void
_clickThrough_test
(
void
);
private:
MainWindow
*
_mainWindow
;
};
#endif
src/qgcunittest/MainWindowTest.cc
View file @
e411b95c
...
...
@@ -54,21 +54,6 @@ void MainWindowTest::cleanup(void)
UnitTest
::
cleanup
();
}
void
MainWindowTest
::
_clickThrough_test
(
void
)
{
QGCToolBar
*
toolbar
=
_mainWindow
->
findChild
<
QGCToolBar
*>
();
Q_ASSERT
(
toolbar
);
QList
<
QToolButton
*>
buttons
=
toolbar
->
findChildren
<
QToolButton
*>
();
foreach
(
QToolButton
*
button
,
buttons
)
{
if
(
!
button
->
menu
())
{
QTest
::
mouseClick
(
button
,
Qt
::
LeftButton
);
QTest
::
qWait
(
1000
);
}
}
}
void
MainWindowTest
::
_connectWindowClose_test
(
MAV_AUTOPILOT
autopilot
)
{
LinkManager
*
linkMgr
=
LinkManager
::
instance
();
...
...
@@ -81,6 +66,18 @@ void MainWindowTest::_connectWindowClose_test(MAV_AUTOPILOT autopilot)
linkMgr
->
connectLink
(
link
);
QTest
::
qWait
(
5000
);
// Give enough time for UI to settle and heartbeats to go through
// Click through all top level toolbar buttons
QGCToolBar
*
toolbar
=
_mainWindow
->
findChild
<
QGCToolBar
*>
();
Q_ASSERT
(
toolbar
);
QList
<
QToolButton
*>
buttons
=
toolbar
->
findChildren
<
QToolButton
*>
();
foreach
(
QToolButton
*
button
,
buttons
)
{
if
(
!
button
->
menu
())
{
QTest
::
mouseClick
(
button
,
Qt
::
LeftButton
);
QTest
::
qWait
(
1000
);
}
}
// On MainWindow close we should get a message box telling the user to disconnect first. Cancel should do nothing.
setExpectedMessageBox
(
QGCMessageBox
::
Cancel
);
_mainWindow
->
close
();
...
...
src/qgcunittest/MainWindowTest.h
View file @
e411b95c
...
...
@@ -43,7 +43,6 @@ private slots:
void
init
(
void
);
void
cleanup
(
void
);
void
_clickThrough_test
(
void
);
void
_connectWindowClosePX4_test
(
void
);
void
_connectWindowCloseGeneric_test
(
void
);
...
...
src/qgcunittest/MockLink.param
View file @
e411b95c
...
...
@@ -381,7 +381,7 @@
1 50 RTL_RETURN_ALT 100 9
1 50 SDLOG_EXT -1 6
1 50 SDLOG_RATE -1 6
1 50 SENS_ACC_XOFF
0
9
1 50 SENS_ACC_XOFF
1
9
1 50 SENS_ACC_XSCALE 1 9
1 50 SENS_ACC_YOFF 0 9
1 50 SENS_ACC_YSCALE 1 9
...
...
@@ -396,13 +396,13 @@
1 50 SENS_DPRES_OFF 0 9
1 50 SENS_EXT_MAG 0 6
1 50 SENS_EXT_MAG_ROT 0 6
1 50 SENS_GYRO_XOFF
0
9
1 50 SENS_GYRO_XOFF
1
9
1 50 SENS_GYRO_XSCALE 1 9
1 50 SENS_GYRO_YOFF 0 9
1 50 SENS_GYRO_YSCALE 1 9
1 50 SENS_GYRO_ZOFF 0 9
1 50 SENS_GYRO_ZSCALE 1 9
1 50 SENS_MAG_XOFF
0
9
1 50 SENS_MAG_XOFF
1
9
1 50 SENS_MAG_XSCALE 1 9
1 50 SENS_MAG_YOFF 0 9
1 50 SENS_MAG_YSCALE 1 9
...
...
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