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
9b68c43f
Commit
9b68c43f
authored
Jul 21, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Parameter load errors shown to user
parent
29365f96
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
39 additions
and
8 deletions
+39
-8
AutoPilotPlugin.cc
src/AutoPilotPlugins/AutoPilotPlugin.cc
+2
-2
AutoPilotPlugin.h
src/AutoPilotPlugins/AutoPilotPlugin.h
+2
-1
ParameterLoader.cc
src/FactSystem/ParameterLoader.cc
+14
-2
ParameterLoader.h
src/FactSystem/ParameterLoader.h
+3
-1
ParameterEditor.qml
src/QmlControls/ParameterEditor.qml
+8
-1
ParameterEditorController.cc
src/QmlControls/ParameterEditorController.cc
+7
-1
ParameterEditorController.h
src/QmlControls/ParameterEditorController.h
+3
-0
No files found.
src/AutoPilotPlugins/AutoPilotPlugin.cc
View file @
9b68c43f
...
...
@@ -163,9 +163,9 @@ void AutoPilotPlugin::writeParametersToStream(QTextStream &stream)
_getParameterLoader
()
->
writeParametersToStream
(
stream
,
_uas
->
getUASName
());
}
void
AutoPilotPlugin
::
readParametersFromStream
(
QTextStream
&
stream
)
QString
AutoPilotPlugin
::
readParametersFromStream
(
QTextStream
&
stream
)
{
_getParameterLoader
()
->
readParametersFromStream
(
stream
);
return
_getParameterLoader
()
->
readParametersFromStream
(
stream
);
}
bool
AutoPilotPlugin
::
armed
(
void
)
...
...
src/AutoPilotPlugins/AutoPilotPlugin.h
View file @
9b68c43f
...
...
@@ -89,7 +89,8 @@ public:
void
writeParametersToStream
(
QTextStream
&
stream
);
/// Reads the parameters from the stream and updates values
void
readParametersFromStream
(
QTextStream
&
stream
);
/// @return Errors during load. Empty string for no errors
QString
readParametersFromStream
(
QTextStream
&
stream
);
/// Returns true if the specifed fact exists
Q_INVOKABLE
bool
factExists
(
FactSystem
::
Provider_t
provider
,
///< fact provider
...
...
src/FactSystem/ParameterLoader.cc
View file @
9b68c43f
...
...
@@ -579,8 +579,9 @@ void ParameterLoader::_saveToEEPROM(void)
qCDebug
(
ParameterLoaderLog
)
<<
"_saveToEEPROM"
;
}
void
ParameterLoader
::
readParametersFromStream
(
QTextStream
&
stream
)
QString
ParameterLoader
::
readParametersFromStream
(
QTextStream
&
stream
)
{
QString
errors
;
bool
userWarned
=
false
;
while
(
!
stream
.
atEnd
())
{
...
...
@@ -597,7 +598,7 @@ void ParameterLoader::readParametersFromStream(QTextStream& stream)
QGCMessageBox
::
Ok
|
QGCMessageBox
::
Cancel
,
QGCMessageBox
::
Cancel
);
if
(
button
==
QGCMessageBox
::
Cancel
)
{
return
;
return
QString
()
;
}
}
...
...
@@ -607,18 +608,29 @@ void ParameterLoader::readParametersFromStream(QTextStream& stream)
uint
mavType
=
wpParams
.
at
(
4
).
toUInt
();
if
(
!
_autopilot
->
factExists
(
FactSystem
::
ParameterProvider
,
componentId
,
paramName
))
{
QString
error
;
error
=
QString
(
"Skipped parameter %1:%2 - does not exist on this vehicle
\n
"
).
arg
(
componentId
).
arg
(
paramName
);
errors
+=
error
;
qCDebug
(
ParameterLoaderLog
)
<<
error
;
continue
;
}
Fact
*
fact
=
_autopilot
->
getFact
(
FactSystem
::
ParameterProvider
,
componentId
,
paramName
);
if
(
fact
->
type
()
!=
_mavTypeToFactType
((
MAV_PARAM_TYPE
)
mavType
))
{
QString
error
;
error
=
QString
(
"Skipped parameter %1:%2 - type mismatch %3:%4
\n
"
).
arg
(
componentId
).
arg
(
paramName
).
arg
(
fact
->
type
()).
arg
(
_mavTypeToFactType
((
MAV_PARAM_TYPE
)
mavType
));
errors
+=
error
;
qCDebug
(
ParameterLoaderLog
)
<<
error
;
continue
;
}
qCDebug
(
ParameterLoaderLog
)
<<
"Updating parameter"
<<
componentId
<<
paramName
<<
valStr
;
fact
->
setValue
(
valStr
);
}
}
}
return
errors
;
}
void
ParameterLoader
::
writeParametersToStream
(
QTextStream
&
stream
,
const
QString
&
name
)
...
...
src/FactSystem/ParameterLoader.h
View file @
9b68c43f
...
...
@@ -80,7 +80,9 @@ public:
const
QMap
<
int
,
QMap
<
QString
,
QStringList
>
>&
getGroupMap
(
void
);
void
readParametersFromStream
(
QTextStream
&
stream
);
/// Returns error messages from loading
QString
readParametersFromStream
(
QTextStream
&
stream
);
void
writeParametersToStream
(
QTextStream
&
stream
,
const
QString
&
name
);
/// Return the parameter for which the default component id is derived from. Return an empty
...
...
src/QmlControls/ParameterEditor.qml
View file @
9b68c43f
...
...
@@ -49,7 +49,14 @@ QGCView {
readonly
property
real
__rightMargin
:
20
readonly
property
int
__maxParamChars
:
16
ParameterEditorController
{
id
:
controller
;
factPanel
:
panel
}
ParameterEditorController
{
id
:
controller
;
factPanel
:
panel
onShowErrorMessage
:
{
showMessage
(
"
Parameter Load Errors
"
,
errorMsg
,
StandardButton
.
Ok
)
}
}
Component
{
id
:
editorDialogComponent
...
...
src/QmlControls/ParameterEditorController.cc
View file @
9b68c43f
...
...
@@ -95,6 +95,8 @@ void ParameterEditorController::saveToFile(void)
void
ParameterEditorController
::
loadFromFile
(
void
)
{
QString
errors
;
Q_ASSERT
(
_autopilot
);
QString
msgTitle
(
"Load Parameters"
);
...
...
@@ -112,8 +114,12 @@ void ParameterEditorController::loadFromFile(void)
}
QTextStream
stream
(
&
file
);
_autopilot
->
readParametersFromStream
(
stream
);
errors
=
_autopilot
->
readParametersFromStream
(
stream
);
file
.
close
();
if
(
!
errors
.
isEmpty
())
{
emit
showErrorMessage
(
errors
);
}
}
}
...
...
src/QmlControls/ParameterEditorController.h
View file @
9b68c43f
...
...
@@ -55,6 +55,9 @@ public:
QList
<
QObject
*>
model
(
void
);
signals:
void
showErrorMessage
(
const
QString
&
errorMsg
);
private:
QStringList
_componentIds
;
};
...
...
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