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
ef161bcd
Unverified
Commit
ef161bcd
authored
Jan 06, 2020
by
Don Gagne
Committed by
GitHub
Jan 06, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8201 from DonLakeFlyer/JoystickFlightModes
Allow plugin to add flight modes to joystick button actions
parents
d2345772
94f84a56
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
10 deletions
+22
-10
FirmwarePlugin.h
src/FirmwarePlugin/FirmwarePlugin.h
+6
-5
Joystick.cc
src/Joystick/Joystick.cc
+5
-1
Vehicle.cc
src/Vehicle/Vehicle.cc
+5
-0
Vehicle.h
src/Vehicle/Vehicle.h
+6
-4
No files found.
src/FirmwarePlugin/FirmwarePlugin.h
View file @
ef161bcd
...
...
@@ -81,12 +81,13 @@ public:
/// free when no longer needed.
virtual
QList
<
VehicleComponent
*>
componentsForVehicle
(
AutoPilotPlugin
*
vehicle
);
/// Returns the list of available flight modes. Flight modes can be different in normal/advanced ui mode.
/// Returns the list of available flight modes for the Fly View dropdown. This may or may not be the full
/// list available from the firmware. Call will be made again if advanced mode changes.
virtual
QStringList
flightModes
(
Vehicle
*
/*vehicle*/
)
{
return
QStringList
();
}
/// Returns the list of additional flight modes to add to the list for joystick button actions.
/// Call will be made again if advanced mode changes.
virtual
QStringList
flightModes
(
Vehicle
*
vehicle
)
{
Q_UNUSED
(
vehicle
);
return
QStringList
();
}
virtual
QStringList
extraJoystickFlightModes
(
Vehicle
*
/*vehicle*/
)
{
return
QStringList
();
}
/// Returns the name for this flight mode. Flight mode names must be human readable as well as audio speakable.
/// @param base_mode Base mode from mavlink HEARTBEAT message
...
...
src/Joystick/Joystick.cc
View file @
ef161bcd
...
...
@@ -972,7 +972,7 @@ void Joystick::_executeButtonAction(const QString& action, bool buttonDown)
if
(
buttonDown
)
emit
setVtolInFwdFlight
(
true
);
}
else
if
(
action
==
_buttonActionVTOLMultiRotor
)
{
if
(
buttonDown
)
emit
setVtolInFwdFlight
(
false
);
}
else
if
(
_activeVehicle
->
flightModes
().
contains
(
action
))
{
}
else
if
(
_activeVehicle
->
flightModes
().
contains
(
action
)
||
_activeVehicle
->
extraJoystickFlightModes
().
contains
(
action
)
)
{
if
(
buttonDown
)
emit
setFlightMode
(
action
);
}
else
if
(
action
==
_buttonActionContinuousZoomIn
||
action
==
_buttonActionContinuousZoomOut
)
{
if
(
buttonDown
)
{
...
...
@@ -1072,6 +1072,10 @@ void Joystick::_buildActionList(Vehicle* activeVehicle)
foreach
(
auto
mode
,
list
)
{
_assignableButtonActions
.
append
(
new
AssignableButtonAction
(
this
,
mode
));
}
list
=
activeVehicle
->
extraJoystickFlightModes
();
foreach
(
auto
mode
,
list
)
{
_assignableButtonActions
.
append
(
new
AssignableButtonAction
(
this
,
mode
));
}
}
_assignableButtonActions
.
append
(
new
AssignableButtonAction
(
this
,
_buttonActionVTOLFixedWing
));
_assignableButtonActions
.
append
(
new
AssignableButtonAction
(
this
,
_buttonActionVTOLMultiRotor
));
...
...
src/Vehicle/Vehicle.cc
View file @
ef161bcd
...
...
@@ -2375,6 +2375,11 @@ QStringList Vehicle::flightModes(void)
return
_firmwarePlugin
->
flightModes
(
this
);
}
QStringList
Vehicle
::
extraJoystickFlightModes
(
void
)
{
return
_firmwarePlugin
->
extraJoystickFlightModes
(
this
);
}
QString
Vehicle
::
flightMode
(
void
)
const
{
return
_firmwarePlugin
->
flightMode
(
_base_mode
,
_custom_mode
);
...
...
src/Vehicle/Vehicle.h
View file @
ef161bcd
...
...
@@ -542,6 +542,7 @@ public:
Q_PROPERTY
(
bool
autoDisarm
READ
autoDisarm
NOTIFY
autoDisarmChanged
)
Q_PROPERTY
(
bool
flightModeSetAvailable
READ
flightModeSetAvailable
CONSTANT
)
Q_PROPERTY
(
QStringList
flightModes
READ
flightModes
NOTIFY
flightModesChanged
)
Q_PROPERTY
(
QStringList
extraJoystickFlightModes
READ
extraJoystickFlightModes
NOTIFY
flightModesChanged
)
Q_PROPERTY
(
QString
flightMode
READ
flightMode
WRITE
setFlightMode
NOTIFY
flightModeChanged
)
Q_PROPERTY
(
bool
hilMode
READ
hilMode
WRITE
setHilMode
NOTIFY
hilModeChanged
)
Q_PROPERTY
(
TrajectoryPoints
*
trajectoryPoints
MEMBER
_trajectoryPoints
CONSTANT
)
...
...
@@ -851,10 +852,11 @@ public:
bool
armed
()
{
return
_armed
;
}
void
setArmed
(
bool
armed
);
bool
flightModeSetAvailable
(
void
);
QStringList
flightModes
(
void
);
QString
flightMode
(
void
)
const
;
void
setFlightMode
(
const
QString
&
flightMode
);
bool
flightModeSetAvailable
(
void
);
QStringList
flightModes
(
void
);
QStringList
extraJoystickFlightModes
(
void
);
QString
flightMode
(
void
)
const
;
void
setFlightMode
(
const
QString
&
flightMode
);
QString
priorityLinkName
(
void
)
const
;
QVariantList
links
(
void
)
const
;
...
...
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