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
58b85d0b
Commit
58b85d0b
authored
Jun 26, 2018
by
DonLakeFlyer
Browse files
More work for new battery stuff
parent
348091b3
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/AutoPilotPlugins/APM/APMPowerComponent.qml
View file @
58b85d0b
...
...
@@ -43,6 +43,8 @@ SetupPage {
property
bool
_batt2MonitorEnabled
:
_batt2MonitorAvailable
&&
_batt2Monitor
.
rawValue
!==
0
property
bool
_batt1ParamsAvailable
:
controller
.
parameterExists
(
-
1
,
"
BATT_CAPACITY
"
)
property
bool
_batt2ParamsAvailable
:
controller
.
parameterExists
(
-
1
,
"
BATT2_CAPACITY
"
)
property
bool
_showBatt1Reboot
:
_batt1MonitorEnabled
&&
!
_batt1ParamsAvailable
property
bool
_showBatt2Reboot
:
_batt2MonitorEnabled
&&
!
_batt2ParamsAvailable
property
string
_restartRequired
:
qsTr
(
"
Requires vehicle reboot
"
)
...
...
@@ -84,7 +86,13 @@ SetupPage {
QGCLabel
{
text
:
_restartRequired
visible
:
_batt1MonitorEnabled
&&
!
_batt1ParamsAvailable
visible
:
_showBatt1Reboot
}
QGCButton
{
text
:
qsTr
(
"
Reboot vehicle
"
)
visible
:
_showBatt1Reboot
onClicked
:
controller
.
vehicle
.
rebootVehicle
()
}
}
}
...
...
@@ -162,7 +170,13 @@ SetupPage {
QGCLabel
{
text
:
_restartRequired
visible
:
_batt2MonitorEnabled
&&
!
_batt2ParamsAvailable
visible
:
_showBatt2Reboot
}
QGCButton
{
text
:
qsTr
(
"
Reboot vehicle
"
)
visible
:
_showBatt2Reboot
onClicked
:
controller
.
vehicle
.
rebootVehicle
()
}
}
}
...
...
src/AutoPilotPlugins/APM/APMSafetyComponent.qml
View file @
58b85d0b
...
...
@@ -46,23 +46,103 @@ SetupPage {
property
Fact
_failsafeBatt2LowAct
:
controller
.
getParameterFact
(
-
1
,
"
BATT2_FS_LOW_ACT
"
,
false
/* reportMissing */
)
property
Fact
_failsafeBatt1CritAct
:
controller
.
getParameterFact
(
-
1
,
"
BATT_FS_CRT_ACT
"
,
false
/* reportMissing */
)
property
Fact
_failsafeBatt2CritAct
:
controller
.
getParameterFact
(
-
1
,
"
BATT2_FS_CRT_ACT
"
,
false
/* reportMissing */
)
property
Fact
_failsafeBatt1Mah
:
controller
.
getParameterFact
(
-
1
,
"
BATT_LOW_MAH
"
,
false
/* reportMissing */
)
property
Fact
_failsafeBatt2Mah
:
controller
.
getParameterFact
(
-
1
,
"
BATT2_LOW_MAH
"
,
false
/* reportMissing */
)
property
Fact
_failsafeBatt1Voltage
:
controller
.
getParameterFact
(
-
1
,
"
BATT_LOW_VOLT
"
,
false
/* reportMissing */
)
property
Fact
_failsafeBatt2Voltage
:
controller
.
getParameterFact
(
-
1
,
"
BATT2_LOW_VOLT
"
,
false
/* reportMissing */
)
property
Fact
_failsafeBatt1LowMah
:
controller
.
getParameterFact
(
-
1
,
"
BATT_LOW_MAH
"
,
false
/* reportMissing */
)
property
Fact
_failsafeBatt2LowMah
:
controller
.
getParameterFact
(
-
1
,
"
BATT2_LOW_MAH
"
,
false
/* reportMissing */
)
property
Fact
_failsafeBatt1CritMah
:
controller
.
getParameterFact
(
-
1
,
"
BATT_CRT_MAH
"
,
false
/* reportMissing */
)
property
Fact
_failsafeBatt2CritMah
:
controller
.
getParameterFact
(
-
1
,
"
BATT2_CRT_MAH
"
,
false
/* reportMissing */
)
property
Fact
_failsafeBatt1LowVoltage
:
controller
.
getParameterFact
(
-
1
,
"
BATT_LOW_VOLT
"
,
false
/* reportMissing */
)
property
Fact
_failsafeBatt2LowVoltage
:
controller
.
getParameterFact
(
-
1
,
"
BATT2_LOW_VOLT
"
,
false
/* reportMissing */
)
property
Fact
_failsafeBatt1CritVoltage
:
controller
.
getParameterFact
(
-
1
,
"
BATT_CRT_VOLT
"
,
false
/* reportMissing */
)
property
Fact
_failsafeBatt2CritVoltage
:
controller
.
getParameterFact
(
-
1
,
"
BATT2_CRT_VOLT
"
,
false
/* reportMissing */
)
property
Fact
_armingCheck
:
controller
.
getParameterFact
(
-
1
,
"
ARMING_CHECK
"
)
property
real
_margins
:
ScreenTools
.
defaultFontPixelHeight
property
bool
_showIcon
:
!
ScreenTools
.
isTinyScreen
property
string
_restartRequired
:
qsTr
(
"
Requires vehicle reboot
"
)
ExclusiveGroup
{
id
:
fenceActionRadioGroup
}
ExclusiveGroup
{
id
:
landLoiterRadioGroup
}
ExclusiveGroup
{
id
:
returnAltRadioGroup
}
Component
{
id
:
batteryFailsafeComponent
Column
{
spacing
:
_margins
GridLayout
{
id
:
gridLayout
columnSpacing
:
_margins
rowSpacing
:
_margins
columns
:
2
QGCLabel
{
text
:
qsTr
(
"
Low action:
"
)
}
FactComboBox
{
fact
:
failsafeBattLowAct
indexModel
:
false
Layout.fillWidth
:
true
}
QGCLabel
{
text
:
qsTr
(
"
Critical action:
"
)
}
FactComboBox
{
fact
:
failsafeBattCritAct
indexModel
:
false
Layout.fillWidth
:
true
}
QGCLabel
{
text
:
qsTr
(
"
Low voltage threshold:
"
)
}
FactTextField
{
fact
:
failsafeBattLowVoltage
showUnits
:
true
Layout.fillWidth
:
true
}
QGCLabel
{
text
:
qsTr
(
"
Critical voltage threshold:
"
)
}
FactTextField
{
fact
:
failsafeBattCritVoltage
showUnits
:
true
Layout.fillWidth
:
true
}
QGCLabel
{
text
:
qsTr
(
"
Low mAh threshold:
"
)
}
FactTextField
{
fact
:
failsafeBattLowMah
showUnits
:
true
Layout.fillWidth
:
true
}
QGCLabel
{
text
:
qsTr
(
"
Critical mAh threshold:
"
)
}
FactTextField
{
fact
:
failsafeBattCritMah
showUnits
:
true
Layout.fillWidth
:
true
}
}
// GridLayout
}
// Column
}
Component
{
id
:
restartRequiredComponent
ColumnLayout
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCLabel
{
text
:
_restartRequired
}
QGCButton
{
text
:
qsTr
(
"
Reboot vehicle
"
)
onClicked
:
controller
.
vehicle
.
rebootVehicle
()
}
}
}
Column
{
spacing
:
_margins
/
2
visible
:
_batt1MonitorEnabled
&&
_batt1ParamsAvailable
visible
:
_batt1MonitorEnabled
QGCLabel
{
text
:
qsTr
(
"
Battery1 Failsafe Triggers
"
)
...
...
@@ -70,67 +150,33 @@ SetupPage {
}
Rectangle
{
width
:
batteryFailsafe
Column
.
x
+
batteryFailsafe
Column
.
width
+
_margins
height
:
batteryFailsafe
Column
.
y
+
batteryFailsafe
Column
.
height
+
_margins
width
:
battery
1
Failsafe
Loader
.
x
+
battery
1
Failsafe
Loader
.
width
+
_margins
height
:
battery
1
Failsafe
Loader
.
y
+
battery
1
Failsafe
Loader
.
height
+
_margins
color
:
ggcPal
.
windowShade
Column
{
id
:
batteryFailsafe
Column
Loader
{
id
:
battery
1
Failsafe
Loader
anchors.margins
:
_margins
anchors.top
:
parent
.
top
anchors.left
:
parent
.
left
spacing
:
_margins
GridLayout
{
id
:
gridLayout
columnSpacing
:
_margins
rowSpacing
:
_margins
columns
:
2
QGCLabel
{
text
:
qsTr
(
"
Battery low action:
"
)
}
FactComboBox
{
fact
:
_failsafeBatt1LowAct
indexModel
:
false
Layout.fillWidth
:
true
}
QGCLabel
{
text
:
qsTr
(
"
Battery critical action:
"
)
}
FactComboBox
{
fact
:
_failsafeBatt1CritAct
indexModel
:
false
Layout.fillWidth
:
true
}
QGCCheckBox
{
text
:
qsTr
(
"
Voltage threshold:
"
)
checked
:
_failsafeBatt1Voltage
.
value
!=
0
onClicked
:
_failsafeBatt1Voltage
.
value
=
checked
?
10.5
:
0
}
FactTextField
{
fact
:
_failsafeBatt1Voltage
showUnits
:
true
Layout.fillWidth
:
true
}
QGCCheckBox
{
text
:
qsTr
(
"
MAH threshold:
"
)
checked
:
_failsafeBatt1Mah
.
value
!=
0
onClicked
:
_failsafeBatt1Mah
.
value
=
checked
?
600
:
0
}
FactTextField
{
fact
:
_failsafeBatt1Mah
showUnits
:
true
Layout.fillWidth
:
true
}
}
// GridLayout
}
// Column
sourceComponent
:
_batt1ParamsAvailable
?
batteryFailsafeComponent
:
restartRequiredComponent
property
Fact
battMonitor
:
_batt1Monitor
property
bool
battParamsAvailable
:
_batt1ParamsAvailable
property
Fact
failsafeBattLowAct
:
_failsafeBatt1LowAct
property
Fact
failsafeBattCritAct
:
_failsafeBatt1CritAct
property
Fact
failsafeBattLowMah
:
_failsafeBatt1LowMah
property
Fact
failsafeBattCritMah
:
_failsafeBatt1CritMah
property
Fact
failsafeBattLowVoltage
:
_failsafeBatt1LowVoltage
property
Fact
failsafeBattCritVoltage
:
_failsafeBatt1CritVoltage
}
}
// Rectangle
}
// Column - Battery Failsafe Settings
Column
{
spacing
:
_margins
/
2
visible
:
_batt2MonitorEnabled
&&
_batt2ParamsAvailable
visible
:
_batt2MonitorEnabled
QGCLabel
{
text
:
qsTr
(
"
Battery2 Failsafe Triggers
"
)
...
...
@@ -138,65 +184,28 @@ SetupPage {
}
Rectangle
{
id
:
failsafeSettings
width
:
battery2FailsafeColumn
.
x
+
battery2FailsafeColumn
.
width
+
_margins
height
:
battery2FailsafeColumn
.
y
+
battery2FailsafeColumn
.
height
+
_margins
width
:
battery2FailsafeLoader
.
x
+
battery2FailsafeLoader
.
width
+
_margins
height
:
battery2FailsafeLoader
.
y
+
battery2FailsafeLoader
.
height
+
_margins
color
:
ggcPal
.
windowShade
Column
{
id
:
battery2Failsafe
Column
Loader
{
id
:
battery2Failsafe
Loader
anchors.margins
:
_margins
anchors.top
:
parent
.
top
anchors.left
:
parent
.
left
spacing
:
_margins
GridLayout
{
columnSpacing
:
_margins
rowSpacing
:
_margins
columns
:
2
visible
:
_batt2MonitorEnabled
&&
_failsafeBatt2LowActAvailable
QGCLabel
{
text
:
qsTr
(
"
Battery low action:
"
)
}
FactComboBox
{
fact
:
_failsafeBatt2LowAct
indexModel
:
false
Layout.fillWidth
:
true
}
QGCLabel
{
text
:
qsTr
(
"
Battery critical action:
"
)
}
FactComboBox
{
fact
:
_failsafeBatt2CritAct
indexModel
:
false
Layout.fillWidth
:
true
}
QGCCheckBox
{
text
:
qsTr
(
"
Voltage threshold:
"
)
checked
:
_failsafeBatt2Voltage
.
value
!=
0
onClicked
:
_failsafeBatt2Voltage
.
value
=
checked
?
10.5
:
0
}
FactTextField
{
fact
:
_failsafeBatt2Voltage
showUnits
:
true
Layout.fillWidth
:
true
}
QGCCheckBox
{
text
:
qsTr
(
"
MAH threshold:
"
)
checked
:
_failsafeBatt2Mah
.
value
!=
0
onClicked
:
_failsafeBatt2Mah
.
value
=
checked
?
600
:
0
}
FactTextField
{
fact
:
_failsafeBatt2Mah
showUnits
:
true
Layout.fillWidth
:
true
}
}
// GridLayout
}
// Column
sourceComponent
:
_batt2ParamsAvailable
?
batteryFailsafeComponent
:
restartRequiredComponent
property
Fact
battMonitor
:
_batt2Monitor
property
bool
battParamsAvailable
:
_batt2ParamsAvailable
property
Fact
failsafeBattLowAct
:
_failsafeBatt2LowAct
property
Fact
failsafeBattCritAct
:
_failsafeBatt2CritAct
property
Fact
failsafeBattLowMah
:
_failsafeBatt2LowMah
property
Fact
failsafeBattCritMah
:
_failsafeBatt2CritMah
property
Fact
failsafeBattLowVoltage
:
_failsafeBatt2LowVoltage
property
Fact
failsafeBattCritVoltage
:
_failsafeBatt2CritVoltage
}
}
// Rectangle
}
// Column - Battery
2
Failsafe Settings
}
// Column - Battery Failsafe Settings
Component
{
id
:
planeGeneralFS
...
...
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