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
3d0ade08
Commit
3d0ade08
authored
Nov 29, 2014
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug with base mode
parent
13bbc5a3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
6 deletions
+42
-6
MockLink.cc
src/qgcunittest/MockLink.cc
+40
-5
MockLink.h
src/qgcunittest/MockLink.h
+2
-1
No files found.
src/qgcunittest/MockLink.cc
View file @
3d0ade08
...
...
@@ -34,6 +34,35 @@
///
/// @author Don Gagne <don@thegagnes.com>
enum
PX4_CUSTOM_MAIN_MODE
{
PX4_CUSTOM_MAIN_MODE_MANUAL
=
1
,
PX4_CUSTOM_MAIN_MODE_ALTCTL
,
PX4_CUSTOM_MAIN_MODE_POSCTL
,
PX4_CUSTOM_MAIN_MODE_AUTO
,
PX4_CUSTOM_MAIN_MODE_ACRO
,
PX4_CUSTOM_MAIN_MODE_OFFBOARD
,
};
enum
PX4_CUSTOM_SUB_MODE_AUTO
{
PX4_CUSTOM_SUB_MODE_AUTO_READY
=
1
,
PX4_CUSTOM_SUB_MODE_AUTO_TAKEOFF
,
PX4_CUSTOM_SUB_MODE_AUTO_LOITER
,
PX4_CUSTOM_SUB_MODE_AUTO_MISSION
,
PX4_CUSTOM_SUB_MODE_AUTO_RTL
,
PX4_CUSTOM_SUB_MODE_AUTO_LAND
,
PX4_CUSTOM_SUB_MODE_AUTO_RTGS
};
union
px4_custom_mode
{
struct
{
uint16_t
reserved
;
uint8_t
main_mode
;
uint8_t
sub_mode
;
};
uint32_t
data
;
float
data_float
;
};
MockLink
::
MockLink
(
void
)
:
_linkId
(
getNextLinkId
()),
_name
(
"MockLink"
),
...
...
@@ -42,9 +71,15 @@ MockLink::MockLink(void) :
_vehicleComponentId
(
200
),
// FIXME: magic number?
_inNSH
(
false
),
_mavlinkStarted
(
false
),
_mav
Mode
(
MAV_MODE_FLAG_MANUAL_INPUT
_ENABLED
),
_mav
BaseMode
(
MAV_MODE_FLAG_MANUAL_INPUT_ENABLED
|
MAV_MODE_FLAG_CUSTOM_MODE
_ENABLED
),
_mavState
(
MAV_STATE_STANDBY
)
{
union
px4_custom_mode
px4_cm
;
px4_cm
.
data
=
0
;
px4_cm
.
main_mode
=
PX4_CUSTOM_MAIN_MODE_MANUAL
;
_mavCustomMode
=
px4_cm
.
data
;
_missionItemHandler
=
new
MockLinkMissionItemHandler
(
_vehicleSystemId
,
this
);
Q_CHECK_PTR
(
_missionItemHandler
);
...
...
@@ -56,7 +91,6 @@ MockLink::MockLink(void) :
MockLink
::~
MockLink
(
void
)
{
_disconnect
();
deleteLater
();
}
void
MockLink
::
readBytes
(
void
)
...
...
@@ -184,8 +218,8 @@ void MockLink::_sendHeartBeat(void)
&
msg
,
MAV_TYPE_QUADROTOR
,
// MAV_TYPE
MAV_AUTOPILOT_PX4
,
// MAV_AUTOPILOT
_mav
Mode
,
// MAV_MODE
0
,
// custom mode
_mav
BaseMode
,
// MAV_MODE
_mavCustomMode
,
// custom mode
_mavState
);
// MAV_STATE
int
cBuffer
=
mavlink_msg_to_send_buffer
(
buffer
,
&
msg
);
...
...
@@ -323,7 +357,8 @@ void MockLink::_handleSetMode(const mavlink_message_t& msg)
mavlink_msg_set_mode_decode
(
&
msg
,
&
request
);
if
(
request
.
target_system
==
_vehicleSystemId
)
{
_mavMode
=
request
.
base_mode
;
_mavBaseMode
=
request
.
base_mode
;
_mavCustomMode
=
request
.
custom_mode
;
}
else
{
_errorInvalidTargetSystem
(
request
.
target_system
);
}
...
...
src/qgcunittest/MockLink.h
View file @
3d0ade08
...
...
@@ -118,7 +118,8 @@ private:
typedef
QMap
<
uint16_t
,
mavlink_mission_item_t
>
MissionList_t
;
MissionList_t
_missionItems
;
uint8_t
_mavMode
;
uint8_t
_mavBaseMode
;
uint8_t
_mavCustomMode
;
uint8_t
_mavState
;
};
...
...
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