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
9dcfac3d
Commit
9dcfac3d
authored
Mar 05, 2016
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support increment meta data
parent
2fd104fa
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
46 additions
and
3 deletions
+46
-3
Fact.cc
src/FactSystem/Fact.cc
+10
-0
Fact.h
src/FactSystem/Fact.h
+4
-2
FactMetaData.cc
src/FactSystem/FactMetaData.cc
+3
-0
FactMetaData.h
src/FactSystem/FactMetaData.h
+6
-0
APMParameterMetaData.cc
src/FirmwarePlugin/APM/APMParameterMetaData.cc
+11
-0
PX4ParameterMetaData.cc
src/FirmwarePlugin/PX4/PX4ParameterMetaData.cc
+11
-0
FactSliderPanel.qml
src/QmlControls/FactSliderPanel.qml
+1
-1
No files found.
src/FactSystem/Fact.cc
View file @
9dcfac3d
...
@@ -552,3 +552,13 @@ QString Fact::enumOrValueString(void)
...
@@ -552,3 +552,13 @@ QString Fact::enumOrValueString(void)
}
}
return
QString
();
return
QString
();
}
}
double
Fact
::
increment
(
void
)
const
{
if
(
_metaData
)
{
return
_metaData
->
increment
();
}
else
{
qWarning
()
<<
"Meta data pointer missing"
;
}
return
std
::
numeric_limits
<
double
>::
quiet_NaN
();
}
src/FactSystem/Fact.h
View file @
9dcfac3d
...
@@ -74,6 +74,7 @@ public:
...
@@ -74,6 +74,7 @@ public:
Q_PROPERTY
(
bool
valueEqualsDefault
READ
valueEqualsDefault
NOTIFY
valueChanged
)
Q_PROPERTY
(
bool
valueEqualsDefault
READ
valueEqualsDefault
NOTIFY
valueChanged
)
Q_PROPERTY
(
QString
valueString
READ
cookedValueString
NOTIFY
valueChanged
)
Q_PROPERTY
(
QString
valueString
READ
cookedValueString
NOTIFY
valueChanged
)
Q_PROPERTY
(
QString
enumOrValueString
READ
enumOrValueString
NOTIFY
valueChanged
)
Q_PROPERTY
(
QString
enumOrValueString
READ
enumOrValueString
NOTIFY
valueChanged
)
Q_PROPERTY
(
double
increment
READ
increment
CONSTANT
)
/// Convert and validate value
/// Convert and validate value
/// @param convertOnly true: validate type conversion only, false: validate against meta data as well
/// @param convertOnly true: validate type conversion only, false: validate against meta data as well
...
@@ -87,8 +88,8 @@ public:
...
@@ -87,8 +88,8 @@ public:
QVariant
cookedDefaultValue
(
void
)
const
;
QVariant
cookedDefaultValue
(
void
)
const
;
bool
defaultValueAvailable
(
void
)
const
;
bool
defaultValueAvailable
(
void
)
const
;
QString
cookedDefaultValueString
(
void
)
const
;
QString
cookedDefaultValueString
(
void
)
const
;
QStringList
bitmaskStrings
(
void
)
const
;
QStringList
bitmaskStrings
(
void
)
const
;
QVariantList
bitmaskValues
(
void
)
const
;
QVariantList
bitmaskValues
(
void
)
const
;
int
enumIndex
(
void
);
// This is not const, since an unknown value can modify the enum lists
int
enumIndex
(
void
);
// This is not const, since an unknown value can modify the enum lists
QStringList
enumStrings
(
void
)
const
;
QStringList
enumStrings
(
void
)
const
;
QString
enumStringValue
(
void
);
// This is not const, since an unknown value can modify the enum lists
QString
enumStringValue
(
void
);
// This is not const, since an unknown value can modify the enum lists
...
@@ -113,6 +114,7 @@ public:
...
@@ -113,6 +114,7 @@ public:
bool
valueEqualsDefault
(
void
)
const
;
bool
valueEqualsDefault
(
void
)
const
;
bool
rebootRequired
(
void
)
const
;
bool
rebootRequired
(
void
)
const
;
QString
enumOrValueString
(
void
);
// This is not const, since an unknown value can modify the enum lists
QString
enumOrValueString
(
void
);
// This is not const, since an unknown value can modify the enum lists
double
increment
(
void
)
const
;
void
setRawValue
(
const
QVariant
&
value
);
void
setRawValue
(
const
QVariant
&
value
);
void
setCookedValue
(
const
QVariant
&
value
);
void
setCookedValue
(
const
QVariant
&
value
);
...
...
src/FactSystem/FactMetaData.cc
View file @
9dcfac3d
...
@@ -52,6 +52,7 @@ FactMetaData::FactMetaData(QObject* parent)
...
@@ -52,6 +52,7 @@ FactMetaData::FactMetaData(QObject* parent)
,
_rawTranslator
(
_defaultTranslator
)
,
_rawTranslator
(
_defaultTranslator
)
,
_cookedTranslator
(
_defaultTranslator
)
,
_cookedTranslator
(
_defaultTranslator
)
,
_rebootRequired
(
false
)
,
_rebootRequired
(
false
)
,
_increment
(
std
::
numeric_limits
<
double
>::
quiet_NaN
())
{
{
}
}
...
@@ -70,6 +71,7 @@ FactMetaData::FactMetaData(ValueType_t type, QObject* parent)
...
@@ -70,6 +71,7 @@ FactMetaData::FactMetaData(ValueType_t type, QObject* parent)
,
_rawTranslator
(
_defaultTranslator
)
,
_rawTranslator
(
_defaultTranslator
)
,
_cookedTranslator
(
_defaultTranslator
)
,
_cookedTranslator
(
_defaultTranslator
)
,
_rebootRequired
(
false
)
,
_rebootRequired
(
false
)
,
_increment
(
std
::
numeric_limits
<
double
>::
quiet_NaN
())
{
{
}
}
...
@@ -103,6 +105,7 @@ const FactMetaData& FactMetaData::operator=(const FactMetaData& other)
...
@@ -103,6 +105,7 @@ const FactMetaData& FactMetaData::operator=(const FactMetaData& other)
_rawTranslator
=
other
.
_rawTranslator
;
_rawTranslator
=
other
.
_rawTranslator
;
_cookedTranslator
=
other
.
_cookedTranslator
;
_cookedTranslator
=
other
.
_cookedTranslator
;
_rebootRequired
=
other
.
_rebootRequired
;
_rebootRequired
=
other
.
_rebootRequired
;
_increment
=
other
.
_increment
;
return
*
this
;
return
*
this
;
}
}
...
...
src/FactSystem/FactMetaData.h
View file @
9dcfac3d
...
@@ -83,6 +83,10 @@ public:
...
@@ -83,6 +83,10 @@ public:
QString
cookedUnits
(
void
)
const
{
return
_cookedUnits
;
}
QString
cookedUnits
(
void
)
const
{
return
_cookedUnits
;
}
bool
rebootRequired
(
void
)
const
{
return
_rebootRequired
;
}
bool
rebootRequired
(
void
)
const
{
return
_rebootRequired
;
}
/// Amount to increment value when used in controls such as spin button or slider with detents.
/// NaN for no increment available.
double
increment
(
void
)
const
{
return
_increment
;
}
Translator
rawTranslator
(
void
)
const
{
return
_rawTranslator
;
}
Translator
rawTranslator
(
void
)
const
{
return
_rawTranslator
;
}
Translator
cookedTranslator
(
void
)
const
{
return
_cookedTranslator
;
}
Translator
cookedTranslator
(
void
)
const
{
return
_cookedTranslator
;
}
...
@@ -104,6 +108,7 @@ public:
...
@@ -104,6 +108,7 @@ public:
void
setShortDescription
(
const
QString
&
shortDescription
)
{
_shortDescription
=
shortDescription
;
}
void
setShortDescription
(
const
QString
&
shortDescription
)
{
_shortDescription
=
shortDescription
;
}
void
setRawUnits
(
const
QString
&
rawUnits
);
void
setRawUnits
(
const
QString
&
rawUnits
);
void
setRebootRequired
(
bool
rebootRequired
)
{
_rebootRequired
=
rebootRequired
;
}
void
setRebootRequired
(
bool
rebootRequired
)
{
_rebootRequired
=
rebootRequired
;
}
void
setIncrement
(
double
increment
)
{
_increment
=
increment
;
}
void
setTranslators
(
Translator
rawTranslator
,
Translator
cookedTranslator
);
void
setTranslators
(
Translator
rawTranslator
,
Translator
cookedTranslator
);
...
@@ -156,6 +161,7 @@ private:
...
@@ -156,6 +161,7 @@ private:
Translator
_rawTranslator
;
Translator
_rawTranslator
;
Translator
_cookedTranslator
;
Translator
_cookedTranslator
;
bool
_rebootRequired
;
bool
_rebootRequired
;
double
_increment
;
struct
BuiltInTranslation_s
{
struct
BuiltInTranslation_s
{
const
char
*
rawUnits
;
const
char
*
rawUnits
;
...
...
src/FirmwarePlugin/APM/APMParameterMetaData.cc
View file @
9dcfac3d
...
@@ -580,6 +580,17 @@ void APMParameterMetaData::addMetaDataToFact(Fact* fact, MAV_TYPE vehicleType)
...
@@ -580,6 +580,17 @@ void APMParameterMetaData::addMetaDataToFact(Fact* fact, MAV_TYPE vehicleType)
}
}
}
}
if
(
!
rawMetaData
->
incrementSize
.
isEmpty
())
{
double
increment
;
bool
ok
;
increment
=
rawMetaData
->
incrementSize
.
toDouble
(
&
ok
);
if
(
ok
)
{
metaData
->
setIncrement
(
increment
);
}
else
{
qCDebug
(
APMParameterMetaDataLog
)
<<
"Invalid value for increment, name:"
<<
metaData
->
name
()
<<
" increment:"
<<
rawMetaData
->
incrementSize
;
}
}
// FixMe:: not handling increment size as their is no place for it in FactMetaData and no ui
// FixMe:: not handling increment size as their is no place for it in FactMetaData and no ui
fact
->
setMetaData
(
metaData
);
fact
->
setMetaData
(
metaData
);
}
}
...
...
src/FirmwarePlugin/PX4/PX4ParameterMetaData.cc
View file @
9dcfac3d
...
@@ -306,6 +306,17 @@ void PX4ParameterMetaData::loadParameterFactMetaDataFile(const QString& metaData
...
@@ -306,6 +306,17 @@ void PX4ParameterMetaData::loadParameterFactMetaDataFile(const QString& metaData
<<
" type:"
<<
metaData
->
type
()
<<
" value:"
<<
enumValueStr
<<
" type:"
<<
metaData
->
type
()
<<
" value:"
<<
enumValueStr
<<
" error:"
<<
errorString
;
<<
" error:"
<<
errorString
;
}
}
}
else
if
(
elementName
==
"increment"
)
{
Q_ASSERT
(
metaData
);
double
increment
;
bool
ok
;
QString
text
=
xml
.
readElementText
();
increment
=
text
.
toDouble
(
&
ok
);
if
(
ok
)
{
metaData
->
setIncrement
(
increment
);
}
else
{
qCWarning
(
PX4ParameterMetaDataLog
)
<<
"Invalid value for increment, name:"
<<
metaData
->
name
()
<<
" increment:"
<<
text
;
}
}
else
{
}
else
{
qDebug
()
<<
"Unknown element in XML: "
<<
elementName
;
qDebug
()
<<
"Unknown element in XML: "
<<
elementName
;
}
}
...
...
src/QmlControls/FactSliderPanel.qml
View file @
9dcfac3d
...
@@ -122,7 +122,7 @@ QGCView {
...
@@ -122,7 +122,7 @@ QGCView {
anchors.right
:
parent
.
right
anchors.right
:
parent
.
right
minimumValue
:
min
minimumValue
:
min
maximumValue
:
max
maximumValue
:
max
stepSize
:
step
stepSize
:
isNaN
(
fact
.
increment
)
?
step
:
fact
.
increment
tickmarksEnabled
:
true
tickmarksEnabled
:
true
property
Fact
fact
:
controller
.
getParameterFact
(
-
1
,
param
)
property
Fact
fact
:
controller
.
getParameterFact
(
-
1
,
param
)
...
...
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