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
e445ccf1
Unverified
Commit
e445ccf1
authored
Feb 05, 2018
by
Don Gagne
Committed by
GitHub
Feb 05, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6108 from nanthony21/clickableDeadzone
Clickable deadzone
parents
51faca98
5e8c5f2c
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
57 additions
and
8 deletions
+57
-8
JoystickConfig.qml
src/VehicleSetup/JoystickConfig.qml
+45
-3
JoystickConfigController.cc
src/VehicleSetup/JoystickConfigController.cc
+11
-3
JoystickConfigController.h
src/VehicleSetup/JoystickConfigController.h
+1
-2
No files found.
src/VehicleSetup/JoystickConfig.qml
View file @
e445ccf1
...
...
@@ -85,6 +85,8 @@ SetupPage {
Item
{
property
int
axisValue
:
0
property
int
deadbandValue
:
0
property
bool
narrowIndicator
:
false
property
color
deadbandColor
:
"
#8c161a
"
property
color
__barColor
:
qgcPal
.
windowShade
...
...
@@ -104,7 +106,7 @@ SetupPage {
x
:
_deadbandPosition
width
:
_deadbandWidth
height
:
parent
.
height
/
2
color
:
"
#8c161a
"
color
:
deadbandColor
visible
:
controller
.
deadbandToggle
property
real
_percentDeadband
:
((
2
*
deadbandValue
)
/
(
32768.0
*
2
))
...
...
@@ -123,8 +125,8 @@ SetupPage {
// Indicator
Rectangle
{
anchors.verticalCenter
:
parent
.
verticalCenter
width
:
parent
.
height
*
0.75
height
:
width
width
:
parent
.
narrowIndicator
?
height
/
6
:
height
height
:
parent
.
height
*
0.75
x
:
(
reversed
?
(
parent
.
width
-
_indicatorPosition
)
:
_indicatorPosition
)
-
(
width
/
2
)
radius
:
width
/
2
color
:
qgcPal
.
text
...
...
@@ -535,6 +537,21 @@ SetupPage {
onClicked
:
controller
.
deadbandToggle
=
checked
}
}
Row
{
width
:
parent
.
width
spacing
:
ScreenTools
.
defaultFontPixelWidth
visible
:
advancedSettings
.
checked
QGCLabel
{
width
:
parent
.
width
*
0.85
font.pointSize
:
ScreenTools
.
smallFontPointSize
wrapMode
:
Text
.
WordWrap
text
:
qsTr
(
"
Deadband can be set during the first
"
)
+
qsTr
(
"
step of calibration by gently wiggling each axis.
"
)
+
qsTr
(
"
Deadband can also be adjusted by clicking and
"
)
+
qsTr
(
"
dragging vertically on the corresponding axis monitor.
"
)
visible
:
controller
.
deadbandToggle
}
}
}
}
// Column - left column
...
...
@@ -790,11 +807,36 @@ SetupPage {
height
:
ScreenTools
.
defaultFontPixelHeight
width
:
200
sourceComponent
:
axisMonitorDisplayComponent
Component.onCompleted
:
item
.
narrowIndicator
=
true
property
real
defaultTextWidth
:
ScreenTools
.
defaultFontPixelWidth
property
bool
mapped
:
true
readonly
property
bool
reversed
:
false
MouseArea
{
id
:
deadbandMouseArea
anchors.fill
:
parent
.
item
enabled
:
controller
.
deadbandToggle
property
real
startY
onPressed
:
{
startY
=
mouseY
parent
.
item
.
deadbandColor
=
"
#3C6315
"
}
onPositionChanged
:
{
var
newValue
=
parent
.
item
.
deadbandValue
+
(
startY
-
mouseY
)
*
15
if
((
newValue
>
0
)
&&
(
newValue
<
32768
)){
parent
.
item
.
deadbandValue
=
newValue
;}
startY
=
mouseY
}
onReleased
:
{
controller
.
setDeadbandValue
(
modelData
,
parent
.
item
.
deadbandValue
)
parent
.
item
.
deadbandColor
=
"
#8c161a
"
}
}
}
}
}
}
// Column - Axis Monitor
...
...
src/VehicleSetup/JoystickConfigController.cc
View file @
e445ccf1
...
...
@@ -16,7 +16,6 @@
QGC_LOGGING_CATEGORY
(
JoystickConfigControllerLog
,
"JoystickConfigControllerLog"
)
const
int
JoystickConfigController
::
_updateInterval
=
150
;
///< Interval for timer which updates radio channel widgets
const
int
JoystickConfigController
::
_calCenterPoint
=
0
;
const
int
JoystickConfigController
::
_calValidMinValue
=
-
32768
;
///< Largest valid minimum axis value
const
int
JoystickConfigController
::
_calValidMaxValue
=
32767
;
///< Smallest valid maximum axis value
...
...
@@ -71,6 +70,15 @@ void JoystickConfigController::start(void)
_stopCalibration
();
}
void
JoystickConfigController
::
setDeadbandValue
(
int
axis
,
int
value
)
{
_axisDeadbandChanged
(
axis
,
value
);
Joystick
*
joystick
=
_joystickManager
->
activeJoystick
();
Joystick
::
Calibration_t
calibration
=
joystick
->
getCalibration
(
axis
);
calibration
.
deadband
=
value
;
joystick
->
setCalibration
(
axis
,
calibration
);
}
JoystickConfigController
::~
JoystickConfigController
()
{
if
(
_activeJoystick
)
{
...
...
@@ -407,8 +415,8 @@ void JoystickConfigController::_inputCenterWait(Joystick::AxisFunction_t functio
if
(
_stickDetectAxis
==
_axisNoAxis
)
{
// Sticks have not yet moved close enough to center
if
(
abs
(
_calCenterPoint
-
value
)
<
_calRoughCenterDelta
)
{
int
roughCenter
=
getDeadbandToggle
()
?
std
::
max
(
_rgAxisInfo
[
axis
].
deadband
,
_calRoughCenterDelta
)
:
_calRoughCenterDelta
;
if
(
abs
(
_calCenterPoint
-
value
)
<
roughCenter
)
{
// Stick has moved close enough to center that we can start waiting for it to settle
_stickDetectAxis
=
axis
;
_stickDetectInitialValue
=
value
;
...
...
src/VehicleSetup/JoystickConfigController.h
View file @
e445ccf1
...
...
@@ -67,6 +67,7 @@ public:
Q_INVOKABLE
void
skipButtonClicked
(
void
);
Q_INVOKABLE
void
nextButtonClicked
(
void
);
Q_INVOKABLE
void
start
(
void
);
Q_INVOKABLE
void
setDeadbandValue
(
int
axis
,
int
value
);
bool
rollAxisMapped
(
void
);
bool
pitchAxisMapped
(
void
);
...
...
@@ -207,8 +208,6 @@ private:
static
const
char
*
_imagePitchUp
;
static
const
char
*
_imagePitchDown
;
static
const
int
_updateInterval
;
///< Interval for ui update timer
int
_rgFunctionAxisMapping
[
Joystick
::
maxFunction
];
///< Maps from joystick function to axis index. _axisMax indicates axis not set for this function.
static
const
int
_attitudeControls
=
5
;
...
...
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