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
29365f96
Commit
29365f96
authored
Jul 21, 2015
by
Lorenz Meier
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1726 from DonLakeFlyer/MapRCToParam
Map rc to param fix
parents
5b2949ce
63e0f574
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
78 deletions
+19
-78
SensorsComponentSummaryFixedWing.qml
...AutoPilotPlugins/PX4/SensorsComponentSummaryFixedWing.qml
+1
-1
QGCMapRCToParamDialog.cpp
src/ui/QGCMapRCToParamDialog.cpp
+14
-50
QGCMapRCToParamDialog.h
src/ui/QGCMapRCToParamDialog.h
+4
-27
No files found.
src/AutoPilotPlugins/PX4/SensorsComponentSummaryFixedWing.qml
View file @
29365f96
...
...
@@ -44,7 +44,7 @@ FactPanel {
VehicleSummaryRow
{
labelText
:
"
Airspeed:
"
valueText
:
d
P
ressOffFact
.
value
==
0
?
"
Setup required
"
:
"
Ready
"
valueText
:
d
p
ressOffFact
.
value
==
0
?
"
Setup required
"
:
"
Ready
"
}
}
}
src/ui/QGCMapRCToParamDialog.cpp
View file @
29365f96
...
...
@@ -34,8 +34,7 @@
#include <QShowEvent>
#include <QPushButton>
QGCMapRCToParamDialog
::
QGCMapRCToParamDialog
(
QString
param_id
,
UASInterface
*
mav
,
QWidget
*
parent
)
:
QGCMapRCToParamDialog
::
QGCMapRCToParamDialog
(
QString
param_id
,
UASInterface
*
mav
,
QWidget
*
parent
)
:
QDialog
(
parent
),
param_id
(
param_id
),
mav
(
mav
),
...
...
@@ -43,22 +42,17 @@ QGCMapRCToParamDialog::QGCMapRCToParamDialog(QString param_id,
{
ui
->
setupUi
(
this
);
// only enable ok button when param was refreshed
QPushButton
*
okButton
=
ui
->
buttonBox
->
button
(
QDialogButtonBox
::
Ok
);
okButton
->
setEnabled
(
false
);
ui
->
paramIdLabel
->
setText
(
param_id
);
// Refresh the param
ParamLoader
*
paramLoader
=
new
ParamLoader
(
param_id
,
mav
);
paramLoader
->
moveToThread
(
&
paramLoadThread
);
connect
(
&
paramLoadThread
,
&
QThread
::
finished
,
paramLoader
,
&
QObject
::
deleteLater
);
connect
(
this
,
&
QGCMapRCToParamDialog
::
refreshParam
,
paramLoader
,
&
ParamLoader
::
load
);
connect
(
paramLoader
,
&
ParamLoader
::
paramLoaded
,
this
,
&
QGCMapRCToParamDialog
::
paramLoaded
);
paramLoadThread
.
start
();
emit
refreshParam
();
// refresh the parameter from onboard to make sure the current value is used
AutoPilotPlugin
*
autopilot
=
AutoPilotPluginManager
::
instance
()
->
getInstanceForAutoPilotPlugin
(
mav
).
data
();
Q_ASSERT
(
autopilot
);
connect
(
autopilot
->
getParameterFact
(
FactSystem
::
defaultComponentId
,
param_id
),
&
Fact
::
valueChanged
,
this
,
&
QGCMapRCToParamDialog
::
_parameterUpdated
);
autopilot
->
refreshParameter
(
FactSystem
::
defaultComponentId
,
param_id
);
}
QGCMapRCToParamDialog
::~
QGCMapRCToParamDialog
()
...
...
@@ -77,45 +71,15 @@ void QGCMapRCToParamDialog::accept() {
QDialog
::
accept
();
}
void
QGCMapRCToParamDialog
::
paramLoaded
(
bool
success
,
float
value
,
QString
message
)
{
paramLoadThread
.
quit
();
if
(
success
)
{
ui
->
infoLabel
->
setText
(
"Parameter value is up to date"
);
ui
->
value0DoubleSpinBox
->
setValue
(
value
);
ui
->
value0DoubleSpinBox
->
setEnabled
(
true
);
connect
(
this
,
&
QGCMapRCToParamDialog
::
mapRCToParamDialogResult
,
mav
,
&
UASInterface
::
sendMapRCToParam
);
QPushButton
*
okButton
=
ui
->
buttonBox
->
button
(
QDialogButtonBox
::
Ok
);
okButton
->
setEnabled
(
true
);
}
else
{
qDebug
()
<<
"Error while reading param"
<<
param_id
;
ui
->
infoLabel
->
setText
(
"Error while refreshing param ("
+
message
+
")"
);
}
}
ParamLoader
::
ParamLoader
(
QString
paramName
,
UASInterface
*
uas
,
QObject
*
parent
)
:
QObject
(
parent
),
_uas
(
uas
),
_paramName
(
paramName
),
_paramReceived
(
false
)
{
_autopilot
=
AutoPilotPluginManager
::
instance
()
->
getInstanceForAutoPilotPlugin
(
_uas
).
data
();
Q_ASSERT
(
_autopilot
);
}
void
ParamLoader
::
load
()
{
connect
(
_autopilot
->
getParameterFact
(
FactSystem
::
defaultComponentId
,
_paramName
),
&
Fact
::
valueChanged
,
this
,
&
ParamLoader
::
_parameterUpdated
);
// refresh the parameter from onboard to make sure the current value is used
_autopilot
->
refreshParameter
(
FactSystem
::
defaultComponentId
,
_paramName
);
}
void
ParamLoader
::
_parameterUpdated
(
QVariant
value
)
void
QGCMapRCToParamDialog
::
_parameterUpdated
(
QVariant
value
)
{
Q_UNUSED
(
value
);
emit
paramLoaded
(
true
,
_autopilot
->
getParameterFact
(
FactSystem
::
defaultComponentId
,
_paramName
)
->
value
().
toFloat
(),
""
);
ui
->
infoLabel
->
setText
(
"Parameter value is up to date"
);
ui
->
value0DoubleSpinBox
->
setValue
(
value
.
toDouble
());
ui
->
value0DoubleSpinBox
->
setEnabled
(
true
);
connect
(
this
,
&
QGCMapRCToParamDialog
::
mapRCToParamDialogResult
,
mav
,
&
UASInterface
::
sendMapRCToParam
);
QPushButton
*
okButton
=
ui
->
buttonBox
->
button
(
QDialogButtonBox
::
Ok
);
okButton
->
setEnabled
(
true
);
}
src/ui/QGCMapRCToParamDialog.h
View file @
29365f96
...
...
@@ -39,29 +39,6 @@ class QGCMapRCToParamDialog;
}
class
ParamLoader
:
public
QObject
{
Q_OBJECT
public:
ParamLoader
(
QString
paramName
,
UASInterface
*
uas
,
QObject
*
parent
=
NULL
);
public
slots
:
void
load
();
signals:
void
paramLoaded
(
bool
success
,
float
value
,
QString
message
=
""
);
void
correctParameterChanged
();
private
slots
:
void
_parameterUpdated
(
QVariant
value
);
private:
UASInterface
*
_uas
;
AutoPilotPlugin
*
_autopilot
;
QString
_paramName
;
bool
_paramReceived
;
};
class
QGCMapRCToParamDialog
:
public
QDialog
{
...
...
@@ -69,24 +46,24 @@ class QGCMapRCToParamDialog : public QDialog
QThread
paramLoadThread
;
public:
explicit
QGCMapRCToParamDialog
(
QString
param_id
,
UASInterface
*
mav
,
QWidget
*
parent
=
0
);
explicit
QGCMapRCToParamDialog
(
QString
param_id
,
UASInterface
*
mav
,
QWidget
*
parent
=
0
);
~
QGCMapRCToParamDialog
();
signals:
void
mapRCToParamDialogResult
(
QString
param_id
,
float
scale
,
float
value0
,
quint8
param_rc_channel_index
,
float
valueMin
,
float
valueMax
);
void
refreshParam
();
public
slots
:
void
accept
();
void
paramLoaded
(
bool
success
,
float
value
,
QString
message
);
protected:
// void showEvent(QShowEvent * event );
QString
param_id
;
UASInterface
*
mav
;
private
slots
:
void
_parameterUpdated
(
QVariant
value
);
private:
Ui
::
QGCMapRCToParamDialog
*
ui
;
};
...
...
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