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
d1828fe5
Commit
d1828fe5
authored
Apr 16, 2019
by
Gus Grubba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reset Parameters to Vehicle's Default
parent
168bc8ec
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
128 additions
and
90 deletions
+128
-90
ParameterManager.cc
src/FactSystem/ParameterManager.cc
+14
-5
ParameterManager.h
src/FactSystem/ParameterManager.h
+18
-17
ParameterEditor.qml
src/QmlControls/ParameterEditor.qml
+60
-40
ParameterEditorController.cc
src/QmlControls/ParameterEditorController.cc
+16
-10
ParameterEditorController.h
src/QmlControls/ParameterEditorController.h
+5
-4
QGCViewDialogContainer.qml
src/QmlControls/QGCViewDialogContainer.qml
+15
-14
No files found.
src/FactSystem/ParameterManager.cc
View file @
d1828fe5
...
...
@@ -1542,7 +1542,7 @@ bool ParameterManager::loadFromJson(const QJsonObject& json, bool required, QStr
return
true
;
}
void
ParameterManager
::
resetAllParametersToDefaults
(
void
)
void
ParameterManager
::
resetAllParametersToDefaults
()
{
_vehicle
->
sendMavCommand
(
MAV_COMP_ID_ALL
,
MAV_CMD_PREFLIGHT_STORAGE
,
...
...
@@ -1551,6 +1551,15 @@ void ParameterManager::resetAllParametersToDefaults(void)
-
1
);
// Don't do anything with mission storage
}
void
ParameterManager
::
resetAllToVehicleConfiguration
()
{
//-- https://github.com/PX4/Firmware/pull/11760
Fact
*
sysAutoConfigFact
=
getParameter
(
-
1
,
"SYS_AUTOCONFIG"
);
if
(
sysAutoConfigFact
)
{
sysAutoConfigFact
->
setRawValue
(
2
);
}
}
QString
ParameterManager
::
_logVehiclePrefix
(
int
componentId
)
{
if
(
componentId
==
-
1
)
{
...
...
@@ -1563,7 +1572,7 @@ QString ParameterManager::_logVehiclePrefix(int componentId)
void
ParameterManager
::
_setLoadProgress
(
double
loadProgress
)
{
_loadProgress
=
loadProgress
;
emit
loadProgressChanged
(
loadProgress
);
emit
loadProgressChanged
(
static_cast
<
float
>
(
loadProgress
)
);
}
QList
<
int
>
ParameterManager
::
componentIds
(
void
)
...
...
src/FactSystem/ParameterManager.h
View file @
d1828fe5
...
...
@@ -61,7 +61,8 @@ public:
/// Request a refresh on all parameters that begin with the specified prefix
void
refreshParametersPrefix
(
int
componentId
,
const
QString
&
namePrefix
);
void
resetAllParametersToDefaults
(
void
);
void
resetAllParametersToDefaults
();
void
resetAllToVehicleConfiguration
();
/// Returns true if the specifed parameter exists
/// @param componentId Component id or FactSystem::defaultComponentId
...
...
src/QmlControls/ParameterEditor.qml
View file @
d1828fe5
...
...
@@ -98,17 +98,25 @@ Item {
anchors.right
:
parent
.
right
text
:
qsTr
(
"
Tools
"
)
visible
:
!
_searchFilter
onClicked
:
toolsMenu
.
popup
()
}
menu
:
Menu
{
Menu
{
id
:
toolsMenu
MenuItem
{
text
:
qsTr
(
"
Refresh
"
)
onTriggered
:
controller
.
refresh
()
}
MenuItem
{
text
:
qsTr
(
"
Reset all to
defaults
"
)
text
:
qsTr
(
"
Reset all to firmware's
defaults
"
)
visible
:
!
activeVehicle
.
apmFirmware
onTriggered
:
mainWindow
.
showDialog
(
resetToDefaultConfirmComponent
,
qsTr
(
"
Reset All
"
),
mainWindow
.
showDialogDefaultWidth
,
StandardButton
.
Cancel
|
StandardButton
.
Reset
)
}
MenuItem
{
text
:
qsTr
(
"
Reset to vehicle's configuration defaults
"
)
visible
:
!
activeVehicle
.
apmFirmware
onTriggered
:
mainWindow
.
showDialog
(
resetToVehicleConfigurationConfirmComponent
,
qsTr
(
"
Reset All
"
),
mainWindow
.
showDialogDefaultWidth
,
StandardButton
.
Cancel
|
StandardButton
.
Reset
)
}
MenuSeparator
{
}
MenuItem
{
text
:
qsTr
(
"
Load from file...
"
)
...
...
@@ -140,7 +148,6 @@ Item {
onTriggered
:
mainWindow
.
showDialog
(
rebootVehicleConfirmComponent
,
qsTr
(
"
Reboot Vehicle
"
),
mainWindow
.
showDialogDefaultWidth
,
StandardButton
.
Cancel
|
StandardButton
.
Ok
)
}
}
}
/// Group buttons
QGCFlickable
{
...
...
@@ -309,13 +316,11 @@ Item {
Component
{
id
:
resetToDefaultConfirmComponent
QGCViewDialog
{
function
accept
()
{
controller
.
resetAllToDefaults
()
hideDialog
()
}
QGCLabel
{
width
:
parent
.
width
wrapMode
:
Text
.
WordWrap
...
...
@@ -324,6 +329,21 @@ Item {
}
}
Component
{
id
:
resetToVehicleConfigurationConfirmComponent
QGCViewDialog
{
function
accept
()
{
controller
.
resetAllToVehicleConfiguration
()
hideDialog
()
}
QGCLabel
{
width
:
parent
.
width
wrapMode
:
Text
.
WordWrap
text
:
qsTr
(
"
Select Reset to reset all parameters to the vehicle's configuration defaults.
"
)
}
}
}
Component
{
id
:
rebootVehicleConfirmComponent
...
...
src/QmlControls/ParameterEditorController.cc
View file @
d1828fe5
...
...
@@ -151,6 +151,12 @@ void ParameterEditorController::resetAllToDefaults(void)
refresh
();
}
void
ParameterEditorController
::
resetAllToVehicleConfiguration
(
void
)
{
_parameterMgr
->
resetAllToVehicleConfiguration
();
refresh
();
}
void
ParameterEditorController
::
setRCToParam
(
const
QString
&
paramName
)
{
#ifdef __mobile__
...
...
src/QmlControls/ParameterEditorController.h
View file @
d1828fe5
...
...
@@ -46,6 +46,7 @@ public:
Q_INVOKABLE
void
loadFromFile
(
const
QString
&
filename
);
Q_INVOKABLE
void
refresh
(
void
);
Q_INVOKABLE
void
resetAllToDefaults
(
void
);
Q_INVOKABLE
void
resetAllToVehicleConfiguration
(
void
);
Q_INVOKABLE
void
setRCToParam
(
const
QString
&
paramName
);
QList
<
QObject
*>
model
(
void
);
...
...
src/QmlControls/QGCViewDialogContainer.qml
View file @
d1828fe5
...
...
@@ -120,6 +120,7 @@ Item {
QGCButton
{
id
:
_acceptButton
anchors.right
:
parent
.
right
anchors.bottom
:
parent
.
bottom
primary
:
true
onClicked
:
{
_dialogComponentLoader
.
item
.
accept
()
...
...
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