Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
7bb04324
Commit
7bb04324
authored
Apr 13, 2016
by
Don Gagne
Browse files
New RCChannelMonitorControl
parent
4776d22d
Changes
9
Hide whitespace changes
Inline
Side-by-side
qgroundcontrol.pro
View file @
7bb04324
...
...
@@ -295,6 +295,7 @@ HEADERS += \
src
/
QmlControls
/
CoordinateVector
.
h
\
src
/
QmlControls
/
MavlinkQmlSingleton
.
h
\
src
/
QmlControls
/
ParameterEditorController
.
h
\
src
/
QmlControls
/
RCChannelMonitorController
.
h
\
src
/
QmlControls
/
ScreenToolsController
.
h
\
src
/
QmlControls
/
QGCQGeoCoordinate
.
h
\
src
/
QmlControls
/
QGroundControlQmlGlobal
.
h
\
...
...
@@ -438,6 +439,7 @@ SOURCES += \
src
/
QmlControls
/
AppMessages
.
cc
\
src
/
QmlControls
/
CoordinateVector
.
cc
\
src
/
QmlControls
/
ParameterEditorController
.
cc
\
src
/
QmlControls
/
RCChannelMonitorController
.
cc
\
src
/
QmlControls
/
ScreenToolsController
.
cc
\
src
/
QmlControls
/
QGCQGeoCoordinate
.
cc
\
src
/
QmlControls
/
QGroundControlQmlGlobal
.
cc
\
...
...
qgroundcontrol.qrc
View file @
7bb04324
...
...
@@ -61,6 +61,7 @@
<file alias="QGroundControl/Controls/ModeSwitchDisplay.qml">src/QmlControls/ModeSwitchDisplay.qml</file>
<file alias="QGroundControl/Controls/ParameterEditor.qml">src/QmlControls/ParameterEditor.qml</file>
<file alias="QGroundControl/Controls/ParameterEditorDialog.qml">src/QmlControls/ParameterEditorDialog.qml</file>
<file alias="QGroundControl/Controls/RCChannelMonitor.qml">src/QmlControls/RCChannelMonitor.qml</file>
<file alias="QGroundControl/Controls/QGCButton.qml">src/QmlControls/QGCButton.qml</file>
<file alias="QGroundControl/Controls/QGCCheckBox.qml">src/QmlControls/QGCCheckBox.qml</file>
<file alias="QGroundControl/Controls/QGCColoredImage.qml">src/QmlControls/QGCColoredImage.qml</file>
...
...
src/AutoPilotPlugins/Common/RadioComponent.qml
View file @
7bb04324
...
...
@@ -532,53 +532,9 @@ QGCView {
source
:
controller
.
imageHelp
}
// Channel monitor
Column
{
RCChannelMonitor
{
width
:
parent
.
width
spacing
:
5
QGCLabel
{
text
:
qsTr
(
"
Channel Monitor
"
)
}
Connections
{
target
:
controller
onChannelRCValueChanged
:
{
if
(
channelMonitorRepeater
.
itemAt
(
channel
))
{
channelMonitorRepeater
.
itemAt
(
channel
).
loader
.
item
.
rcValue
=
rcValue
}
}
}
Repeater
{
id
:
channelMonitorRepeater
model
:
controller
.
channelCount
width
:
parent
.
width
Row
{
spacing
:
5
// Need this to get to loader from Connections above
property
Item
loader
:
theLoader
QGCLabel
{
id
:
channelLabel
text
:
modelData
+
1
}
Loader
{
id
:
theLoader
anchors.verticalCenter
:
channelLabel
.
verticalCenter
height
:
qgcView
.
defaultTextHeight
width
:
200
sourceComponent
:
channelMonitorDisplayComponent
property
real
defaultTextWidth
:
qgcView
.
defaultTextWidth
property
bool
mapped
:
true
readonly
property
bool
reversed
:
false
}
}
}
}
// Column - Channel Monitor
}
}
// Column - Right Column
}
// QGCFlickable
}
// QGCViewPanel
...
...
src/AutoPilotPlugins/PX4/PX4SimpleFlightModes.qml
View file @
7bb04324
...
...
@@ -53,11 +53,11 @@ Item {
QGCFlickable
{
anchors.fill
:
parent
clip
:
true
contentWidth
:
co
ntentC
olumn
.
width
contentHeight
:
contentC
olumn
.
height
contentWidth
:
co
lumn2
.
x
+
c
olumn
2
.
width
contentHeight
:
Math
.
max
(
column1
.
height
,
c
olumn
2
.
height
)
Column
{
id
:
co
ntentCo
lumn
id
:
column
1
spacing
:
_margins
Row
{
...
...
@@ -131,7 +131,8 @@ Item {
}
// Column - Flight mode settings
Column
{
spacing
:
_margins
id
:
column2
spacing
:
_margins
QGCLabel
{
text
:
qsTr
(
"
Switch Settings
"
)
...
...
@@ -139,6 +140,7 @@ Item {
}
Rectangle
{
id
:
switchSettingsRect
width
:
switchSettingsColumn
.
width
+
(
_margins
*
2
)
height
:
switchSettingsColumn
.
height
+
ScreenTools
.
defaultFontPixelHeight
color
:
qgcPal
.
windowShade
...
...
@@ -174,6 +176,10 @@ Item {
}
// Repeater
}
// Column
}
// Rectangle
RCChannelMonitor
{
width
:
switchSettingsRect
.
width
}
}
// Column - Switch settings
}
// Row - Settings
...
...
src/QGCApplication.cc
View file @
7bb04324
...
...
@@ -73,6 +73,7 @@
#include
"ESP8266ComponentController.h"
#include
"ScreenToolsController.h"
#include
"QGCMobileFileDialogController.h"
#include
"RCChannelMonitorController.h"
#include
"AutoPilotPlugin.h"
#include
"VehicleComponent.h"
#include
"FirmwarePluginManager.h"
...
...
@@ -457,6 +458,7 @@ void QGCApplication::_initCommon(void)
qmlRegisterType
<
FlightDisplayViewController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"FlightDisplayViewController"
);
qmlRegisterType
<
ValuesWidgetController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"ValuesWidgetController"
);
qmlRegisterType
<
QGCMobileFileDialogController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"QGCMobileFileDialogController"
);
qmlRegisterType
<
RCChannelMonitorController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"RCChannelMonitorController"
);
#ifndef __mobile__
qmlRegisterType
<
ViewWidgetController
>
(
"QGroundControl.Controllers"
,
1
,
0
,
"ViewWidgetController"
);
...
...
src/QmlControls/QGroundControl.Controls.qmldir
View file @
7bb04324
...
...
@@ -15,6 +15,7 @@ MissionItemStatus 1.0 MissionItemStatus.qml
ModeSwitchDisplay 1.0 ModeSwitchDisplay.qml
ParameterEditor 1.0 ParameterEditor.qml
ParameterEditorDialog 1.0 ParameterEditorDialog.qml
RCChannelMonitor 1.0 RCChannelMonitor.qml
QGCButton 1.0 QGCButton.qml
QGCCheckBox 1.0 QGCCheckBox.qml
QGCColoredImage 1.0 QGCColoredImage.qml
...
...
src/QmlControls/RCChannelMonitor.qml
0 → 100644
View file @
7bb04324
/*=====================================================================
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/>.
======================================================================*/
import
QtQuick
2.5
import
QtQuick
.
Controls
1.2
import
QtQuick
.
Dialogs
1.2
import
QGroundControl
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
FactControls
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Controllers
1.0
FactPanel
{
id
:
_root
height
:
monitorColumn
.
height
QGCPalette
{
id
:
qgcPal
;
colorGroupEnabled
:
panel
.
enabled
}
RCChannelMonitorController
{
id
:
controller
factPanel
:
_root
}
// Live channel monitor control component
Component
{
id
:
channelMonitorDisplayComponent
Item
{
property
int
rcValue
:
1500
property
int
__lastRcValue
:
1500
readonly
property
int
__rcValueMaxJitter
:
2
property
color
__barColor
:
qgcPal
.
windowShade
// Bar
Rectangle
{
id
:
bar
anchors.verticalCenter
:
parent
.
verticalCenter
width
:
parent
.
width
height
:
parent
.
height
/
2
color
:
__barColor
}
// Center point
Rectangle
{
anchors.horizontalCenter
:
parent
.
horizontalCenter
width
:
ScreenTools
.
defaultTextWidth
/
2
height
:
parent
.
height
color
:
qgcPal
.
window
}
// Indicator
Rectangle
{
anchors.verticalCenter
:
parent
.
verticalCenter
width
:
parent
.
height
*
0.75
height
:
width
x
:
((
Math
.
abs
((
rcValue
-
1000
)
-
(
reversed
?
1000
:
0
))
/
1000
)
*
parent
.
width
)
-
(
width
/
2
)
radius
:
width
/
2
color
:
qgcPal
.
text
visible
:
mapped
}
QGCLabel
{
anchors.fill
:
parent
horizontalAlignment
:
Text
.
AlignHCenter
verticalAlignment
:
Text
.
AlignVCenter
text
:
"
Not Mapped
"
visible
:
!
mapped
}
ColorAnimation
{
id
:
barAnimation
target
:
bar
property
:
"
color
"
from
:
"
yellow
"
to
:
__barColor
duration
:
1500
}
}
}
// Component - channelMonitorDisplayComponent
Column
{
id
:
monitorColumn
width
:
parent
.
width
spacing
:
5
QGCLabel
{
text
:
"
Channel Monitor
"
}
Connections
{
target
:
controller
onChannelRCValueChanged
:
{
if
(
channelMonitorRepeater
.
itemAt
(
channel
))
{
channelMonitorRepeater
.
itemAt
(
channel
).
loader
.
item
.
rcValue
=
rcValue
}
}
}
Repeater
{
id
:
channelMonitorRepeater
model
:
controller
.
channelCount
width
:
parent
.
width
Row
{
spacing
:
5
// Need this to get to loader from Connections above
property
Item
loader
:
theLoader
QGCLabel
{
id
:
channelLabel
text
:
modelData
+
1
}
Loader
{
id
:
theLoader
anchors.verticalCenter
:
channelLabel
.
verticalCenter
height
:
qgcView
.
defaultTextHeight
width
:
200
sourceComponent
:
channelMonitorDisplayComponent
property
bool
mapped
:
true
readonly
property
bool
reversed
:
false
}
}
}
}
}
src/QmlControls/RCChannelMonitorController.cc
0 → 100644
View file @
7bb04324
/*=====================================================================
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
"RCChannelMonitorController.h"
RCChannelMonitorController
::
RCChannelMonitorController
(
void
)
:
_chanCount
(
0
)
{
connect
(
_vehicle
,
&
Vehicle
::
rcChannelsChanged
,
this
,
&
RCChannelMonitorController
::
_rcChannelsChanged
);
}
void
RCChannelMonitorController
::
_rcChannelsChanged
(
int
channelCount
,
int
pwmValues
[
Vehicle
::
cMaxRcChannels
])
{
int
maxChannel
=
std
::
min
(
channelCount
,
_chanMax
());
for
(
int
channel
=
0
;
channel
<
maxChannel
;
channel
++
)
{
int
channelValue
=
pwmValues
[
channel
];
if
(
_chanCount
!=
channelCount
)
{
_chanCount
=
channelCount
;
emit
channelCountChanged
(
_chanCount
);
}
if
(
channelValue
!=
-
1
)
{
emit
channelRCValueChanged
(
channel
,
channelValue
);
}
}
}
int
RCChannelMonitorController
::
_chanMax
(
void
)
const
{
return
_vehicle
->
firmwareType
()
==
MAV_AUTOPILOT_PX4
?
_chanMaxPX4
:
_chanMaxAPM
;
}
src/QmlControls/RCChannelMonitorController.h
0 → 100644
View file @
7bb04324
/*=====================================================================
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/>.
======================================================================*/
#ifndef RCChannelMonitorController_H
#define RCChannelMonitorController_H
#include
<QTimer>
#include
"FactPanelController.h"
#include
"UASInterface.h"
#include
"QGCLoggingCategory.h"
#include
"AutoPilotPlugin.h"
class
RCChannelMonitorController
:
public
FactPanelController
{
Q_OBJECT
public:
RCChannelMonitorController
(
void
);
Q_PROPERTY
(
int
channelCount
READ
channelCount
NOTIFY
channelCountChanged
)
int
channelCount
(
void
)
{
return
_chanCount
;
}
signals:
void
channelCountChanged
(
int
channelCount
);
void
channelRCValueChanged
(
int
channel
,
int
rcValue
);
private
slots
:
void
_rcChannelsChanged
(
int
channelCount
,
int
pwmValues
[
Vehicle
::
cMaxRcChannels
]);
private:
int
_chanMax
(
void
)
const
;
int
_chanCount
;
static
const
int
_chanMaxPX4
=
18
;
///< Maximum number of supported rc channels, PX4 Firmware
static
const
int
_chanMaxAPM
=
14
;
///< Maximum number of supported rc channels, APM firmware
};
#endif // RCChannelMonitorController_H
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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