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
7 years ago
by
Don Gagne
Committed by
GitHub
7 years ago
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 {
...
@@ -85,6 +85,8 @@ SetupPage {
Item
{
Item
{
property
int
axisValue
:
0
property
int
axisValue
:
0
property
int
deadbandValue
:
0
property
int
deadbandValue
:
0
property
bool
narrowIndicator
:
false
property
color
deadbandColor
:
"
#8c161a
"
property
color
__barColor
:
qgcPal
.
windowShade
property
color
__barColor
:
qgcPal
.
windowShade
...
@@ -104,7 +106,7 @@ SetupPage {
...
@@ -104,7 +106,7 @@ SetupPage {
x
:
_deadbandPosition
x
:
_deadbandPosition
width
:
_deadbandWidth
width
:
_deadbandWidth
height
:
parent
.
height
/
2
height
:
parent
.
height
/
2
color
:
"
#8c161a
"
color
:
deadbandColor
visible
:
controller
.
deadbandToggle
visible
:
controller
.
deadbandToggle
property
real
_percentDeadband
:
((
2
*
deadbandValue
)
/
(
32768.0
*
2
))
property
real
_percentDeadband
:
((
2
*
deadbandValue
)
/
(
32768.0
*
2
))
...
@@ -123,8 +125,8 @@ SetupPage {
...
@@ -123,8 +125,8 @@ SetupPage {
// Indicator
// Indicator
Rectangle
{
Rectangle
{
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
width
:
parent
.
height
*
0.75
width
:
parent
.
narrowIndicator
?
height
/
6
:
height
height
:
width
height
:
parent
.
height
*
0.75
x
:
(
reversed
?
(
parent
.
width
-
_indicatorPosition
)
:
_indicatorPosition
)
-
(
width
/
2
)
x
:
(
reversed
?
(
parent
.
width
-
_indicatorPosition
)
:
_indicatorPosition
)
-
(
width
/
2
)
radius
:
width
/
2
radius
:
width
/
2
color
:
qgcPal
.
text
color
:
qgcPal
.
text
...
@@ -535,6 +537,21 @@ SetupPage {
...
@@ -535,6 +537,21 @@ SetupPage {
onClicked
:
controller
.
deadbandToggle
=
checked
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
}
// Column - left column
...
@@ -790,11 +807,36 @@ SetupPage {
...
@@ -790,11 +807,36 @@ SetupPage {
height
:
ScreenTools
.
defaultFontPixelHeight
height
:
ScreenTools
.
defaultFontPixelHeight
width
:
200
width
:
200
sourceComponent
:
axisMonitorDisplayComponent
sourceComponent
:
axisMonitorDisplayComponent
Component.onCompleted
:
item
.
narrowIndicator
=
true
property
real
defaultTextWidth
:
ScreenTools
.
defaultFontPixelWidth
property
real
defaultTextWidth
:
ScreenTools
.
defaultFontPixelWidth
property
bool
mapped
:
true
property
bool
mapped
:
true
readonly
property
bool
reversed
:
false
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
}
// Column - Axis Monitor
...
...
This diff is collapsed.
Click to expand it.
src/VehicleSetup/JoystickConfigController.cc
View file @
e445ccf1
...
@@ -16,7 +16,6 @@
...
@@ -16,7 +16,6 @@
QGC_LOGGING_CATEGORY
(
JoystickConfigControllerLog
,
"JoystickConfigControllerLog"
)
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
::
_calCenterPoint
=
0
;
const
int
JoystickConfigController
::
_calValidMinValue
=
-
32768
;
///< Largest valid minimum axis value
const
int
JoystickConfigController
::
_calValidMinValue
=
-
32768
;
///< Largest valid minimum axis value
const
int
JoystickConfigController
::
_calValidMaxValue
=
32767
;
///< Smallest valid maximum axis value
const
int
JoystickConfigController
::
_calValidMaxValue
=
32767
;
///< Smallest valid maximum axis value
...
@@ -71,6 +70,15 @@ void JoystickConfigController::start(void)
...
@@ -71,6 +70,15 @@ void JoystickConfigController::start(void)
_stopCalibration
();
_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
()
JoystickConfigController
::~
JoystickConfigController
()
{
{
if
(
_activeJoystick
)
{
if
(
_activeJoystick
)
{
...
@@ -407,8 +415,8 @@ void JoystickConfigController::_inputCenterWait(Joystick::AxisFunction_t functio
...
@@ -407,8 +415,8 @@ void JoystickConfigController::_inputCenterWait(Joystick::AxisFunction_t functio
if
(
_stickDetectAxis
==
_axisNoAxis
)
{
if
(
_stickDetectAxis
==
_axisNoAxis
)
{
// Sticks have not yet moved close enough to center
// Sticks have not yet moved close enough to center
int
roughCenter
=
getDeadbandToggle
()
?
std
::
max
(
_rgAxisInfo
[
axis
].
deadband
,
_calRoughCenterDelta
)
:
_calRoughCenterDelta
;
if
(
abs
(
_calCenterPoint
-
value
)
<
_calRoughCenterDelta
)
{
if
(
abs
(
_calCenterPoint
-
value
)
<
roughCenter
)
{
// Stick has moved close enough to center that we can start waiting for it to settle
// Stick has moved close enough to center that we can start waiting for it to settle
_stickDetectAxis
=
axis
;
_stickDetectAxis
=
axis
;
_stickDetectInitialValue
=
value
;
_stickDetectInitialValue
=
value
;
...
...
This diff is collapsed.
Click to expand it.
src/VehicleSetup/JoystickConfigController.h
View file @
e445ccf1
...
@@ -67,6 +67,7 @@ public:
...
@@ -67,6 +67,7 @@ public:
Q_INVOKABLE
void
skipButtonClicked
(
void
);
Q_INVOKABLE
void
skipButtonClicked
(
void
);
Q_INVOKABLE
void
nextButtonClicked
(
void
);
Q_INVOKABLE
void
nextButtonClicked
(
void
);
Q_INVOKABLE
void
start
(
void
);
Q_INVOKABLE
void
start
(
void
);
Q_INVOKABLE
void
setDeadbandValue
(
int
axis
,
int
value
);
bool
rollAxisMapped
(
void
);
bool
rollAxisMapped
(
void
);
bool
pitchAxisMapped
(
void
);
bool
pitchAxisMapped
(
void
);
...
@@ -207,8 +208,6 @@ private:
...
@@ -207,8 +208,6 @@ private:
static
const
char
*
_imagePitchUp
;
static
const
char
*
_imagePitchUp
;
static
const
char
*
_imagePitchDown
;
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.
int
_rgFunctionAxisMapping
[
Joystick
::
maxFunction
];
///< Maps from joystick function to axis index. _axisMax indicates axis not set for this function.
static
const
int
_attitudeControls
=
5
;
static
const
int
_attitudeControls
=
5
;
...
...
This diff is collapsed.
Click to expand it.
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