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
aa52020c
Commit
aa52020c
authored
Apr 22, 2016
by
dogmaphobic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed crash when switching to the Flight Modes panel.
parent
0d214e1e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
38 deletions
+52
-38
FlightModesComponent.cc
src/AutoPilotPlugins/PX4/FlightModesComponent.cc
+10
-8
PX4AutoPilotPlugin.cc
src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc
+21
-21
PX4SimpleFlightModesController.cc
src/AutoPilotPlugins/PX4/PX4SimpleFlightModesController.cc
+21
-9
No files found.
src/AutoPilotPlugins/PX4/FlightModesComponent.cc
View file @
aa52020c
/*=====================================================================
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
...
...
@@ -107,8 +107,10 @@ QString FlightModesComponent::prerequisiteSetup(void) const
return
plugin
->
airframeComponent
()
->
name
();
}
else
if
(
!
plugin
->
radioComponent
()
->
setupComplete
())
{
return
plugin
->
radioComponent
()
->
name
();
}
else
if
(
!
plugin
->
sensorsComponent
()
->
setupComplete
())
{
return
plugin
->
sensorsComponent
()
->
name
();
}
}
return
QString
();
}
src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc
View file @
aa52020c
/*=====================================================================
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/>.
======================================================================*/
#include "PX4AutoPilotPlugin.h"
...
...
@@ -44,7 +44,7 @@ enum PX4_CUSTOM_MAIN_MODE {
PX4_CUSTOM_MAIN_MODE_OFFBOARD
,
PX4_CUSTOM_MAIN_MODE_STABILIZED
,
PX4_CUSTOM_MAIN_MODE_RATTITUDE
};
enum
PX4_CUSTOM_SUB_MODE_AUTO
{
...
...
@@ -80,10 +80,10 @@ PX4AutoPilotPlugin::PX4AutoPilotPlugin(Vehicle* vehicle, QObject* parent) :
_incorrectParameterVersion
(
false
)
{
Q_ASSERT
(
vehicle
);
_airframeFacts
=
new
PX4AirframeLoader
(
this
,
_vehicle
->
uas
(),
this
);
Q_CHECK_PTR
(
_airframeFacts
);
PX4AirframeLoader
::
loadAirframeMetaData
();
}
...
...
@@ -96,28 +96,28 @@ const QVariantList& PX4AutoPilotPlugin::vehicleComponents(void)
{
if
(
_components
.
count
()
==
0
&&
!
_incorrectParameterVersion
)
{
Q_ASSERT
(
_vehicle
);
if
(
parametersReady
())
{
_airframeComponent
=
new
AirframeComponent
(
_vehicle
,
this
);
_airframeComponent
->
setupTriggerSignals
();
_components
.
append
(
QVariant
::
fromValue
((
VehicleComponent
*
)
_airframeComponent
));
_radioComponent
=
new
PX4RadioComponent
(
_vehicle
,
this
);
_radioComponent
->
setupTriggerSignals
();
_components
.
append
(
QVariant
::
fromValue
((
VehicleComponent
*
)
_radioComponent
));
_flightModesComponent
=
new
FlightModesComponent
(
_vehicle
,
this
);
_flightModesComponent
->
setupTriggerSignals
();
_components
.
append
(
QVariant
::
fromValue
((
VehicleComponent
*
)
_flightModesComponent
));
_sensorsComponent
=
new
SensorsComponent
(
_vehicle
,
this
);
_sensorsComponent
->
setupTriggerSignals
();
_components
.
append
(
QVariant
::
fromValue
((
VehicleComponent
*
)
_sensorsComponent
));
_flightModesComponent
=
new
FlightModesComponent
(
_vehicle
,
this
);
_flightModesComponent
->
setupTriggerSignals
();
_components
.
append
(
QVariant
::
fromValue
((
VehicleComponent
*
)
_flightModesComponent
));
_powerComponent
=
new
PowerComponent
(
_vehicle
,
this
);
_powerComponent
->
setupTriggerSignals
();
_components
.
append
(
QVariant
::
fromValue
((
VehicleComponent
*
)
_powerComponent
));
_safetyComponent
=
new
SafetyComponent
(
_vehicle
,
this
);
_safetyComponent
->
setupTriggerSignals
();
_components
.
append
(
QVariant
::
fromValue
((
VehicleComponent
*
)
_safetyComponent
));
...
...
@@ -136,7 +136,7 @@ const QVariantList& PX4AutoPilotPlugin::vehicleComponents(void)
qWarning
()
<<
"Call to vehicleCompenents prior to parametersReady"
;
}
}
return
_components
;
}
...
...
@@ -150,8 +150,8 @@ void PX4AutoPilotPlugin::_parametersReadyPreChecks(bool missingParameters)
_incorrectParameterVersion
=
true
;
qgcApp
()
->
showMessage
(
"This version of GroundControl can only perform vehicle setup on a newer version of firmware. "
"Please perform a Firmware Upgrade if you wish to use Vehicle Setup."
);
}
}
_parametersReady
=
true
;
_missingParameters
=
missingParameters
;
emit
missingParametersChanged
(
_missingParameters
);
...
...
src/AutoPilotPlugins/PX4/PX4SimpleFlightModesController.cc
View file @
aa52020c
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009, 2015 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/>.
======================================================================*/
#include "PX4SimpleFlightModesController.h"
...
...
@@ -53,9 +53,21 @@ void PX4SimpleFlightModesController::_rcChannelsChanged(int channelCount, int pw
}
emit
rcChannelValuesChanged
();
int
flightModeChannel
=
getParameterFact
(
-
1
,
"RC_MAP_FLTMODE"
)
->
rawValue
().
toInt
()
-
1
;
Fact
*
pFact
=
getParameterFact
(
-
1
,
"RC_MAP_FLTMODE"
);
if
(
!
pFact
)
{
qCritical
()
<<
"RC_MAP_FLTMODE Fact is NULL in"
<<
__func__
<<
__FILE__
<<
__LINE__
;
return
;
}
int
flightModeChannel
=
pFact
->
rawValue
().
toInt
()
-
1
;
pFact
=
getParameterFact
(
-
1
,
QString
(
"RC%1_REV"
).
arg
(
flightModeChannel
+
1
));
if
(
!
pFact
)
{
qCritical
()
<<
QString
(
"RC%1_REV"
).
arg
(
flightModeChannel
+
1
)
<<
"is NULL in"
<<
__func__
<<
__FILE__
<<
__LINE__
;
return
;
}
int
flightModeReversed
=
getParameterFact
(
1
,
QString
(
"RC%1_REV"
).
arg
(
flightModeChannel
+
1
))
->
rawValue
().
toInt
();
int
flightModeReversed
=
pFact
->
rawValue
().
toInt
();
if
(
flightModeChannel
<
0
||
flightModeChannel
>
channelCount
)
{
return
;
...
...
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