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
348091b3
Unverified
Commit
348091b3
authored
Jun 25, 2018
by
Don Gagne
Committed by
GitHub
Jun 25, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6655 from DonLakeFlyer/APMPowerCalc
ArduPilot voltage/amp calculators broken
parents
98565fdb
2080e2f3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
29 deletions
+46
-29
APMPowerComponent.qml
src/AutoPilotPlugins/APM/APMPowerComponent.qml
+29
-10
ParameterEditorDialog.qml
src/QmlControls/ParameterEditorDialog.qml
+2
-3
QGCTextField.qml
src/QmlControls/QGCTextField.qml
+15
-16
No files found.
src/AutoPilotPlugins/APM/APMPowerComponent.qml
View file @
348091b3
...
...
@@ -369,8 +369,14 @@ SetupPage {
QGCButton
{
text
:
qsTr
(
"
Calculate
"
)
onClicked
:
showDialog
(
calcVoltageMultiplierDlgComponent
,
qsTr
(
"
Calculate Voltage Multiplier
"
),
qgcView
.
showDialogDefaultWidth
,
StandardButton
.
Close
)
visible
:
_showAdvanced
onClicked
:
{
_calcVoltageDlgVehicleVoltage
=
vehicleVoltage
_calcVoltageDlgBattVoltMultParam
=
battVoltMult
showDialog
(
calcVoltageMultiplierDlgComponent
,
qsTr
(
"
Calculate Voltage Multiplier
"
),
qgcView
.
showDialogDefaultWidth
,
StandardButton
.
Close
)
}
}
QGCLabel
{
...
...
@@ -395,8 +401,13 @@ SetupPage {
QGCButton
{
text
:
qsTr
(
"
Calculate
"
)
onClicked
:
showDialog
(
calcAmpsPerVoltDlgComponent
,
qsTr
(
"
Calculate Amps per Volt
"
),
qgcView
.
showDialogDefaultWidth
,
StandardButton
.
Close
)
visible
:
_showAdvanced
onClicked
:
{
_calcAmpsPerVoltDlgVehicleCurrent
=
vehicleCurrent
_calcAmpsPerVoltDlgBattAmpPerVoltParam
=
battAmpPerVolt
showDialog
(
calcAmpsPerVoltDlgComponent
,
qsTr
(
"
Calculate Amps per Volt
"
),
qgcView
.
showDialogDefaultWidth
,
StandardButton
.
Close
)
}
}
QGCLabel
{
...
...
@@ -411,6 +422,10 @@ SetupPage {
}
// Column
}
// Component - powerSetupComponent
// Must be set prior to use of calcVoltageMultiplierDlgComponent
property
Fact
_calcVoltageDlgVehicleVoltage
property
Fact
_calcVoltageDlgBattVoltMultParam
Component
{
id
:
calcVoltageMultiplierDlgComponent
...
...
@@ -444,10 +459,10 @@ SetupPage {
QGCTextField
{
id
:
measuredVoltage
}
QGCLabel
{
text
:
qsTr
(
"
Vehicle voltage:
"
)
}
QGCLabel
{
text
:
vehicleVoltage
.
valueString
}
FactLabel
{
fact
:
_calcVoltageDlgVehicleVoltage
}
QGCLabel
{
text
:
qsTr
(
"
Voltage multiplier:
"
)
}
FactLabel
{
fact
:
battVoltMult
}
FactLabel
{
fact
:
_calcVoltageDlgBattVoltMultParam
}
}
QGCButton
{
...
...
@@ -458,9 +473,9 @@ SetupPage {
if
(
measuredVoltageValue
==
0
||
isNaN
(
measuredVoltageValue
))
{
return
}
var
newVoltageMultiplier
=
(
measuredVoltageValue
*
battVoltMult
.
value
)
/
v
ehicleVoltage
.
value
var
newVoltageMultiplier
=
(
measuredVoltageValue
*
_calcVoltageDlgBattVoltMultParam
.
value
)
/
_calcVoltageDlgV
ehicleVoltage
.
value
if
(
newVoltageMultiplier
>
0
)
{
battVoltMult
.
value
=
newVoltageMultiplier
_calcVoltageDlgBattVoltMultParam
.
value
=
newVoltageMultiplier
}
}
}
...
...
@@ -469,6 +484,10 @@ SetupPage {
}
// QGCViewDialog
}
// Component - calcVoltageMultiplierDlgComponent
// Must be set prior to use of calcAmpsPerVoltDlgComponent
property
Fact
_calcAmpsPerVoltDlgVehicleCurrent
property
Fact
_calcAmpsPerVoltDlgBattAmpPerVoltParam
Component
{
id
:
calcAmpsPerVoltDlgComponent
...
...
@@ -502,10 +521,10 @@ SetupPage {
QGCTextField
{
id
:
measuredCurrent
}
QGCLabel
{
text
:
qsTr
(
"
Vehicle current:
"
)
}
QGCLabel
{
text
:
vehicleCurrent
.
valueString
}
FactLabel
{
fact
:
_calcAmpsPerVoltDlgVehicleCurrent
}
QGCLabel
{
text
:
qsTr
(
"
Amps per volt:
"
)
}
FactLabel
{
fact
:
battAmpPerVolt
}
FactLabel
{
fact
:
_calcAmpsPerVoltDlgBattAmpPerVoltParam
}
}
QGCButton
{
...
...
@@ -516,9 +535,9 @@ SetupPage {
if
(
measuredCurrentValue
==
0
)
{
return
}
var
newAmpsPerVolt
=
(
measuredCurrentValue
*
battAmpPerVolt
.
value
)
/
v
ehicleCurrent
.
value
var
newAmpsPerVolt
=
(
measuredCurrentValue
*
_calcAmpsPerVoltDlgBattAmpPerVoltParam
.
value
)
/
_calcAmpsPerVoltDlgV
ehicleCurrent
.
value
if
(
newAmpsPerVolt
!=
0
)
{
battAmpPerVolt
.
value
=
newAmpsPerVolt
_calcAmpsPerVoltDlgBattAmpPerVoltParam
.
value
=
newAmpsPerVolt
}
}
}
...
...
src/QmlControls/ParameterEditorDialog.qml
View file @
348091b3
...
...
@@ -129,9 +129,8 @@ QGCViewDialog {
}
QGCButton
{
anchors.baseline
:
valueField
.
baseline
visible
:
_allowDefaultReset
text
:
qsTr
(
"
Reset to default
"
)
visible
:
_allowDefaultReset
text
:
qsTr
(
"
Reset to default
"
)
onClicked
:
{
fact
.
value
=
fact
.
defaultValue
...
...
src/QmlControls/QGCTextField.qml
View file @
348091b3
...
...
@@ -71,36 +71,35 @@ TextField {
anchors.bottom
:
parent
.
bottom
anchors.rightMargin
:
backgroundItem
.
showHelp
?
0
:
control
.
__contentHeight
*
0.333
anchors.right
:
parent
.
right
spacing
:
4
spacing
:
ScreenTools
.
defaultFontPixelWidth
/
4
Component.onCompleted
:
control
.
_helpLayoutWidth
=
unitsHelpLayout
.
width
onWidthChanged
:
control
.
_helpLayoutWidth
=
unitsHelpLayout
.
width
Text
{
Layout.alignment
:
Qt
.
AlignVCenter
text
:
control
.
unitsLabel
font.pointSize
:
backgroundItem
.
showHelp
?
ScreenTools
.
smallFontPointSize
:
ScreenTools
.
defaultFontPointSize
font.family
:
ScreenTools
.
normalFontFamily
antialiasing
:
true
color
:
control
.
textColor
visible
:
control
.
showUnits
Layout.alignment
:
Qt
.
AlignVCenter
text
:
control
.
unitsLabel
font.pointSize
:
backgroundItem
.
showHelp
?
ScreenTools
.
smallFontPointSize
:
ScreenTools
.
defaultFontPointSize
font.family
:
ScreenTools
.
normalFontFamily
antialiasing
:
true
color
:
control
.
textColor
visible
:
control
.
showUnits
}
Rectangle
{
Layout.margins
:
2
Layout.leftMargin
:
0
Layout.rightMargin
:
1
Layout.fillHeight
:
true
Layout.alignment
:
Qt
.
AlignRight
width
:
height
*
0.75
width
:
helpLabel
.
contentWidth
*
3
color
:
control
.
textColor
radius
:
2
visible
:
backgroundItem
.
showHelp
QGCLabel
{
anchors.fill
:
parent
verticalAlignment
:
Text
.
AlignVCenter
horizontalAlignment
:
Text
.
AlignHCenter
color
:
qgcPal
.
textField
text
:
"
?
"
id
:
helpLabel
anchors.centerIn
:
parent
color
:
qgcPal
.
textField
text
:
qsTr
(
"
?
"
)
}
}
}
...
...
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