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
620e1b7f
Commit
620e1b7f
authored
Jun 25, 2018
by
DonLakeFlyer
Browse files
Fix APM power calculators
parent
a99d190a
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/AutoPilotPlugins/APM/APMPowerComponent.qml
View file @
620e1b7f
...
...
@@ -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:
"
)
}
QGC
Label
{
text
:
vehicleVoltage
.
valueString
}
Fact
Label
{
fact
:
_calcVoltageDlgVehicleVoltage
}
QGCLabel
{
text
:
qsTr
(
"
Voltage multiplier:
"
)
}
FactLabel
{
fact
:
b
attVoltMult
}
FactLabel
{
fact
:
_calcVoltageDlgB
attVoltMult
Param
}
}
QGCButton
{
...
...
@@ -458,9 +473,9 @@ SetupPage {
if
(
measuredVoltageValue
==
0
||
isNaN
(
measuredVoltageValue
))
{
return
}
var
newVoltageMultiplier
=
(
measuredVoltageValue
*
b
attVoltMult
.
value
)
/
v
ehicleVoltage
.
value
var
newVoltageMultiplier
=
(
measuredVoltageValue
*
_calcVoltageDlgB
attVoltMult
Param
.
value
)
/
_calcVoltageDlgV
ehicleVoltage
.
value
if
(
newVoltageMultiplier
>
0
)
{
b
attVoltMult
.
value
=
newVoltageMultiplier
_calcVoltageDlgB
attVoltMult
Param
.
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:
"
)
}
QGC
Label
{
text
:
v
ehicleCurrent
.
valueString
}
Fact
Label
{
fact
:
_calcAmpsPerVoltDlgV
ehicleCurrent
}
QGCLabel
{
text
:
qsTr
(
"
Amps per volt:
"
)
}
FactLabel
{
fact
:
b
attAmpPerVolt
}
FactLabel
{
fact
:
_calcAmpsPerVoltDlgB
attAmpPerVolt
Param
}
}
QGCButton
{
...
...
@@ -516,9 +535,9 @@ SetupPage {
if
(
measuredCurrentValue
==
0
)
{
return
}
var
newAmpsPerVolt
=
(
measuredCurrentValue
*
b
attAmpPerVolt
.
value
)
/
v
ehicleCurrent
.
value
var
newAmpsPerVolt
=
(
measuredCurrentValue
*
_calcAmpsPerVoltDlgB
attAmpPerVolt
Param
.
value
)
/
_calcAmpsPerVoltDlgV
ehicleCurrent
.
value
if
(
newAmpsPerVolt
!=
0
)
{
b
attAmpPerVolt
.
value
=
newAmpsPerVolt
_calcAmpsPerVoltDlgB
attAmpPerVolt
Param
.
value
=
newAmpsPerVolt
}
}
}
...
...
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