Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
ed8158e3
Unverified
Commit
ed8158e3
authored
Jan 08, 2019
by
Don Gagne
Committed by
GitHub
Jan 08, 2019
Browse files
Merge pull request #7120 from DonLakeFlyer/ReservedButtons
Remove the concept of reserved buttons for manual control
parents
50bd4a21
c7741be7
Changes
12
Hide whitespace changes
Inline
Side-by-side
src/FirmwarePlugin/APM/APMFirmwarePlugin.cc
View file @
ed8158e3
...
...
@@ -228,13 +228,6 @@ bool APMFirmwarePlugin::setFlightMode(const QString& flightMode, uint8_t* base_m
return
found
;
}
int
APMFirmwarePlugin
::
manualControlReservedButtonCount
(
void
)
{
// We don't know whether the firmware is going to used any of these buttons.
// So reserve them all.
return
-
1
;
}
void
APMFirmwarePlugin
::
_handleIncomingParamValue
(
Vehicle
*
vehicle
,
mavlink_message_t
*
message
)
{
Q_UNUSED
(
vehicle
);
...
...
src/FirmwarePlugin/APM/APMFirmwarePlugin.h
View file @
ed8158e3
...
...
@@ -90,7 +90,6 @@ public:
void
pauseVehicle
(
Vehicle
*
vehicle
)
override
;
void
guidedModeRTL
(
Vehicle
*
vehicle
)
override
;
void
guidedModeChangeAltitude
(
Vehicle
*
vehicle
,
double
altitudeChange
)
override
;
int
manualControlReservedButtonCount
(
void
)
override
;
bool
adjustIncomingMavlinkMessage
(
Vehicle
*
vehicle
,
mavlink_message_t
*
message
)
override
;
void
adjustOutgoingMavlinkMessage
(
Vehicle
*
vehicle
,
LinkInterface
*
outgoingLink
,
mavlink_message_t
*
message
)
override
;
virtual
void
initializeStreamRates
(
Vehicle
*
vehicle
);
...
...
src/FirmwarePlugin/APM/ArduSubFirmwarePlugin.cc
View file @
ed8158e3
...
...
@@ -164,11 +164,6 @@ int ArduSubFirmwarePlugin::remapParamNameHigestMinorVersionNumber(int majorVersi
return
majorVersionNumber
==
3
?
6
:
Vehicle
::
versionNotSetValue
;
}
int
ArduSubFirmwarePlugin
::
manualControlReservedButtonCount
(
void
)
{
return
0
;
}
void
ArduSubFirmwarePlugin
::
initializeStreamRates
(
Vehicle
*
vehicle
)
{
vehicle
->
requestDataStream
(
MAV_DATA_STREAM_RAW_SENSORS
,
2
);
vehicle
->
requestDataStream
(
MAV_DATA_STREAM_EXTENDED_STATUS
,
2
);
...
...
src/FirmwarePlugin/APM/ArduSubFirmwarePlugin.h
View file @
ed8158e3
...
...
@@ -110,9 +110,6 @@ public:
QList
<
MAV_CMD
>
supportedMissionCommands
(
void
)
final
;
// Overrides from FirmwarePlugin
int
manualControlReservedButtonCount
(
void
)
final
;
int
defaultJoystickTXMode
(
void
)
final
{
return
3
;
}
void
initializeStreamRates
(
Vehicle
*
vehicle
)
override
final
;
...
...
src/FirmwarePlugin/FirmwarePlugin.cc
View file @
ed8158e3
...
...
@@ -115,13 +115,6 @@ bool FirmwarePlugin::setFlightMode(const QString& flightMode, uint8_t* base_mode
return
false
;
}
int
FirmwarePlugin
::
manualControlReservedButtonCount
(
void
)
{
// We don't know whether the firmware is going to used any of these buttons.
// So reserve them all.
return
-
1
;
}
int
FirmwarePlugin
::
defaultJoystickTXMode
(
void
)
{
return
2
;
...
...
src/FirmwarePlugin/FirmwarePlugin.h
View file @
ed8158e3
...
...
@@ -146,14 +146,6 @@ public:
/// @param altitudeChange If > 0, go up by amount specified, if < 0, go down by amount specified
virtual
void
guidedModeChangeAltitude
(
Vehicle
*
vehicle
,
double
altitudeChange
);
/// FIXME: This isn't quite correct being here. All code for Joystick suvehicleTypepport is currently firmware specific
/// not just this. I'm going to try to change that. If not, this will need to be removed.
/// Returns the number of buttons which are reserved for firmware use in the MANUAL_CONTROL mavlink
/// message. For example PX4 Flight Stack reserves the first 8 buttons to simulate rc switches.
/// The remainder can be assigned to Vehicle actions.
/// @return -1: reserver all buttons, >0 number of buttons to reserve
virtual
int
manualControlReservedButtonCount
(
void
);
/// Default tx mode to apply to joystick axes
/// TX modes are as outlined here: http://www.rc-airplane-world.com/rc-transmitter-modes.html
virtual
int
defaultJoystickTXMode
(
void
);
...
...
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.cc
View file @
ed8158e3
...
...
@@ -225,11 +225,6 @@ bool PX4FirmwarePlugin::setFlightMode(const QString& flightMode, uint8_t* base_m
return
found
;
}
int
PX4FirmwarePlugin
::
manualControlReservedButtonCount
(
void
)
{
return
0
;
// 0 buttons reserved for rc switch simulation
}
bool
PX4FirmwarePlugin
::
isCapable
(
const
Vehicle
*
vehicle
,
FirmwareCapabilities
capabilities
)
{
int
available
=
SetFlightModeCapability
|
PauseVehicleCapability
|
GuidedModeCapability
;
...
...
src/FirmwarePlugin/PX4/PX4FirmwarePlugin.h
View file @
ed8158e3
...
...
@@ -52,7 +52,6 @@ public:
double
minimumTakeoffAltitude
(
Vehicle
*
vehicle
)
override
;
void
startMission
(
Vehicle
*
vehicle
)
override
;
bool
isGuidedMode
(
const
Vehicle
*
vehicle
)
const
override
;
int
manualControlReservedButtonCount
(
void
)
override
;
void
initializeVehicle
(
Vehicle
*
vehicle
)
override
;
bool
sendHomePositionToVehicle
(
void
)
override
;
void
addMetaDataToFact
(
QObject
*
parameterMetaData
,
Fact
*
fact
,
MAV_TYPE
vehicleType
)
override
;
...
...
src/Joystick/Joystick.cc
View file @
ed8158e3
...
...
@@ -516,12 +516,6 @@ void Joystick::run(void)
// Set up button pressed information
// We only send the buttons the firmwware has reserved
int
reservedButtonCount
=
_activeVehicle
->
manualControlReservedButtonCount
();
if
(
reservedButtonCount
==
-
1
)
{
reservedButtonCount
=
_totalButtonCount
;
}
quint16
newButtonBits
=
0
;
// New set of button which are down
quint16
buttonPressedBits
=
0
;
// Buttons pressed for manualControl signal
...
...
@@ -536,12 +530,9 @@ void Joystick::run(void)
// Button was up last time through, but is now down which indicates a button press
qCDebug
(
JoystickLog
)
<<
"button triggered"
<<
buttonIndex
;
if
(
buttonIndex
>=
reservedButtonCount
)
{
// Button is above firmware reserved set
QString
buttonAction
=
_rgButtonActions
[
buttonIndex
];
if
(
!
buttonAction
.
isEmpty
())
{
_buttonAction
(
buttonAction
);
}
QString
buttonAction
=
_rgButtonActions
[
buttonIndex
];
if
(
!
buttonAction
.
isEmpty
())
{
_buttonAction
(
buttonAction
);
}
}
...
...
@@ -554,6 +545,7 @@ void Joystick::run(void)
qCDebug
(
JoystickValuesLog
)
<<
"name:roll:pitch:yaw:throttle"
<<
name
()
<<
roll
<<
-
pitch
<<
yaw
<<
throttle
;
// NOTE: The buttonPressedBits going to MANUAL_CONTROL are currently used by ArduSub.
emit
manualControl
(
roll
,
-
pitch
,
yaw
,
throttle
,
buttonPressedBits
,
_activeVehicle
->
joystickMode
());
}
...
...
src/Vehicle/Vehicle.cc
View file @
ed8158e3
...
...
@@ -2214,11 +2214,6 @@ void Vehicle::resetMessages()
}
}
int
Vehicle
::
manualControlReservedButtonCount
(
void
)
{
return
_firmwarePlugin
->
manualControlReservedButtonCount
();
}
void
Vehicle
::
_loadSettings
(
void
)
{
if
(
!
_active
)
{
...
...
src/Vehicle/Vehicle.h
View file @
ed8158e3
...
...
@@ -691,12 +691,6 @@ public:
/// Resets link status counters
Q_INVOKABLE
void
resetCounters
();
/// Returns the number of buttons which are reserved for firmware use in the MANUAL_CONTROL mavlink
/// message. For example PX4 Flight Stack reserves the first 8 buttons to simulate rc switches.
/// The remainder can be assigned to Vehicle actions.
/// @return -1: reserver all buttons, >0 number of buttons to reserve
Q_PROPERTY
(
int
manualControlReservedButtonCount
READ
manualControlReservedButtonCount
CONSTANT
)
// Called when the message drop-down is invoked to clear current count
Q_INVOKABLE
void
resetMessages
();
...
...
@@ -821,8 +815,6 @@ public:
/// Provides access to the Firmware Plugin for this Vehicle
FirmwarePlugin
*
firmwarePlugin
(
void
)
{
return
_firmwarePlugin
;
}
int
manualControlReservedButtonCount
(
void
);
MissionManager
*
missionManager
(
void
)
{
return
_missionManager
;
}
GeoFenceManager
*
geoFenceManager
(
void
)
{
return
_geoFenceManager
;
}
RallyPointManager
*
rallyPointManager
(
void
)
{
return
_rallyPointManager
;
}
...
...
src/VehicleSetup/JoystickConfig.qml
View file @
ed8158e3
...
...
@@ -620,20 +620,13 @@ SetupPage {
width
:
parent
.
width
spacing
:
ScreenTools
.
defaultFontPixelHeight
/
3
QGCLabel
{
visible
:
_activeVehicle
.
manualControlReservedButtonCount
!=
0
text
:
qsTr
(
"
Buttons 0-%1 reserved for firmware use
"
).
arg
(
reservedButtonCount
)
property
int
reservedButtonCount
:
_activeVehicle
.
manualControlReservedButtonCount
==
-
1
?
_activeJoystick
.
totalButtonCount
:
_activeVehicle
.
manualControlReservedButtonCount
}
Repeater
{
id
:
buttonActionRepeater
model
:
_activeJoystick
?
Math
.
min
(
_activeJoystick
.
totalButtonCount
,
_maxButtons
)
:
0
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
visible
:
(
_activeVehicle
.
manualControlReservedButtonCount
==
-
1
?
false
:
modelData
>=
_activeVehicle
.
manualControlReservedButtonCount
)
&&
!
_activeVehicle
.
supportsJSButton
visible
:
!
_activeVehicle
.
supportsJSButton
property
bool
pressed
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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