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
15d62614
Commit
15d62614
authored
Feb 23, 2017
by
Jacob Walser
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add lights brightness steps to APMLightsComponent page
parent
c62e1fbb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
6 deletions
+48
-6
APMLightsComponent.qml
src/AutoPilotPlugins/APM/APMLightsComponent.qml
+48
-6
No files found.
src/AutoPilotPlugins/APM/APMLightsComponent.qml
View file @
15d62614
...
...
@@ -42,6 +42,7 @@ SetupPage {
property
Fact
_rc12Function
:
controller
.
getParameterFact
(
-
1
,
"
r.SERVO12_FUNCTION
"
)
property
Fact
_rc13Function
:
controller
.
getParameterFact
(
-
1
,
"
r.SERVO13_FUNCTION
"
)
property
Fact
_rc14Function
:
controller
.
getParameterFact
(
-
1
,
"
r.SERVO14_FUNCTION
"
)
property
Fact
_stepSize
:
controller
.
getParameterFact
(
-
1
,
"
JS_LIGHTS_STEP
"
)
readonly
property
real
_margins
:
ScreenTools
.
defaultFontPixelHeight
readonly
property
int
_rcFunctionDisabled
:
0
...
...
@@ -52,6 +53,7 @@ SetupPage {
Component.onCompleted
:
{
calcLightOutValues
()
calcCurrentStep
()
}
/// Light output channels are stored in SERVO#_FUNCTION parameters. We need to loop through those
...
...
@@ -85,6 +87,25 @@ SetupPage {
}
}
function
calcCurrentStep
()
{
var
i
=
1
for
(
i
;
i
<=
10
;
i
++
)
{
var
stepSize
=
(
1900
-
1100
)
/
i
if
(
_stepSize
.
value
>=
stepSize
)
{
_stepSize
.
value
=
stepSize
;
break
;
}
}
if
(
_stepSize
.
value
<
80
)
{
_stepSize
.
value
=
80
;
}
lightsLoader
.
lightsSteps
=
i
}
function
calcStepSize
(
steps
)
{
_stepSize
.
value
=
(
1900
-
1100
)
/
steps
}
// Whenever any SERVO#_FUNCTION parameters chagnes we need to go looking for light output channels again
Connections
{
target
:
_rc5Function
;
onValueChanged
:
calcLightOutValues
()
}
Connections
{
target
:
_rc6Function
;
onValueChanged
:
calcLightOutValues
()
}
...
...
@@ -129,14 +150,14 @@ SetupPage {
id
:
rectangle
anchors.topMargin
:
_margins
/
2
anchors.top
:
settingsLabel
.
bottom
width
:
lights1Combo
.
x
+
lights1Combo
.
width
+
_margins
height
:
lights2Combo
.
y
+
lights2Combo
.
height
+
_margins
width
:
lights1Combo
.
x
+
lights1Combo
.
width
+
lightsStepCombo
.
width
+
_margins
height
:
lights2Combo
.
y
+
lights2Combo
.
height
+
lightsStepCombo
.
height
+
2
*
_margins
color
:
palette
.
windowShade
QGCLabel
{
id
:
lights1Label
anchors.margins
:
_margins
anchors.
left
:
parent
.
left
anchors.
right
:
lights1Combo
.
left
anchors.baseline
:
lights1Combo
.
baseline
text
:
qsTr
(
"
Lights 1:
"
)
}
...
...
@@ -145,7 +166,7 @@ SetupPage {
id
:
lights1Combo
anchors.margins
:
_margins
anchors.top
:
parent
.
top
anchors.left
:
lights
1
Label
.
right
anchors.left
:
lights
Step
Label
.
right
width
:
ScreenTools
.
defaultFontPixelWidth
*
15
model
:
lightsOutModel
currentIndex
:
lights1OutIndex
...
...
@@ -156,7 +177,7 @@ SetupPage {
QGCLabel
{
id
:
lights2Label
anchors.margins
:
_margins
anchors.
left
:
parent
.
left
anchors.
right
:
lights2Combo
.
left
anchors.baseline
:
lights2Combo
.
baseline
text
:
qsTr
(
"
Lights 2:
"
)
}
...
...
@@ -165,13 +186,33 @@ SetupPage {
id
:
lights2Combo
anchors.margins
:
_margins
anchors.top
:
lights1Combo
.
bottom
anchors.left
:
lights
2
Label
.
right
anchors.left
:
lights
Step
Label
.
right
width
:
lights1Combo
.
width
model
:
lightsOutModel
currentIndex
:
lights2OutIndex
onActivated
:
setRCFunction
(
lightsOutModel
.
get
(
index
).
value
,
lights2Function
)
}
QGCLabel
{
id
:
lightsStepLabel
anchors.margins
:
_margins
anchors.left
:
parent
.
left
anchors.baseline
:
lightsStepCombo
.
baseline
text
:
qsTr
(
"
Brightness Steps:
"
)
}
QGCComboBox
{
id
:
lightsStepCombo
anchors.margins
:
_margins
anchors.top
:
lights2Combo
.
bottom
anchors.left
:
lightsStepLabel
.
right
width
:
lights2Combo
.
width
model
:
[
1
,
2
,
3
,
4
,
5
,
6
,
7
,
8
,
9
,
10
]
currentIndex
:
lightsSteps
-
1
onActivated
:
calcStepSize
(
index
+
1
)
}
}
// Rectangle
}
// Item
}
// Component - lightSettings
...
...
@@ -184,6 +225,7 @@ SetupPage {
property
int
lights2OutIndex
:
0
property
int
lights1Function
:
_rcFunctionRCIN9
property
int
lights2Function
:
_rcFunctionRCIN10
property
int
lightsSteps
:
1
}
}
// Column
}
// Component
...
...
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