Commit 8bc1336d authored by Don Gagne's avatar Don Gagne
Browse files

Convert setup pages to use SetupPage

parent 76013297
......@@ -15,241 +15,209 @@ import QtQuick.Dialogs 1.2
import QGroundControl 1.0
import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
import QGroundControl.Palette 1.0
import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Controllers 1.0
QGCView {
id: qgcView
viewPanel: panel
SetupPage {
id: radioPage
pageComponent: pageComponent
QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled }
Component {
id: pageComponent
readonly property string dialogTitle: qsTr("Radio")
readonly property real labelToMonitorMargin: defaultTextWidth * 3
Item {
width: availableWidth
height: Math.max(leftColumn.height, rightColumn.height)
property bool controllerCompleted: false
property bool controllerAndViewReady: false
readonly property string dialogTitle: qsTr("Radio")
readonly property real labelToMonitorMargin: defaultTextWidth * 3
function updateChannelCount()
{
/*
FIXME: Turned off for now, since it prevents binding. Need to restructure to
allow binding and still check channel count
if (controller.channelCount < controller.minChannelCount) {
showDialog(channelCountDialogComponent, dialogTitle, qgcView.showDialogDefaultWidth, 0)
} else {
hideDialog()
property bool controllerCompleted: false
property bool controllerAndViewReady: false
Component.onCompleted: {
if (controllerCompleted) {
controllerAndViewReady = true
controller.start()
updateChannelCount()
}
}
*/
}
RadioComponentController {
id: controller
factPanel: panel
statusText: statusText
cancelButton: cancelButton
nextButton: nextButton
skipButton: skipButton
Component.onCompleted: {
controllerCompleted = true
if (qgcView.completedSignalled) {
controllerAndViewReady = true
controller.start()
updateChannelCount()
function updateChannelCount()
{
}
}
onChannelCountChanged: updateChannelCount()
onFunctionMappingChangedAPMReboot: showMessage(qsTr("Reboot required"), qsTr("Your stick mappings have changed, you must reboot the vehicle for correct operation."), StandardButton.Ok)
onThrottleReversedCalFailure: showMessage(qsTr("Throttle channel reversed"), qsTr("Calibration failed. The throttle channel on your transmitter is reversed. You must correct this on your transmitter in order to complete calibration."), StandardButton.Ok)
}
onCompleted: {
if (controllerCompleted) {
controllerAndViewReady = true
controller.start()
updateChannelCount()
}
}
QGCViewPanel {
id: panel
anchors.fill: parent
Component {
id: copyTrimsDialogComponent
QGCViewMessage {
message: qsTr("Center your sticks and move throttle all the way down, then press Ok to copy trims. After pressing Ok, reset the trims on your radio back to zero.")
function accept() {
hideDialog()
controller.copyTrims()
RadioComponentController {
id: controller
factPanel: radioPage.viewPanel
statusText: statusText
cancelButton: cancelButton
nextButton: nextButton
skipButton: skipButton
Component.onCompleted: {
controllerCompleted = true
if (qgcView.completedSignalled) {
controllerAndViewReady = true
controller.start()
updateChannelCount()
}
}
onChannelCountChanged: updateChannelCount()
onFunctionMappingChangedAPMReboot: showMessage(qsTr("Reboot required"), qsTr("Your stick mappings have changed, you must reboot the vehicle for correct operation."), StandardButton.Ok)
onThrottleReversedCalFailure: showMessage(qsTr("Throttle channel reversed"), qsTr("Calibration failed. The throttle channel on your transmitter is reversed. You must correct this on your transmitter in order to complete calibration."), StandardButton.Ok)
}
}
Component {
id: zeroTrimsDialogComponent
Component {
id: copyTrimsDialogComponent
QGCViewMessage {
message: qsTr("Before calibrating you should zero all your trims and subtrims. Click Ok to start Calibration.\n\n%1").arg(
(QGroundControl.multiVehicleManager.activeVehicle.px4Firmware ? "" : qsTr("Please ensure all motor power is disconnected AND all props are removed from the vehicle.")))
QGCViewMessage {
message: qsTr("Center your sticks and move throttle all the way down, then press Ok to copy trims. After pressing Ok, reset the trims on your radio back to zero.")
function accept() {
hideDialog()
controller.nextButtonClicked()
function accept() {
hideDialog()
controller.copyTrims()
}
}
}
}
Component {
id: channelCountDialogComponent
Component {
id: zeroTrimsDialogComponent
QGCViewMessage {
message: controller.channelCount == 0 ? qsTr("Please turn on transmitter.") : qsTr("%1 channels or more are needed to fly.").arg(controller.minChannelCount)
}
}
QGCViewMessage {
message: qsTr("Before calibrating you should zero all your trims and subtrims. Click Ok to start Calibration.\n\n%1").arg(
(QGroundControl.multiVehicleManager.activeVehicle.px4Firmware ? "" : qsTr("Please ensure all motor power is disconnected AND all props are removed from the vehicle.")))
Component {
id: spektrumBindDialogComponent
function accept() {
hideDialog()
controller.nextButtonClicked()
}
}
}
QGCViewDialog {
Component {
id: channelCountDialogComponent
function accept() {
controller.spektrumBindMode(radioGroup.current.bindMode)
hideDialog()
QGCViewMessage {
message: controller.channelCount == 0 ? qsTr("Please turn on transmitter.") : qsTr("%1 channels or more are needed to fly.").arg(controller.minChannelCount)
}
}
function reject() {
hideDialog()
}
Component {
id: spektrumBindDialogComponent
Column {
anchors.fill: parent
spacing: 5
QGCViewDialog {
QGCLabel {
width: parent.width
wrapMode: Text.WordWrap
text: qsTr("Click Ok to place your Spektrum receiver in the bind mode. Select the specific receiver type below:")
function accept() {
controller.spektrumBindMode(radioGroup.current.bindMode)
hideDialog()
}
ExclusiveGroup { id: radioGroup }
QGCRadioButton {
exclusiveGroup: radioGroup
text: qsTr("DSM2 Mode")
property int bindMode: RadioComponentController.DSM2
function reject() {
hideDialog()
}
QGCRadioButton {
exclusiveGroup: radioGroup
text: qsTr("DSMX (7 channels or less)")
property int bindMode: RadioComponentController.DSMX7
}
Column {
anchors.fill: parent
spacing: 5
QGCRadioButton {
exclusiveGroup: radioGroup
checked: true
text: qsTr("DSMX (8 channels or more)")
QGCLabel {
width: parent.width
wrapMode: Text.WordWrap
text: qsTr("Click Ok to place your Spektrum receiver in the bind mode. Select the specific receiver type below:")
}
property int bindMode: RadioComponentController.DSMX8
}
}
}
} // Component - spektrumBindDialogComponent
ExclusiveGroup { id: radioGroup }
// Live channel monitor control component
Component {
id: channelMonitorDisplayComponent
QGCRadioButton {
exclusiveGroup: radioGroup
text: qsTr("DSM2 Mode")
Item {
property int rcValue: 1500
property int bindMode: RadioComponentController.DSM2
}
QGCRadioButton {
exclusiveGroup: radioGroup
text: qsTr("DSMX (7 channels or less)")
property int __lastRcValue: 1500
readonly property int __rcValueMaxJitter: 2
property color __barColor: qgcPal.windowShade
property int bindMode: RadioComponentController.DSMX7
}
readonly property int _pwmMin: 800
readonly property int _pwmMax: 2200
readonly property int _pwmRange: _pwmMax - _pwmMin
QGCRadioButton {
exclusiveGroup: radioGroup
checked: true
text: qsTr("DSMX (8 channels or more)")
// Bar
Rectangle {
id: bar
anchors.verticalCenter: parent.verticalCenter
width: parent.width
height: parent.height / 2
color: __barColor
property int bindMode: RadioComponentController.DSMX8
}
}
}
} // Component - spektrumBindDialogComponent
// Center point
Rectangle {
anchors.horizontalCenter: parent.horizontalCenter
width: defaultTextWidth / 2
height: parent.height
color: qgcPal.window
}
// Live channel monitor control component
Component {
id: channelMonitorDisplayComponent
// Indicator
Rectangle {
anchors.verticalCenter: parent.verticalCenter
width: parent.height * 0.75
height: width
radius: width / 2
color: qgcPal.text
visible: mapped
x: (((reversed ? _pwmMax - rcValue : rcValue - _pwmMin) / _pwmRange) * parent.width) - (width / 2)
}
Item {
property int rcValue: 1500
QGCLabel {
anchors.fill: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: qsTr("Not Mapped")
visible: !mapped
}
ColorAnimation {
id: barAnimation
target: bar
property: "color"
from: "yellow"
to: __barColor
duration: 1500
}
property int __lastRcValue: 1500
readonly property int __rcValueMaxJitter: 2
property color __barColor: qgcPal.windowShade
readonly property int _pwmMin: 800
readonly property int _pwmMax: 2200
readonly property int _pwmRange: _pwmMax - _pwmMin
/*
// FIXME: Bar animation is turned off for now to figure out better usbaility
onRcValueChanged: {
if (Math.abs(rcValue - __lastRcValue) > __rcValueMaxJitter) {
__lastRcValue = rcValue
barAnimation.restart()
// Bar
Rectangle {
id: bar
anchors.verticalCenter: parent.verticalCenter
width: parent.width
height: parent.height / 2
color: __barColor
}
}
// rcValue debugger
QGCLabel {
anchors.fill: parent
text: rcValue
}
*/
}
} // Component - channelMonitorDisplayComponent
// Center point
Rectangle {
anchors.horizontalCenter: parent.horizontalCenter
width: defaultTextWidth / 2
height: parent.height
color: qgcPal.window
}
// Main view Qml starts here
// Indicator
Rectangle {
anchors.verticalCenter: parent.verticalCenter
width: parent.height * 0.75
height: width
radius: width / 2
color: qgcPal.text
visible: mapped
x: (((reversed ? _pwmMax - rcValue : rcValue - _pwmMin) / _pwmRange) * parent.width) - (width / 2)
}
QGCLabel {
anchors.fill: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: qsTr("Not Mapped")
visible: !mapped
}
QGCFlickable {
anchors.fill: parent
contentHeight: Math.max(leftColumn.height, rightColumn.height)
clip: true
ColorAnimation {
id: barAnimation
target: bar
property: "color"
from: "yellow"
to: __barColor
duration: 1500
}
}
} // Component - channelMonitorDisplayComponent
// Left side column
Column {
......@@ -277,11 +245,11 @@ QGCView {
id: rollLoader
anchors.left: rollLabel.right
anchors.right: parent.right
height: qgcView.defaultTextHeight
height: radioPage.defaultTextHeight
width: 100
sourceComponent: channelMonitorDisplayComponent
property real defaultTextWidth: qgcView.defaultTextWidth
property real defaultTextWidth: radioPage.defaultTextWidth
property bool mapped: controller.rollChannelMapped
property bool reversed: controller.rollChannelReversed
}
......@@ -307,11 +275,11 @@ QGCView {
id: pitchLoader
anchors.left: pitchLabel.right
anchors.right: parent.right
height: qgcView.defaultTextHeight
height: radioPage.defaultTextHeight
width: 100
sourceComponent: channelMonitorDisplayComponent
property real defaultTextWidth: qgcView.defaultTextWidth
property real defaultTextWidth: radioPage.defaultTextWidth
property bool mapped: controller.pitchChannelMapped
property bool reversed: controller.pitchChannelReversed
}
......@@ -337,11 +305,11 @@ QGCView {
id: yawLoader
anchors.left: yawLabel.right
anchors.right: parent.right
height: qgcView.defaultTextHeight
height: radioPage.defaultTextHeight
width: 100
sourceComponent: channelMonitorDisplayComponent
property real defaultTextWidth: qgcView.defaultTextWidth
property real defaultTextWidth: radioPage.defaultTextWidth
property bool mapped: controller.yawChannelMapped
property bool reversed: controller.yawChannelReversed
}
......@@ -367,11 +335,11 @@ QGCView {
id: throttleLoader
anchors.left: throttleLabel.right
anchors.right: parent.right
height: qgcView.defaultTextHeight
height: radioPage.defaultTextHeight
width: 100
sourceComponent: channelMonitorDisplayComponent
property real defaultTextWidth: qgcView.defaultTextWidth
property real defaultTextWidth: radioPage.defaultTextWidth
property bool mapped: controller.throttleChannelMapped
property bool reversed: controller.throttleChannelReversed
}
......@@ -409,7 +377,7 @@ QGCView {
onClicked: {
if (text == qsTr("Calibrate")) {
showDialog(zeroTrimsDialogComponent, dialogTitle, qgcView.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel)
showDialog(zeroTrimsDialogComponent, dialogTitle, radioPage.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel)
} else {
controller.nextButtonClicked()
}
......@@ -442,13 +410,13 @@ QGCView {
id: bindButton
text: qsTr("Spektrum Bind")
onClicked: showDialog(spektrumBindDialogComponent, dialogTitle, qgcView.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel)
onClicked: showDialog(spektrumBindDialogComponent, dialogTitle, radioPage.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel)
}
QGCButton {
text: qsTr("Copy Trims")
visible: QGroundControl.multiVehicleManager.activeVehicle.px4Firmware
onClicked: showDialog(copyTrimsDialogComponent, dialogTitle, qgcView.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel)
onClicked: showDialog(copyTrimsDialogComponent, dialogTitle, radioPage.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel)
}
Repeater {
......@@ -484,7 +452,7 @@ QGCView {
id: rightColumn
anchors.top: parent.top
anchors.right: parent.right
width: Math.min(defaultTextWidth * 35, qgcView.width * 0.4)
width: Math.min(radioPage.defaultTextWidth * 35, availableWidth * 0.4)
spacing: ScreenTools.defaultFontPixelHeight / 2
Row {
......@@ -520,6 +488,6 @@ QGCView {
width: parent.width
}
} // Column - Right Column
} // QGCFlickable
} // QGCViewPanel
}
} // Item
} // Component - pageComponent
} // SetupPage
......@@ -45,10 +45,10 @@ public:
Q_PROPERTY(int minChannelCount MEMBER _chanMinimum CONSTANT)
Q_PROPERTY(int channelCount READ channelCount NOTIFY channelCountChanged)
Q_PROPERTY(QQuickItem* statusText MEMBER _statusText)
Q_PROPERTY(QQuickItem* cancelButton MEMBER _cancelButton)
Q_PROPERTY(QQuickItem* nextButton MEMBER _nextButton)
Q_PROPERTY(QQuickItem* skipButton MEMBER _skipButton)
Q_PROPERTY(QQuickItem* statusText MEMBER _statusText NOTIFY statusTextChanged)
Q_PROPERTY(QQuickItem* cancelButton MEMBER _cancelButton NOTIFY cancelButtonChanged)
Q_PROPERTY(QQuickItem* nextButton MEMBER _nextButton NOTIFY nextButtonChanged)
Q_PROPERTY(QQuickItem* skipButton MEMBER _skipButton NOTIFY skipButtonChanged)
Q_PROPERTY(bool rollChannelMapped READ rollChannelMapped NOTIFY rollChannelMappedChanged)
Q_PROPERTY(bool pitchChannelMapped READ pitchChannelMapped NOTIFY pitchChannelMappedChanged)
......@@ -103,6 +103,11 @@ public:
void setTransmitterMode(int mode);
signals:
void statusTextChanged(void);
void cancelButtonChanged(void);
void nextButtonChanged(void);
void skipButtonChanged(void);
void channelCountChanged(int channelCount);
void channelRCValueChanged(int channel, int rcValue);
......
......@@ -24,7 +24,9 @@ QGCView {
id: setupView
viewPanel: setupPanel
property alias pageComponent: pageLoader.sourceComponent
property alias pageComponent: pageLoader.sourceComponent
property real availableWidth: width - pageLoader.x
property real availableHeight: height - pageLoader.y
property real _margins: ScreenTools.defaultFontPixelHeight / 2
......@@ -36,14 +38,13 @@ QGCView {
QGCFlickable {
anchors.fill: parent
contentWidth: pageLoader.item.x + pageLoader.item.width
contentHeight: pageLoader.item.y + pageLoader.item.height
contentWidth: pageLoader.x + pageLoader.item.width
contentHeight: pageLoader.y + pageLoader.item.height
clip: true
Column {
id: headingColumn
anchors.left: parent.left
anchors.right: parent.right
width: setupPanel.width
spacing: _margins
QGCLabel {
......@@ -62,9 +63,10 @@ QGCView {
}
Loader {
id: pageLoader
anchors.topMargin: _margins
anchors.top: headingColumn.bottom
id: pageLoader
}
}
}
......
......@@ -113,7 +113,7 @@ QString AirframeComponent::name(void) const
QString AirframeComponent::description(void) const
{
return tr("The Airframe Component is used to select the airframe which matches your vehicle. "
return tr("Airframe Setup is used to select the airframe which matches your vehicle. "
"This will in turn set up the various tuning values for flight parameters.");
}
......
......@@ -20,140 +20,131 @@ import QGroundControl.Controls 1.0
import QGroundControl.Controllers 1.0
import QGroundControl.ScreenTools 1.0
QGCView {
id: qgcView
viewPanel: panel
QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled }
property real _minW: ScreenTools.defaultFontPixelWidth * 30
property real _boxWidth: _minW
property real _boxSpace: ScreenTools.defaultFontPixelWidth
function computeDimensions() {
var sw = 0
var rw = 0
var idx = Math.floor(scroll.width / (_minW + ScreenTools.defaultFontPixelWidth))
if(idx < 1) {
_boxWidth = scroll.width
_boxSpace = 0
} else {
_boxSpace = 0
if(idx > 1) {
_boxSpace = ScreenTools.defaultFontPixelWidth
sw = _boxSpace * (idx - 1)
}
rw = scroll.width - sw
_boxWidth = rw / idx
}
}
AirframeComponentController {
id: controller
factPanel: panel
Component.onCompleted: {
if (controller.showCustomConfigPanel) {
showDialog(customConfigDialogComponent, qsTr("Custom Airframe Config"), qgcView.showDialogDefaultWidth, StandardButton.Reset)
}
}
}
SetupPage {
id: airframePage
pageComponent: pageComponent
Component {
id: customConfigDialogComponent
id: pageComponent
QGCViewMessage {
id: customConfigDialog
message: qsTr("Your vehicle is using a custom airframe configuration. ") +
qsTr("This configuration can only be modified through the Parameter Editor.\n\n") +
qsTr("If you want to reset your airframe configuration and select a standard configuration, click 'Reset' above.")
Column {
id: mainColumn
width: availableWidth
property Fact sys_autostart: controller.getParameterFact(-1, "SYS_AUTOSTART")
property real _minW: ScreenTools.defaultFontPixelWidth * 30
property real _boxWidth: _minW
property real _boxSpace: ScreenTools.defaultFontPixelWidth
function accept() {
sys_autostart.value = 0
customConfigDialog.hideDialog()
readonly property real spacerHeight: ScreenTools.defaultFontPixelHeight
onWidthChanged: {
computeDimensions()
}
}
}
Component {
id: applyRestartDialogComponent
Component.onCompleted: computeDimensions()
function computeDimensions() {
var sw = 0
var rw = 0
var idx = Math.floor(mainColumn.width / (_minW + ScreenTools.defaultFontPixelWidth))
if(idx < 1) {
_boxWidth = mainColumn.width
_boxSpace = 0
} else {
_boxSpace = 0
if(idx > 1) {
_boxSpace = ScreenTools.defaultFontPixelWidth
sw = _boxSpace * (idx - 1)
}
rw = mainColumn.width - sw
_boxWidth = rw / idx
}
}
QGCViewDialog {
id: applyRestartDialog
AirframeComponentController {
id: controller
factPanel: airframePage.viewPanel
function accept() {
controller.changeAutostart()
applyRestartDialog.hideDialog()
Component.onCompleted: {
if (controller.showCustomConfigPanel) {
showDialog(customConfigDialogComponent, qsTr("Custom Airframe Config"), qgcView.showDialogDefaultWidth, StandardButton.Reset)
}
}
}
QGCLabel {
anchors.fill: parent
wrapMode: Text.WordWrap
text: qsTr("Clicking “Apply” will save the changes you have made to your airframe configuration. ") +
qsTr("Your vehicle will also be restarted in order to complete the process.")
Component {
id: customConfigDialogComponent
QGCViewMessage {
id: customConfigDialog
message: qsTr("Your vehicle is using a custom airframe configuration. ") +
qsTr("This configuration can only be modified through the Parameter Editor.\n\n") +
qsTr("If you want to reset your airframe configuration and select a standard configuration, click 'Reset' above.")
property Fact sys_autostart: controller.getParameterFact(-1, "SYS_AUTOSTART")
function accept() {
sys_autostart.value = 0
customConfigDialog.hideDialog()
}
}
}
}
}
QGCViewPanel {
id: panel
anchors.fill: parent
readonly property real spacerHeight: ScreenTools.defaultFontPixelHeight
Item {
id: helpApplyRow
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
height: Math.max(helpText.contentHeight, applyButton.height)
QGCLabel {
id: helpText
width: parent.width - applyButton.width - 5
text: (controller.currentVehicleName != "" ?
qsTr("You've connected a %1.").arg(controller.currentVehicleName) :
qsTr("Airframe is not set.")) +
qsTr("To change this configuration, select the desired airframe below then click “Apply and Restart”.")
font.family: ScreenTools.demiboldFontFamily
wrapMode: Text.WordWrap
Component {
id: applyRestartDialogComponent
QGCViewDialog {
id: applyRestartDialog
function accept() {
controller.changeAutostart()
applyRestartDialog.hideDialog()
}
QGCLabel {
anchors.fill: parent
wrapMode: Text.WordWrap
text: qsTr("Clicking “Apply” will save the changes you have made to your airframe configuration. ") +
qsTr("Your vehicle will also be restarted in order to complete the process.")
}
}
}
QGCButton {
id: applyButton
Item {
id: helpApplyRow
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("Apply and Restart")
height: Math.max(helpText.contentHeight, applyButton.height)
QGCLabel {
id: helpText
width: parent.width - applyButton.width - 5
text: (controller.currentVehicleName != "" ?
qsTr("You've connected a %1.").arg(controller.currentVehicleName) :
qsTr("Airframe is not set.")) +
qsTr("To change this configuration, select the desired airframe below then click “Apply and Restart”.")
font.family: ScreenTools.demiboldFontFamily
wrapMode: Text.WordWrap
}
QGCButton {
id: applyButton
anchors.right: parent.right
text: qsTr("Apply and Restart")
onClicked: showDialog(applyRestartDialogComponent, qsTr("Apply and Restart"), qgcView.showDialogDefaultWidth, StandardButton.Apply | StandardButton.Cancel)
onClicked: showDialog(applyRestartDialogComponent, qsTr("Apply and Restart"), qgcView.showDialogDefaultWidth, StandardButton.Apply | StandardButton.Cancel)
}
}
}
Item {
id: lastSpacer
anchors.top: helpApplyRow.bottom
height: parent.spacerHeight
width: 10
}
QGCFlickable {
id: scroll
anchors.top: lastSpacer.bottom
anchors.bottom: parent.bottom
width: parent.width
clip: true
contentHeight: flowView.height
contentWidth: parent.width
flickableDirection: Flickable.VerticalFlick
onWidthChanged: {
computeDimensions()
Item {
id: lastSpacer
height: parent.spacerHeight
width: 10
}
Flow {
id: flowView
width: scroll.width
width: parent.width
spacing: _boxSpace
ExclusiveGroup {
......@@ -246,6 +237,6 @@ QGCView {
}
} // Repeater - summary boxes
} // Flow - summary boxes
} // Scroll View - summary boxes
} // QGCViewPanel
} // QGCView
} // Column
} // Component
} // SetupPage
......@@ -29,7 +29,7 @@ QString CameraComponent::name(void) const
QString CameraComponent::description(void) const
{
return tr("The Camera is used to setup the camera modes and hardware configuration to use it.");
return tr("Camera setup is used to adjust camera and gimbal settings.");
}
QString CameraComponent::iconResource(void) const
......
......@@ -17,99 +17,90 @@ import QtGraphicalEffects 1.0
import QGroundControl 1.0
import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
import QGroundControl.Palette 1.0
import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0
QGCView {
id: _cameraView
viewPanel: panel
anchors.fill: parent
SetupPage {
id: cameraPage
pageComponent: pageComponent
FactPanelController { id: controller; factPanel: panel }
Component {
id: pageComponent
QGCPalette { id: palette; colorGroupEnabled: enabled }
Column {
width: availableWidth
property real _margins: ScreenTools.defaultFontPixelHeight
property real _middleRowWidth: ScreenTools.defaultFontPixelWidth * 16
property real _editFieldWidth: ScreenTools.defaultFontPixelWidth * 16
FactPanelController { id: controller; factPanel: cameraPage.viewPanel }
property Fact _camTriggerMode: controller.getParameterFact(-1, "TRIG_MODE")
property Fact _camTriggerInterface: controller.getParameterFact(-1, "TRIG_INTERFACE", false)
property Fact _camTriggerPol: controller.getParameterFact(-1, "TRIG_POLARITY", false) // Don't bitch about missing as these only exist if trigger mode is enabled
property Fact _auxPins: controller.getParameterFact(-1, "TRIG_PINS", false) // Ditto
property real _margins: ScreenTools.defaultFontPixelHeight
property real _middleRowWidth: ScreenTools.defaultFontPixelWidth * 16
property real _editFieldWidth: ScreenTools.defaultFontPixelWidth * 16
property bool _rebooting: false
property var _auxChannels: [ 0, 0, 0, 0, 0, 0]
property Fact _camTriggerMode: controller.getParameterFact(-1, "TRIG_MODE")
property Fact _camTriggerInterface: controller.getParameterFact(-1, "TRIG_INTERFACE", false)
property Fact _camTriggerPol: controller.getParameterFact(-1, "TRIG_POLARITY", false) // Don't bitch about missing as these only exist if trigger mode is enabled
property Fact _auxPins: controller.getParameterFact(-1, "TRIG_PINS", false) // Ditto
function clearAuxArray() {
for(var i = 0; i < 6; i++) {
_auxChannels[i] = 0
}
}
property bool _rebooting: false
property var _auxChannels: [ 0, 0, 0, 0, 0, 0]
function setAuxPins() {
if(_auxPins) {
var values = ""
for(var i = 0; i < 6; i++) {
if(_auxChannels[i]) {
values += ((i+1).toString())
function clearAuxArray() {
for(var i = 0; i < 6; i++) {
_auxChannels[i] = 0
}
}
_auxPins.value = parseInt(values)
}
}
Component.onCompleted: {
if(_auxPins) {
clearAuxArray()
var values = _auxPins.value.toString()
for(var i = 0; i < values.length; i++) {
var b = parseInt(values[i]) - 1
if(b >= 0 && b < 6) {
_auxChannels[b] = 1
function setAuxPins() {
if(_auxPins) {
var values = ""
for(var i = 0; i < 6; i++) {
if(_auxChannels[i]) {
values += ((i+1).toString())
}
}
_auxPins.value = parseInt(values)
}
}
}
}
QGCViewPanel {
id: panel
anchors.fill: parent
Item {
id: applyAndRestart
visible: false
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 10
anchors.rightMargin: ScreenTools.defaultFontPixelWidth * 10
height: applyButton.height
QGCLabel {
anchors.left: parent.left
text: qsTr("Vehicle must be restarted for changes to take effect. ")
Component.onCompleted: {
if(_auxPins) {
clearAuxArray()
var values = _auxPins.value.toString()
for(var i = 0; i < values.length; i++) {
var b = parseInt(values[i]) - 1
if(b >= 0 && b < 6) {
_auxChannels[b] = 1
}
}
}
}
QGCButton {
id: applyButton
anchors.right: parent.right
text: qsTr("Apply and Restart")
onClicked: {
//-- This will reboot the vehicle! We're set not to allow changes if armed.
QGroundControl.multiVehicleManager.activeVehicle.rebootVehicle()
applyAndRestart.visible = false
_rebooting = true
Item {
id: applyAndRestart
visible: false
anchors.left: parent.left
anchors.right: parent.right
anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 10
anchors.rightMargin: ScreenTools.defaultFontPixelWidth * 10
height: applyButton.height
QGCLabel {
anchors.left: parent.left
text: qsTr("Vehicle must be restarted for changes to take effect. ")
}
QGCButton {
id: applyButton
anchors.right: parent.right
text: qsTr("Apply and Restart")
onClicked: {
//-- This will reboot the vehicle! We're set not to allow changes if armed.
QGroundControl.multiVehicleManager.activeVehicle.rebootVehicle()
applyAndRestart.visible = false
_rebooting = true
}
}
}
}
QGCFlickable {
clip: true
anchors.top: applyAndRestart.visible ? applyAndRestart.bottom : parent.top
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
contentHeight: mainCol.height
flickableDirection: Flickable.VerticalFlick
Column {
id: mainCol
spacing: _margins
......@@ -123,7 +114,7 @@ QGCView {
}
Rectangle {
id: camTrigRect
color: palette.windowShade
color: qgcPal.windowShade
width: camTrigRow.width + _margins * 2
height: camTrigRow.height + _margins * 2
Row {
......@@ -132,7 +123,7 @@ QGCView {
anchors.verticalCenter: parent.verticalCenter
Item { width: _margins * 0.5; height: 1; }
QGCColoredImage {
color: palette.text
color: qgcPal.text
height: ScreenTools.defaultFontPixelWidth * 10
width: ScreenTools.defaultFontPixelWidth * 20
sourceSize.width: width
......@@ -185,7 +176,7 @@ QGCView {
text: qsTr("Time Interval")
width: _middleRowWidth
anchors.baseline: timeIntervalField.baseline
color: palette.text
color: qgcPal.text
}
FactTextField {
id: timeIntervalField
......@@ -200,7 +191,7 @@ QGCView {
text: qsTr("Distance Interval")
width: _middleRowWidth
anchors.baseline: trigDistField.baseline
color: palette.text
color: qgcPal.text
}
FactTextField {
id: trigDistField
......@@ -223,7 +214,7 @@ QGCView {
visible: _auxPins
}
Rectangle {
color: palette.windowShade
color: qgcPal.windowShade
width: camTrigRect.width
height: camHardwareRow.height + _margins * 2
visible: _auxPins
......@@ -251,31 +242,31 @@ QGCView {
spacing: ScreenTools.defaultFontPixelWidth * 0.5
QGCLabel {
text: model.index + 1
color: palette.text
color: qgcPal.text
anchors.horizontalCenter: parent.horizontalCenter
}
Rectangle {
id: auxPin
width: ScreenTools.defaultFontPixelWidth * 2
height: ScreenTools.defaultFontPixelWidth * 2
border.color: palette.text
border.color: qgcPal.text
color: {
if(_auxPins) {
var pins = _auxPins.value.toString()
var pin = (model.index + 1).toString()
if(pins.indexOf(pin) < 0)
return palette.windowShadeDark
return qgcPal.windowShadeDark
else
return "green"
} else {
return palette.windowShade
return qgcPal.windowShade
}
}
MouseArea {
anchors.fill: parent
onClicked: {
_auxChannels[model.index] = 1 - _auxChannels[model.index]
auxPin.color = _auxChannels[model.index] ? "green" : palette.windowShadeDark
auxPin.color = _auxChannels[model.index] ? "green" : qgcPal.windowShadeDark
setAuxPins()
}
}
......@@ -327,7 +318,7 @@ QGCView {
text: qsTr("Trigger Period")
width: _middleRowWidth
anchors.baseline: trigPeriodField.baseline
color: palette.text
color: qgcPal.text
}
FactTextField {
id: trigPeriodField
......@@ -343,4 +334,3 @@ QGCView {
}
}
}
......@@ -33,9 +33,7 @@ QString FlightModesComponent::name(void) const
QString FlightModesComponent::description(void) const
{
// FIXME: Better text
return tr("The Flight Modes Component is used to set the switches associated with Flight Modes. "
"At a minimum the Main Mode Switch must be assigned prior to flight.");
return tr("Flight Modes Setup is used to configure the transmitter switches associated with Flight Modes.");
}
QString FlightModesComponent::iconResource(void) const
......
......@@ -91,8 +91,6 @@ Item {
readonly property real modeSpacing: ScreenTools.defaultFontPixelHeight / 3
QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled }
PX4AdvancedFlightModesController {
id: controller
factPanel: qgcViewPanel
......
......@@ -23,33 +23,31 @@ import QGroundControl.ScreenTools 1.0
/// PX4 Flight Mode configuration. This control will load either the Simple or Advanced Flight Mode config
/// based on current parameter settings.
QGCView {
id: rootQGCView
viewPanel: panel
SetupPage {
id: flightModesPage
pageComponent: pageComponent
property Fact _nullFact
property bool _rcMapFltmodeExists: controller.parameterExists(-1, "RC_MAP_FLTMODE")
property Fact _rcMapFltmode: _rcMapFltmodeExists ? controller.getParameterFact(-1, "RC_MAP_FLTMODE") : _nullFact
property Fact _rcMapModeSw: controller.getParameterFact(-1, "RC_MAP_MODE_SW")
property bool _simpleMode: _rcMapFltmodeExists ? _rcMapFltmode.value > 0 || _rcMapModeSw.value == 0 : false
QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled }
FactPanelController {
id: controller
factPanel: panel
}
QGCViewPanel {
id: panel
anchors.fill: parent
Component {
id: pageComponent
Loader {
anchors.fill: parent
source: _simpleMode ? "qrc:/qml/PX4SimpleFlightModes.qml" : "qrc:/qml/PX4AdvancedFlightModes.qml"
property var qgcView: rootQGCView
property var qgcViewPanel: panel
width: availableWidth
height: availableHeight
source: _simpleMode ? "qrc:/qml/PX4SimpleFlightModes.qml" : "qrc:/qml/PX4AdvancedFlightModes.qml"
property Fact _nullFact
property bool _rcMapFltmodeExists: controller.parameterExists(-1, "RC_MAP_FLTMODE")
property Fact _rcMapFltmode: _rcMapFltmodeExists ? controller.getParameterFact(-1, "RC_MAP_FLTMODE") : _nullFact
property Fact _rcMapModeSw: controller.getParameterFact(-1, "RC_MAP_MODE_SW")
property bool _simpleMode: _rcMapFltmodeExists ? _rcMapFltmode.value > 0 || _rcMapModeSw.value == 0 : false
FactPanelController {
id: controller
factPanel: flightModesPage.viewPanel
}
property var qgcView: flightModesPage
property var qgcViewPanel: flightModesPage.viewPanel
}
} // QGCViewPanel
} // QGCView
}
}
......@@ -24,9 +24,8 @@ QString PX4RadioComponent::name(void) const
QString PX4RadioComponent::description(void) const
{
return tr("The Radio Component is used to setup which channels on your RC Transmitter you will use for each vehicle control such as Roll, Pitch, Yaw and Throttle. "
"It also allows you to assign switches and dials to the various flight modes. "
"Prior to flight you must also calibrate the extents for all of your channels.");
return tr("Radio Setup is used to calibrate your transmitter. "
"It also assign channels for Roll, Pitch, Yaw and Throttle vehicle control as well as determining whether they are reversed.");
}
QString PX4RadioComponent::iconResource(void) const
......
......@@ -30,8 +30,6 @@ Item {
readonly property real _flightModeComboWidth: ScreenTools.defaultFontPixelWidth * 13
readonly property real _channelComboWidth: ScreenTools.defaultFontPixelWidth * 13
QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled }
PX4SimpleFlightModesController {
id: controller
factPanel: qgcViewPanel
......
......@@ -25,7 +25,7 @@ QString PX4TuningComponent::name(void) const
QString PX4TuningComponent::description(void) const
{
return tr("The Tuning Component is used to tune the flight characteristics of the Vehicle.");
return tr("Tuning Setup is used to tune the flight characteristics of the Vehicle.");
}
QString PX4TuningComponent::iconResource(void) const
......
......@@ -13,63 +13,72 @@ import QtQuick.Controls 1.4
import QGroundControl.Controls 1.0
FactSliderPanel {
anchors.fill: parent
panelTitle: "Tuning"
SetupPage {
id: tuningPage
pageComponent: pageComponent
sliderModel: ListModel {
ListElement {
title: qsTr("Hover Throttle")
description: qsTr("Adjust throttle so hover is at mid-throttle. Slide to the left if hover is lower than throttle center. Slide to the right if hover is higher than throttle center.")
param: "MPC_THR_HOVER"
min: 20
max: 80
step: 1
}
Component {
id: pageComponent
ListElement {
title: qsTr("Manual minimum throttle")
description: qsTr("Slide to the left to start the motors with less idle power. Slide to the right if descending in manual flight becomes unstable.")
param: "MPC_MANTHR_MIN"
min: 0
max: 15
step: 1
}
FactSliderPanel {
width: availableWidth
qgcViewPanel: tuningPage.viewPanel
ListElement {
title: qsTr("Roll sensitivity")
description: qsTr("Slide to the left to make roll control faster and more accurate. Slide to the right if roll oscillates or is too twitchy.")
param: "MC_ROLL_TC"
min: 0.15
max: 0.25
step: 0.01
}
sliderModel: ListModel {
ListElement {
title: qsTr("Hover Throttle")
description: qsTr("Adjust throttle so hover is at mid-throttle. Slide to the left if hover is lower than throttle center. Slide to the right if hover is higher than throttle center.")
param: "MPC_THR_HOVER"
min: 20
max: 80
step: 1
}
ListElement {
title: qsTr("Pitch sensitivity")
description: qsTr("Slide to the left to make pitch control faster and more accurate. Slide to the right if pitch oscillates or is too twitchy.")
param: "MC_PITCH_TC"
min: 0.15
max: 0.25
step: 0.01
}
ListElement {
title: qsTr("Manual minimum throttle")
description: qsTr("Slide to the left to start the motors with less idle power. Slide to the right if descending in manual flight becomes unstable.")
param: "MPC_MANTHR_MIN"
min: 0
max: 15
step: 1
}
ListElement {
title: qsTr("Altitude control sensitivity")
description: qsTr("Slide to the left to make altitude control smoother and less twitchy. Slide to the right to make altitude control more accurate and more aggressive.")
param: "MPC_Z_FF"
min: 0
max: 1.0
step: 0.1
}
ListElement {
title: qsTr("Roll sensitivity")
description: qsTr("Slide to the left to make roll control faster and more accurate. Slide to the right if roll oscillates or is too twitchy.")
param: "MC_ROLL_TC"
min: 0.15
max: 0.25
step: 0.01
}
ListElement {
title: qsTr("Pitch sensitivity")
description: qsTr("Slide to the left to make pitch control faster and more accurate. Slide to the right if pitch oscillates or is too twitchy.")
param: "MC_PITCH_TC"
min: 0.15
max: 0.25
step: 0.01
}
ListElement {
title: qsTr("Altitude control sensitivity")
description: qsTr("Slide to the left to make altitude control smoother and less twitchy. Slide to the right to make altitude control more accurate and more aggressive.")
param: "MPC_Z_FF"
min: 0
max: 1.0
step: 0.1
}
ListElement {
title: qsTr("Position control sensitivity")
description: qsTr("Slide to the left to make flight in position control mode smoother and less twitchy. Slide to the right to make position control more accurate and more aggressive.")
param: "MPC_XY_FF"
min: 0
max: 1.0
step: 0.1
ListElement {
title: qsTr("Position control sensitivity")
description: qsTr("Slide to the left to make flight in position control mode smoother and less twitchy. Slide to the right to make position control more accurate and more aggressive.")
param: "MPC_XY_FF"
min: 0
max: 1.0
step: 0.1
}
}
}
}
}
} // Component
} // SetupPage
......@@ -13,44 +13,54 @@ import QtQuick.Controls 1.4
import QGroundControl.Controls 1.0
FactSliderPanel {
anchors.fill: parent
sliderModel: ListModel {
ListElement {
title: "Roll sensitivity"
description: "Slide to the left to make roll control faster and more accurate. Slide to the right if roll oscillates or is too twitchy."
param: "FW_R_TC"
min: 0.2
max: 0.8
step: 0.01
}
SetupPage {
id: tuningPage
pageComponent: pageComponent
ListElement {
title: "Pitch sensitivity"
description: "Slide to the left to make pitch control faster and more accurate. Slide to the right if pitch oscillates or is too twitchy."
param: "FW_P_TC"
min: 0.2
max: 0.8
step: 0.01
}
Component {
id: pageComponent
ListElement {
title: "Cruise throttle"
description: "This is the throttle setting required to achieve the desired cruise speed. Most planes need 50-60%."
param: "FW_THR_CRUISE"
min: 20
max: 80
step: 1
}
FactSliderPanel {
width: availableWidth
qgcViewPanel: tuningPage.viewPanel
sliderModel: ListModel {
ListElement {
title: "Roll sensitivity"
description: "Slide to the left to make roll control faster and more accurate. Slide to the right if roll oscillates or is too twitchy."
param: "FW_R_TC"
min: 0.2
max: 0.8
step: 0.01
}
ListElement {
title: "Pitch sensitivity"
description: "Slide to the left to make pitch control faster and more accurate. Slide to the right if pitch oscillates or is too twitchy."
param: "FW_P_TC"
min: 0.2
max: 0.8
step: 0.01
}
ListElement {
title: "Cruise throttle"
description: "This is the throttle setting required to achieve the desired cruise speed. Most planes need 50-60%."
param: "FW_THR_CRUISE"
min: 20
max: 80
step: 1
}
ListElement {
title: "Mission mode sensitivity"
description: "Slide to the left to make position control more accurate and more aggressive. Slide to the right to make flight in mission mode smoother and less twitchy."
param: "FW_L1_PERIOD"
min: 12
max: 50
step: 0.5
ListElement {
title: "Mission mode sensitivity"
description: "Slide to the left to make position control more accurate and more aggressive. Slide to the right to make flight in mission mode smoother and less twitchy."
param: "FW_L1_PERIOD"
min: 12
max: 50
step: 0.5
}
}
}
}
}
......@@ -13,98 +13,108 @@ import QtQuick.Controls 1.4
import QGroundControl.Controls 1.0
FactSliderPanel {
anchors.fill: parent
sliderModel: ListModel {
ListElement {
title: qsTr("Hover Roll sensitivity")
description: qsTr("Slide to the left to make roll control during hover faster and more accurate. Slide to the right if roll oscillates or is too twitchy.")
param: "MC_ROLL_TC"
min: 0.15
max: 0.25
step: 0.01
}
SetupPage {
id: tuningPage
pageComponent: pageComponent
ListElement {
title: qsTr("Hover Pitch sensitivity")
description: qsTr("Slide to the left to make pitch control during hover faster and more accurate. Slide to the right if pitch oscillates or is too twitchy.")
param: "MC_PITCH_TC"
min: 0.15
max: 0.25
step: 0.01
}
Component {
id: pageComponent
ListElement {
title: qsTr("Hover Altitude control sensitivity")
description: qsTr("Slide to the left to make altitude control during hover smoother and less twitchy. Slide to the right to make altitude control more accurate and more aggressive.")
param: "MPC_Z_FF"
min: 0
max: 1.0
step: 0.1
}
FactSliderPanel {
width: availableWidth
qgcViewPanel: tuningPage.viewPanel
ListElement {
title: qsTr("Hover Position control sensitivity")
description: qsTr("Slide to the left to make flight during hover in position control mode smoother and less twitchy. Slide to the right to make position control more accurate and more aggressive.")
param: "MPC_XY_FF"
min: 0
max: 1.0
step: 0.1
}
ListElement {
title: qsTr("Plane Roll sensitivity")
description: qsTr("Slide to the left to make roll control faster and more accurate. Slide to the right if roll oscillates or is too twitchy.")
param: "FW_R_TC"
min: 0.2
max: 0.8
step: 0.01
}
sliderModel: ListModel {
ListElement {
title: qsTr("Plane Pitch sensitivity")
description: qsTr("Slide to the left to make pitch control faster and more accurate. Slide to the right if pitch oscillates or is too twitchy.")
param: "FW_P_TC"
min: 0.2
max: 0.8
step: 0.01
}
ListElement {
title: qsTr("Hover Roll sensitivity")
description: qsTr("Slide to the left to make roll control during hover faster and more accurate. Slide to the right if roll oscillates or is too twitchy.")
param: "MC_ROLL_TC"
min: 0.15
max: 0.25
step: 0.01
}
ListElement {
title: qsTr("Plane Cruise throttle")
description: qsTr("This is the throttle setting required to achieve the desired cruise speed. Most planes need 50-60%.")
param: "FW_THR_CRUISE"
min: 20
max: 80
step: 1
}
ListElement {
title: qsTr("Hover Pitch sensitivity")
description: qsTr("Slide to the left to make pitch control during hover faster and more accurate. Slide to the right if pitch oscillates or is too twitchy.")
param: "MC_PITCH_TC"
min: 0.15
max: 0.25
step: 0.01
}
ListElement {
title: qsTr("Hover Throttle")
description: qsTr("Adjust throttle so hover is at mid-throttle. Slide to the left if hover is lower than throttle center. Slide to the right if hover is higher than throttle center.")
param: "MPC_THR_HOVER"
min: 20
max: 80
step: 1
}
ListElement {
title: qsTr("Hover Altitude control sensitivity")
description: qsTr("Slide to the left to make altitude control during hover smoother and less twitchy. Slide to the right to make altitude control more accurate and more aggressive.")
param: "MPC_Z_FF"
min: 0
max: 1.0
step: 0.1
}
ListElement {
title: qsTr("Hoever manual minimum throttle")
description: qsTr("Slide to the left to start the motors with less idle power. Slide to the right if descending in manual flight becomes unstable.")
param: "MPC_MANTHR_MIN"
min: 0
max: 15
step: 1
}
ListElement {
title: qsTr("Hover Position control sensitivity")
description: qsTr("Slide to the left to make flight during hover in position control mode smoother and less twitchy. Slide to the right to make position control more accurate and more aggressive.")
param: "MPC_XY_FF"
min: 0
max: 1.0
step: 0.1
}
ListElement {
title: qsTr("Plane Roll sensitivity")
description: qsTr("Slide to the left to make roll control faster and more accurate. Slide to the right if roll oscillates or is too twitchy.")
param: "FW_R_TC"
min: 0.2
max: 0.8
step: 0.01
}
ListElement {
title: qsTr("Plane Pitch sensitivity")
description: qsTr("Slide to the left to make pitch control faster and more accurate. Slide to the right if pitch oscillates or is too twitchy.")
param: "FW_P_TC"
min: 0.2
max: 0.8
step: 0.01
}
ListElement {
title: qsTr("Plane Cruise throttle")
description: qsTr("This is the throttle setting required to achieve the desired cruise speed. Most planes need 50-60%.")
param: "FW_THR_CRUISE"
min: 20
max: 80
step: 1
}
ListElement {
title: qsTr("Hover Throttle")
description: qsTr("Adjust throttle so hover is at mid-throttle. Slide to the left if hover is lower than throttle center. Slide to the right if hover is higher than throttle center.")
param: "MPC_THR_HOVER"
min: 20
max: 80
step: 1
}
ListElement {
title: qsTr("Hoever manual minimum throttle")
description: qsTr("Slide to the left to start the motors with less idle power. Slide to the right if descending in manual flight becomes unstable.")
param: "MPC_MANTHR_MIN"
min: 0
max: 15
step: 1
}
ListElement {
title: qsTr("Plane Mission mode sensitivity")
description: qsTr("Slide to the left to make position control more accurate and more aggressive. Slide to the right to make flight in mission mode smoother and less twitchy.")
param: "FW_L1_PERIOD"
min: 12
max: 50
step: 0.5
ListElement {
title: qsTr("Plane Mission mode sensitivity")
description: qsTr("Slide to the left to make position control more accurate and more aggressive. Slide to the right to make flight in mission mode smoother and less twitchy.")
param: "FW_L1_PERIOD"
min: 12
max: 50
step: 0.5
}
}
}
}
}
......@@ -28,7 +28,7 @@ QString PowerComponent::name(void) const
QString PowerComponent::description(void) const
{
return tr("The Power Component is used to setup battery parameters as well as advanced settings for propellers and magnetometer.");
return tr("Power Setup is used to setup battery parameters as well as advanced settings for propellers.");
}
QString PowerComponent::iconResource(void) const
......
......@@ -19,546 +19,535 @@ import QtQuick.Layouts 1.2
import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
import QGroundControl.Palette 1.0
import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Controllers 1.0
QGCView {
id: rootQGCView
viewPanel: panel
property int textEditWidth: ScreenTools.defaultFontPixelWidth * 8
property Fact battNumCells: controller.getParameterFact(-1, "BAT_N_CELLS")
property Fact battHighVolt: controller.getParameterFact(-1, "BAT_V_CHARGED")
property Fact battLowVolt: controller.getParameterFact(-1, "BAT_V_EMPTY")
property Fact battVoltLoadDrop: controller.getParameterFact(-1, "BAT_V_LOAD_DROP")
property Fact battVoltageDivider: controller.getParameterFact(-1, "BAT_V_DIV")
property Fact battAmpsPerVolt: controller.getParameterFact(-1, "BAT_A_PER_V")
property Fact uavcanEnable: controller.getParameterFact(-1, "UAVCAN_ENABLE", false)
readonly property string highlightPrefix: "<font color=\"" + qgcPal.warningText + "\">"
readonly property string highlightSuffix: "</font>"
function getBatteryImage()
{
switch(battNumCells.value) {
case 1: return "/qmlimages/PowerComponentBattery_01cell.svg";
case 2: return "/qmlimages/PowerComponentBattery_02cell.svg"
case 3: return "/qmlimages/PowerComponentBattery_03cell.svg"
case 4: return "/qmlimages/PowerComponentBattery_04cell.svg"
case 5: return "/qmlimages/PowerComponentBattery_05cell.svg"
case 6: return "/qmlimages/PowerComponentBattery_06cell.svg"
default: return "/qmlimages/PowerComponentBattery_01cell.svg";
}
}
function drawArrowhead(ctx, x, y, radians)
{
ctx.save();
ctx.beginPath();
ctx.translate(x,y);
ctx.rotate(radians);
ctx.moveTo(0,0);
ctx.lineTo(5,10);
ctx.lineTo(-5,10);
ctx.closePath();
ctx.restore();
ctx.fill();
}
function drawLineWithArrow(ctx, x1, y1, x2, y2)
{
ctx.beginPath();
ctx.moveTo(x1, y1);
ctx.lineTo(x2, y2);
ctx.stroke();
var rd = Math.atan((y2 - y1) / (x2 - x1));
rd += ((x2 > x1) ? 90 : -90) * Math.PI/180;
drawArrowhead(ctx, x2, y2, rd);
}
PowerComponentController {
id: controller
factPanel: panel
onOldFirmware: showMessage(qsTr("ESC Calibration"), qsTr("QGroundControl cannot perform ESC Calibration with this version of firmware. You will need to upgrade to a newer firmware."), StandardButton.Ok)
onNewerFirmware: showMessage(qsTr("ESC Calibration"), qsTr("QGroundControl cannot perform ESC Calibration with this version of firmware. You will need to upgrade QGroundControl."), StandardButton.Ok)
onBatteryConnected: showMessage(qsTr("ESC Calibration"), qsTr("Performing calibration. This will take a few seconds.."), 0)
onCalibrationFailed: showMessage(qsTr("ESC Calibration failed"), errorMessage, StandardButton.Ok)
onCalibrationSuccess: showMessage(qsTr("ESC Calibration"), qsTr("Calibration complete. You can disconnect your battery now if you like."), StandardButton.Ok)
onConnectBattery: showMessage(qsTr("ESC Calibration"), highlightPrefix + qsTr("WARNING: Props must be removed from vehicle prior to performing ESC calibration.") + highlightSuffix + qsTr(" Connect the battery now and calibration will begin."), 0)
onDisconnectBattery: showMessage(qsTr("ESC Calibration failed"), qsTr("You must disconnect the battery prior to performing ESC Calibration. Disconnect your battery and try again."), StandardButton.Ok)
}
QGCPalette { id: palette; colorGroupEnabled: panel.enabled }
SetupPage {
id: powerPage
pageComponent: pageComponent
Component {
id: calcVoltageDividerDlgComponent
id: pageComponent
Column {
id: innerColumn
width: availableWidth
spacing: ScreenTools.defaultFontPixelHeight * 0.5
property int textEditWidth: ScreenTools.defaultFontPixelWidth * 8
property Fact battNumCells: controller.getParameterFact(-1, "BAT_N_CELLS")
property Fact battHighVolt: controller.getParameterFact(-1, "BAT_V_CHARGED")
property Fact battLowVolt: controller.getParameterFact(-1, "BAT_V_EMPTY")
property Fact battVoltLoadDrop: controller.getParameterFact(-1, "BAT_V_LOAD_DROP")
property Fact battVoltageDivider: controller.getParameterFact(-1, "BAT_V_DIV")
property Fact battAmpsPerVolt: controller.getParameterFact(-1, "BAT_A_PER_V")
property Fact uavcanEnable: controller.getParameterFact(-1, "UAVCAN_ENABLE", false)
readonly property string highlightPrefix: "<font color=\"" + qgcPal.warningText + "\">"
readonly property string highlightSuffix: "</font>"
function getBatteryImage()
{
switch(battNumCells.value) {
case 1: return "/qmlimages/PowerComponentBattery_01cell.svg";
case 2: return "/qmlimages/PowerComponentBattery_02cell.svg"
case 3: return "/qmlimages/PowerComponentBattery_03cell.svg"
case 4: return "/qmlimages/PowerComponentBattery_04cell.svg"
case 5: return "/qmlimages/PowerComponentBattery_05cell.svg"
case 6: return "/qmlimages/PowerComponentBattery_06cell.svg"
default: return "/qmlimages/PowerComponentBattery_01cell.svg";
}
}
function drawArrowhead(ctx, x, y, radians)
{
ctx.save();
ctx.beginPath();
ctx.translate(x,y);
ctx.rotate(radians);
ctx.moveTo(0,0);
ctx.lineTo(5,10);
ctx.lineTo(-5,10);
ctx.closePath();
ctx.restore();
ctx.fill();
}
function drawLineWithArrow(ctx, x1, y1, x2, y2)
{
ctx.beginPath();
ctx.moveTo(x1, y1);
ctx.lineTo(x2, y2);
ctx.stroke();
var rd = Math.atan((y2 - y1) / (x2 - x1));
rd += ((x2 > x1) ? 90 : -90) * Math.PI/180;
drawArrowhead(ctx, x2, y2, rd);
}
PowerComponentController {
id: controller
factPanel: powerPage.viewPanel
onOldFirmware: showMessage(qsTr("ESC Calibration"), qsTr("QGroundControl cannot perform ESC Calibration with this version of firmware. You will need to upgrade to a newer firmware."), StandardButton.Ok)
onNewerFirmware: showMessage(qsTr("ESC Calibration"), qsTr("QGroundControl cannot perform ESC Calibration with this version of firmware. You will need to upgrade QGroundControl."), StandardButton.Ok)
onBatteryConnected: showMessage(qsTr("ESC Calibration"), qsTr("Performing calibration. This will take a few seconds.."), 0)
onCalibrationFailed: showMessage(qsTr("ESC Calibration failed"), errorMessage, StandardButton.Ok)
onCalibrationSuccess: showMessage(qsTr("ESC Calibration"), qsTr("Calibration complete. You can disconnect your battery now if you like."), StandardButton.Ok)
onConnectBattery: showMessage(qsTr("ESC Calibration"), highlightPrefix + qsTr("WARNING: Props must be removed from vehicle prior to performing ESC calibration.") + highlightSuffix + qsTr(" Connect the battery now and calibration will begin."), 0)
onDisconnectBattery: showMessage(qsTr("ESC Calibration failed"), qsTr("You must disconnect the battery prior to performing ESC Calibration. Disconnect your battery and try again."), StandardButton.Ok)
}
Component {
id: calcVoltageDividerDlgComponent
QGCViewDialog {
id: calcVoltageDividerDlg
QGCFlickable {
anchors.fill: parent
contentHeight: column.height
contentWidth: column.width
Column {
id: column
width: calcVoltageDividerDlg.width
spacing: ScreenTools.defaultFontPixelHeight
QGCViewDialog {
id: calcVoltageDividerDlg
QGCLabel {
width: parent.width
wrapMode: Text.WordWrap
text: "Measure battery voltage using an external voltmeter and enter the value below. Click Calculate to set the new voltage multiplier."
}
QGCFlickable {
anchors.fill: parent
contentHeight: column.height
contentWidth: column.width
Grid {
columns: 2
spacing: ScreenTools.defaultFontPixelHeight / 2
verticalItemAlignment: Grid.AlignVCenter
Column {
id: column
width: calcVoltageDividerDlg.width
spacing: ScreenTools.defaultFontPixelHeight
QGCLabel {
text: "Measured voltage:"
}
QGCTextField { id: measuredVoltage }
QGCLabel {
width: parent.width
wrapMode: Text.WordWrap
text: "Measure battery voltage using an external voltmeter and enter the value below. Click Calculate to set the new voltage multiplier."
}
QGCLabel { text: "Vehicle voltage:" }
QGCLabel { text: controller.vehicle.battery.voltage.valueString }
Grid {
columns: 2
spacing: ScreenTools.defaultFontPixelHeight / 2
verticalItemAlignment: Grid.AlignVCenter
QGCLabel { text: "Voltage divider:" }
FactLabel { fact: battVoltageDivider }
}
QGCLabel {
text: "Measured voltage:"
}
QGCTextField { id: measuredVoltage }
QGCButton {
text: "Calculate"
onClicked: {
var measuredVoltageValue = parseFloat(measuredVoltage.text)
if (measuredVoltageValue == 0) {
return
}
var newVoltageDivider = (measuredVoltageValue * battVoltageDivider.value) / controller.vehicle.battery.voltage.value
if (newVoltageDivider != 0) {
battVoltageDivider.value = newVoltageDivider
}
}
}
} // Column
} // QGCFlickable
} // QGCViewDialog
} // Component - calcVoltageDividerDlgComponent
QGCLabel { text: "Vehicle voltage:" }
QGCLabel { text: controller.vehicle.battery.voltage.valueString }
Component {
id: calcAmpsPerVoltDlgComponent
QGCLabel { text: "Voltage divider:" }
FactLabel { fact: battVoltageDivider }
}
QGCViewDialog {
id: calcAmpsPerVoltDlg
QGCButton {
text: "Calculate"
QGCFlickable {
anchors.fill: parent
contentHeight: column.height
contentWidth: column.width
onClicked: {
var measuredVoltageValue = parseFloat(measuredVoltage.text)
if (measuredVoltageValue == 0) {
return
}
var newVoltageDivider = (measuredVoltageValue * battVoltageDivider.value) / controller.vehicle.battery.voltage.value
if (newVoltageDivider != 0) {
battVoltageDivider.value = newVoltageDivider
Column {
id: column
width: calcAmpsPerVoltDlg.width
spacing: ScreenTools.defaultFontPixelHeight
QGCLabel {
width: parent.width
wrapMode: Text.WordWrap
text: "Measure current draw using an external current meter and enter the value below. Click Calculate to set the new amps per volt value."
}
}
}
} // Column
} // QGCFlickable
} // QGCViewDialog
} // Component - calcVoltageDividerDlgComponent
Component {
id: calcAmpsPerVoltDlgComponent
Grid {
columns: 2
spacing: ScreenTools.defaultFontPixelHeight / 2
verticalItemAlignment: Grid.AlignVCenter
QGCViewDialog {
id: calcAmpsPerVoltDlg
QGCLabel {
text: "Measured current:"
}
QGCTextField { id: measuredCurrent }
QGCFlickable {
anchors.fill: parent
contentHeight: column.height
contentWidth: column.width
QGCLabel { text: "Vehicle current:" }
QGCLabel { text: controller.vehicle.battery.current.valueString }
Column {
id: column
width: calcAmpsPerVoltDlg.width
spacing: ScreenTools.defaultFontPixelHeight
QGCLabel { text: "Amps per volt:" }
FactLabel { fact: battAmpsPerVolt }
}
QGCButton {
text: "Calculate"
onClicked: {
var measuredCurrentValue = parseFloat(measuredCurrent.text)
if (measuredCurrentValue == 0) {
return
}
var newAmpsPerVolt = (measuredCurrentValue * battAmpsPerVolt.value) / controller.vehicle.battery.current.value
if (newAmpsPerVolt != 0) {
battAmpsPerVolt.value = newAmpsPerVolt
}
}
}
} // Column
} // QGCFlickable
} // QGCViewDialog
} // Component - calcAmpsPerVoltDlgComponent
QGCLabel {
text: qsTr("Battery")
font.family: ScreenTools.demiboldFontFamily
}
Rectangle {
width: parent.width
height: batteryGrid.height + ScreenTools.defaultFontPixelHeight
color: qgcPal.windowShade
GridLayout {
id: batteryGrid
anchors.margins: ScreenTools.defaultFontPixelHeight / 2
anchors.left: parent.left
anchors.top: parent.top
columns: 5
columnSpacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
width: parent.width
wrapMode: Text.WordWrap
text: "Measure current draw using an external current meter and enter the value below. Click Calculate to set the new amps per volt value."
text: qsTr("Number of Cells (in Series)")
}
Grid {
columns: 2
spacing: ScreenTools.defaultFontPixelHeight / 2
verticalItemAlignment: Grid.AlignVCenter
QGCLabel {
text: "Measured current:"
}
QGCTextField { id: measuredCurrent }
QGCLabel { text: "Vehicle current:" }
QGCLabel { text: controller.vehicle.battery.current.valueString }
QGCLabel { text: "Amps per volt:" }
FactLabel { fact: battAmpsPerVolt }
FactTextField {
id: cellsField
width: textEditWidth
fact: battNumCells
showUnits: true
}
QGCButton {
text: "Calculate"
onClicked: {
var measuredCurrentValue = parseFloat(measuredCurrent.text)
if (measuredCurrentValue == 0) {
return
}
var newAmpsPerVolt = (measuredCurrentValue * battAmpsPerVolt.value) / controller.vehicle.battery.current.value
if (newAmpsPerVolt != 0) {
battAmpsPerVolt.value = newAmpsPerVolt
}
}
QGCColoredImage {
id: batteryImage
Layout.rowSpan: 3
width: height * 0.75
height: 100
sourceSize.height: height
fillMode: Image.PreserveAspectFit
smooth: true
color: qgcPal.text
cache: false
source: getBatteryImage();
}
} // Column
} // QGCFlickable
} // QGCViewDialog
} // Component - calcAmpsPerVoltDlgComponent
QGCViewPanel {
id: panel
anchors.fill: parent
QGCFlickable {
anchors.fill: parent
clip: true
contentHeight: innerColumn.height
contentWidth: panel.width
flickableDirection: Flickable.VerticalFlick
Column {
id: innerColumn
width: parent.width
spacing: ScreenTools.defaultFontPixelHeight * 0.5
QGCLabel {
text: qsTr("Battery")
font.family: ScreenTools.demiboldFontFamily
}
Rectangle {
width: parent.width
height: batteryGrid.height + ScreenTools.defaultFontPixelHeight
color: palette.windowShade
Item { width: 1; height: 1; Layout.columnSpan: 2 }
GridLayout {
id: batteryGrid
anchors.margins: ScreenTools.defaultFontPixelHeight / 2
anchors.left: parent.left
anchors.top: parent.top
columns: 5
columnSpacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
id: battHighLabel
text: qsTr("Full Voltage (per cell)")
}
QGCLabel {
text: qsTr("Number of Cells (in Series)")
}
FactTextField {
id: battHighField
width: textEditWidth
fact: battHighVolt
showUnits: true
}
FactTextField {
id: cellsField
width: textEditWidth
fact: battNumCells
showUnits: true
}
QGCLabel {
text: qsTr("Battery Max:")
}
QGCColoredImage {
id: batteryImage
Layout.rowSpan: 3
width: height * 0.75
height: 100
sourceSize.height: height
fillMode: Image.PreserveAspectFit
smooth: true
color: palette.text
cache: false
source: getBatteryImage();
}
QGCLabel {
text: (battNumCells.value * battHighVolt.value).toFixed(1) + ' V'
}
Item { width: 1; height: 1; Layout.columnSpan: 2 }
QGCLabel {
id: battLowLabel
text: qsTr("Empty Voltage (per cell)")
}
QGCLabel {
id: battHighLabel
text: qsTr("Full Voltage (per cell)")
}
FactTextField {
id: battLowField
width: textEditWidth
fact: battLowVolt
showUnits: true
}
FactTextField {
id: battHighField
width: textEditWidth
fact: battHighVolt
showUnits: true
}
QGCLabel {
text: qsTr("Battery Min:")
}
QGCLabel {
text: qsTr("Battery Max:")
}
QGCLabel {
text: (battNumCells.value * battLowVolt.value).toFixed(1) + ' V'
}
QGCLabel {
text: (battNumCells.value * battHighVolt.value).toFixed(1) + ' V'
}
QGCLabel {
text: qsTr("Voltage divider")
}
QGCLabel {
id: battLowLabel
text: qsTr("Empty Voltage (per cell)")
}
FactTextField {
id: voltMultField
fact: battVoltageDivider
}
FactTextField {
id: battLowField
width: textEditWidth
fact: battLowVolt
showUnits: true
}
QGCButton {
id: voltMultCalculateButton
text: "Calculate"
onClicked: showDialog(calcVoltageDividerDlgComponent, qsTr("Calculate Voltage Divider"), powerPage.showDialogDefaultWidth, StandardButton.Close)
}
QGCLabel {
text: qsTr("Battery Min:")
}
Item { width: 1; height: 1; Layout.columnSpan: 2 }
QGCLabel {
text: (battNumCells.value * battLowVolt.value).toFixed(1) + ' V'
}
QGCLabel {
id: voltMultHelp
Layout.columnSpan: batteryGrid.columns
Layout.fillWidth: true
font.pointSize: ScreenTools.smallFontPointSize
wrapMode: Text.WordWrap
text: "If the battery voltage reported by the vehicle is largely different than the voltage read externally using a voltmeter you can adjust the voltage multiplier value to correct this. " +
"Click the Calculate button for help with calculating a new value."
}
QGCLabel {
text: qsTr("Voltage divider")
}
QGCLabel {
id: ampPerVoltLabel
text: qsTr("Amps per volt")
}
FactTextField {
id: voltMultField
fact: battVoltageDivider
}
FactTextField {
id: ampPerVoltField
fact: battAmpsPerVolt
}
QGCButton {
id: voltMultCalculateButton
text: "Calculate"
onClicked: showDialog(calcVoltageDividerDlgComponent, qsTr("Calculate Voltage Divider"), qgcView.showDialogDefaultWidth, StandardButton.Close)
}
QGCButton {
id: ampPerVoltCalculateButton
text: "Calculate"
onClicked: showDialog(calcAmpsPerVoltDlgComponent, qsTr("Calculate Amps per Volt"), powerPage.showDialogDefaultWidth, StandardButton.Close)
}
Item { width: 1; height: 1; Layout.columnSpan: 2 }
Item { width: 1; height: 1; Layout.columnSpan: 2 }
QGCLabel {
id: voltMultHelp
Layout.columnSpan: batteryGrid.columns
Layout.fillWidth: true
font.pointSize: ScreenTools.smallFontPointSize
wrapMode: Text.WordWrap
text: "If the battery voltage reported by the vehicle is largely different than the voltage read externally using a voltmeter you can adjust the voltage multiplier value to correct this. " +
"Click the Calculate button for help with calculating a new value."
}
QGCLabel {
id: ampPerVoltHelp
Layout.columnSpan: batteryGrid.columns
Layout.fillWidth: true
font.pointSize: ScreenTools.smallFontPointSize
wrapMode: Text.WordWrap
text: "If the current draw reported by the vehicle is largely different than the current read externally using a current meter you can adjust the amps per volt value to correct this. " +
"Click the Calculate button for help with calculating a new value."
}
} // Grid
} // Rectangle - Battery settings
QGCLabel {
id: ampPerVoltLabel
text: qsTr("Amps per volt")
}
QGCLabel {
text: qsTr("ESC PWM Minimum and Maximum Calibration")
font.family: ScreenTools.demiboldFontFamily
}
FactTextField {
id: ampPerVoltField
fact: battAmpsPerVolt
}
Rectangle {
width: parent.width
height: escCalColumn.height + ScreenTools.defaultFontPixelHeight
color: qgcPal.windowShade
QGCButton {
id: ampPerVoltCalculateButton
text: "Calculate"
onClicked: showDialog(calcAmpsPerVoltDlgComponent, qsTr("Calculate Amps per Volt"), qgcView.showDialogDefaultWidth, StandardButton.Close)
}
Column {
id : escCalColumn
anchors.margins: ScreenTools.defaultFontPixelHeight / 2
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
spacing: ScreenTools.defaultFontPixelWidth
Item { width: 1; height: 1; Layout.columnSpan: 2 }
QGCLabel {
width: parent.width
color: qgcPal.warningText
wrapMode: Text.WordWrap
text: qsTr("WARNING: Propellers must be removed from vehicle prior to performing ESC calibration.")
}
QGCLabel {
id: ampPerVoltHelp
Layout.columnSpan: batteryGrid.columns
Layout.fillWidth: true
font.pointSize: ScreenTools.smallFontPointSize
wrapMode: Text.WordWrap
text: "If the current draw reported by the vehicle is largely different than the current read externally using a current meter you can adjust the amps per volt value to correct this. " +
"Click the Calculate button for help with calculating a new value."
}
} // Grid
} // Rectangle - Battery settings
QGCLabel {
text: qsTr("You must use USB connection for this operation.")
}
QGCLabel {
text: qsTr("ESC PWM Minimum and Maximum Calibration")
font.family: ScreenTools.demiboldFontFamily
QGCButton {
text: qsTr("Calibrate")
width: ScreenTools.defaultFontPixelWidth * 20
onClicked: controller.calibrateEsc()
}
}
}
QGCCheckBox {
id: showUAVCAN
text: qsTr("Show UAVCAN Settings")
visible: uavcanEnable !== -1
}
QGCLabel {
text: qsTr("UAVCAN Bus Configuration")
font.family: ScreenTools.demiboldFontFamily
visible: showUAVCAN.checked
}
Rectangle {
width: parent.width
height: uavCanConfigColumn.height + ScreenTools.defaultFontPixelHeight
color: qgcPal.windowShade
visible: showUAVCAN.checked
Rectangle {
width: parent.width
height: escCalColumn.height + ScreenTools.defaultFontPixelHeight
color: palette.windowShade
Column {
id: uavCanConfigColumn
anchors.margins: ScreenTools.defaultFontPixelHeight / 2
anchors.left: parent.left
anchors.top: parent.top
spacing: ScreenTools.defaultFontPixelWidth
FactCheckBox {
id: uavcanEnabledCheckBox
width: ScreenTools.defaultFontPixelWidth * 20
fact: uavcanEnable
checkedValue: 3
uncheckedValue: 0
text: qsTr("Enable UAVCAN as the default MAIN output bus (requires autopilot restart)")
}
}
}
Column {
id : escCalColumn
anchors.margins: ScreenTools.defaultFontPixelHeight / 2
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
spacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
text: qsTr("UAVCAN Motor Index and Direction Assignment")
font.family: ScreenTools.demiboldFontFamily
visible: showUAVCAN.checked
}
QGCLabel {
width: parent.width
color: palette.warningText
wrapMode: Text.WordWrap
text: qsTr("WARNING: Propellers must be removed from vehicle prior to performing ESC calibration.")
}
Rectangle {
width: parent.width
height: uavCanEscCalColumn.height + ScreenTools.defaultFontPixelHeight
color: qgcPal.windowShade
visible: showUAVCAN.checked
enabled: uavcanEnabledCheckBox.checked
QGCLabel {
text: qsTr("You must use USB connection for this operation.")
}
Column {
id: uavCanEscCalColumn
anchors.margins: ScreenTools.defaultFontPixelHeight / 2
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
spacing: ScreenTools.defaultFontPixelWidth
QGCButton {
text: qsTr("Calibrate")
width: ScreenTools.defaultFontPixelWidth * 20
onClicked: controller.calibrateEsc()
}
QGCLabel {
width: parent.width
wrapMode: Text.WordWrap
color: qgcPal.warningText
text: qsTr("WARNING: Propellers must be removed from vehicle prior to performing UAVCAN ESC configuration.")
}
}
QGCCheckBox {
id: showUAVCAN
text: qsTr("Show UAVCAN Settings")
visible: uavcanEnable !== -1
}
QGCLabel {
width: parent.width
wrapMode: Text.WordWrap
text: qsTr("ESC parameters will only be accessible in the editor after assignment.")
}
QGCLabel {
text: qsTr("UAVCAN Bus Configuration")
font.family: ScreenTools.demiboldFontFamily
visible: showUAVCAN.checked
}
QGCLabel {
width: parent.width
wrapMode: Text.WordWrap
text: qsTr("Start the process, then turn each motor into its turn direction, in the order of their motor indices.")
}
Rectangle {
width: parent.width
height: uavCanConfigColumn.height + ScreenTools.defaultFontPixelHeight
color: palette.windowShade
visible: showUAVCAN.checked
Column {
id: uavCanConfigColumn
anchors.margins: ScreenTools.defaultFontPixelHeight / 2
anchors.left: parent.left
anchors.top: parent.top
spacing: ScreenTools.defaultFontPixelWidth
FactCheckBox {
id: uavcanEnabledCheckBox
width: ScreenTools.defaultFontPixelWidth * 20
fact: uavcanEnable
checkedValue: 3
uncheckedValue: 0
text: qsTr("Enable UAVCAN as the default MAIN output bus (requires autopilot restart)")
}
QGCButton {
text: qsTr("Start Assignment")
width: ScreenTools.defaultFontPixelWidth * 20
onClicked: controller.busConfigureActuators()
}
}
QGCLabel {
text: qsTr("UAVCAN Motor Index and Direction Assignment")
font.family: ScreenTools.demiboldFontFamily
visible: showUAVCAN.checked
QGCButton {
text: qsTr("Stop Assignment")
width: ScreenTools.defaultFontPixelWidth * 20
onClicked: controller.stopBusConfigureActuators()
}
}
}
QGCCheckBox {
id: showAdvanced
text: qsTr("Show Advanced Settings")
}
QGCLabel {
text: qsTr("Advanced Power Settings")
font.family: ScreenTools.demiboldFontFamily
visible: showAdvanced.checked
}
Rectangle {
id: batteryRectangle
width: parent.width
height: advBatteryColumn.height + ScreenTools.defaultFontPixelHeight
color: qgcPal.windowShade
visible: showAdvanced.checked
Rectangle {
width: parent.width
height: uavCanEscCalColumn.height + ScreenTools.defaultFontPixelHeight
color: palette.windowShade
visible: showUAVCAN.checked
enabled: uavcanEnabledCheckBox.checked
Column {
id: uavCanEscCalColumn
anchors.margins: ScreenTools.defaultFontPixelHeight / 2
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
spacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
width: parent.width
wrapMode: Text.WordWrap
color: palette.warningText
text: qsTr("WARNING: Propellers must be removed from vehicle prior to performing UAVCAN ESC configuration.")
}
Column {
id: advBatteryColumn
anchors.margins: ScreenTools.defaultFontPixelHeight / 2
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
spacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
width: parent.width
wrapMode: Text.WordWrap
text: qsTr("ESC parameters will only be accessible in the editor after assignment.")
}
Row {
spacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
width: parent.width
wrapMode: Text.WordWrap
text: qsTr("Start the process, then turn each motor into its turn direction, in the order of their motor indices.")
}
QGCButton {
text: qsTr("Start Assignment")
width: ScreenTools.defaultFontPixelWidth * 20
onClicked: controller.busConfigureActuators()
text: qsTr("Voltage Drop on Full Load (per cell)")
anchors.baseline: battDropField.baseline
}
QGCButton {
text: qsTr("Stop Assignment")
width: ScreenTools.defaultFontPixelWidth * 20
onClicked: controller.stopBusConfigureActuators()
FactTextField {
id: battDropField
width: textEditWidth
fact: battVoltLoadDrop
showUnits: true
}
}
}
QGCCheckBox {
id: showAdvanced
text: qsTr("Show Advanced Settings")
}
QGCLabel {
text: qsTr("Advanced Power Settings")
font.family: ScreenTools.demiboldFontFamily
visible: showAdvanced.checked
}
Rectangle {
id: batteryRectangle
width: parent.width
height: advBatteryColumn.height + ScreenTools.defaultFontPixelHeight
color: palette.windowShade
visible: showAdvanced.checked
Column {
id: advBatteryColumn
anchors.margins: ScreenTools.defaultFontPixelHeight / 2
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
spacing: ScreenTools.defaultFontPixelWidth
Row {
spacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
text: qsTr("Voltage Drop on Full Load (per cell)")
anchors.baseline: battDropField.baseline
}
QGCLabel {
width: parent.width
wrapMode: Text.WordWrap
text: qsTr("Batteries show less voltage at high throttle. Enter the difference in Volts between idle throttle and full ") +
qsTr("throttle, divided by the number of battery cells. Leave at the default if unsure. ") +
highlightPrefix + qsTr("If this value is set too high, the battery might be deep discharged and damaged.") + highlightSuffix
}
FactTextField {
id: battDropField
width: textEditWidth
fact: battVoltLoadDrop
showUnits: true
}
}
Row {
spacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
width: parent.width
wrapMode: Text.WordWrap
text: qsTr("Batteries show less voltage at high throttle. Enter the difference in Volts between idle throttle and full ") +
qsTr("throttle, divided by the number of battery cells. Leave at the default if unsure. ") +
highlightPrefix + qsTr("If this value is set too high, the battery might be deep discharged and damaged.") + highlightSuffix
text: qsTr("Compensated Minimum Voltage:")
}
Row {
spacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
text: qsTr("Compensated Minimum Voltage:")
}
QGCLabel {
text: ((battNumCells.value * battLowVolt.value) - (battNumCells.value * battVoltLoadDrop.value)).toFixed(1) + qsTr(" V")
}
QGCLabel {
text: ((battNumCells.value * battLowVolt.value) - (battNumCells.value * battVoltLoadDrop.value)).toFixed(1) + qsTr(" V")
}
}
} // Rectangle - Advanced power settings
} // Column
} // QGCFlickable
} // QGCViewPanel
} // QGCView
}
} // Rectangle - Advanced power settings
} // Column
} // Component
} // SetupPage
......@@ -27,7 +27,7 @@ QString SafetyComponent::name(void) const
QString SafetyComponent::description(void) const
{
return tr("The Safety Component is used to setup triggers for Return to Land as well as the settings for Return to Land itself.");
return tr("Safety Setup is used to setup triggers for Return to Land as well as the settings for Return to Land itself.");
}
QString SafetyComponent::iconResource(void) const
......
......@@ -16,48 +16,47 @@ import QtGraphicalEffects 1.0
import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
import QGroundControl.Palette 1.0
import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0
QGCView {
id: _safetyView
viewPanel: panel
anchors.fill: parent
SetupPage {
id: safetyPage
pageComponent: pageComponent
FactPanelController { id: controller; factPanel: panel }
Component {
id: pageComponent
QGCPalette { id: palette; colorGroupEnabled: enabled }
Item {
width: Math.max(availableWidth, mainCol.width)
height: mainCol.height
property real _margins: ScreenTools.defaultFontPixelHeight
property real _middleRowWidth: ScreenTools.defaultFontPixelWidth * 20
property real _editFieldWidth: ScreenTools.defaultFontPixelWidth * 14
FactPanelController {
id: controller
factPanel: safetyPage.viewPanel
}
property real _margins: ScreenTools.defaultFontPixelHeight
property real _middleRowWidth: ScreenTools.defaultFontPixelWidth * 20
property real _editFieldWidth: ScreenTools.defaultFontPixelWidth * 14
property Fact _fenceAction: controller.getParameterFact(-1, "GF_ACTION")
property Fact _fenceRadius: controller.getParameterFact(-1, "GF_MAX_HOR_DIST")
property Fact _fenceAlt: controller.getParameterFact(-1, "GF_MAX_VER_DIST")
property Fact _rtlLandDelay: controller.getParameterFact(-1, "RTL_LAND_DELAY")
property Fact _lowBattAction: controller.getParameterFact(-1, "COM_LOW_BAT_ACT")
property Fact _rcLossAction: controller.getParameterFact(-1, "NAV_RCL_ACT")
property Fact _dlLossAction: controller.getParameterFact(-1, "NAV_DLL_ACT")
property Fact _disarmLandDelay: controller.getParameterFact(-1, "COM_DISARM_LAND")
property Fact _landSpeedMC: controller.getParameterFact(-1, "MPC_LAND_SPEED", false)
property Fact _fenceAction: controller.getParameterFact(-1, "GF_ACTION")
property Fact _fenceRadius: controller.getParameterFact(-1, "GF_MAX_HOR_DIST")
property Fact _fenceAlt: controller.getParameterFact(-1, "GF_MAX_VER_DIST")
property Fact _rtlLandDelay: controller.getParameterFact(-1, "RTL_LAND_DELAY")
property Fact _lowBattAction: controller.getParameterFact(-1, "COM_LOW_BAT_ACT")
property Fact _rcLossAction: controller.getParameterFact(-1, "NAV_RCL_ACT")
property Fact _dlLossAction: controller.getParameterFact(-1, "NAV_DLL_ACT")
property Fact _disarmLandDelay: controller.getParameterFact(-1, "COM_DISARM_LAND")
property Fact _landSpeedMC: controller.getParameterFact(-1, "MPC_LAND_SPEED", false)
property bool _showIcons: !ScreenTools.isTinyScreen
property bool _showIcons: !ScreenTools.isTinyScreen
QGCViewPanel {
id: panel
anchors.fill: parent
QGCFlickable {
clip: true
anchors.fill: parent
contentHeight: mainCol.height
flickableDirection: Flickable.VerticalFlick
Column {
id: mainCol
spacing: _margins
anchors.horizontalCenter: parent.horizontalCenter
/*
**** Low Battery ****
*/
......@@ -67,7 +66,7 @@ QGCView {
font.family: ScreenTools.demiboldFontFamily
}
Rectangle {
color: palette.windowShade
color: qgcPal.windowShade
width: rtlSettings.width
height: lowBattRow.height + _margins * 2
Row {
......@@ -81,7 +80,7 @@ QGCView {
sourceSize.width: width
mipmap: true
fillMode: Image.PreserveAspectFit
source: qgcPal.globalTheme === QGCPalette.Light ? "/qmlimages/LowBatteryLight.svg" : "/qmlimages/LowBattery.svg"
source: qgcPal.globalTheme === qgcPal.Light ? "/qmlimages/LowBatteryLight.svg" : "/qmlimages/LowBattery.svg"
anchors.verticalCenter: parent.verticalCenter
visible: _showIcons
}
......@@ -143,7 +142,7 @@ QGCView {
font.family: ScreenTools.demiboldFontFamily
}
Rectangle {
color: palette.windowShade
color: qgcPal.windowShade
width: rtlSettings.width
height: rcLossRow.height + _margins * 2
Row {
......@@ -157,7 +156,7 @@ QGCView {
sourceSize.width: width
mipmap: true
fillMode: Image.PreserveAspectFit
source: qgcPal.globalTheme === QGCPalette.Light ? "/qmlimages/RCLossLight.svg" : "/qmlimages/RCLoss.svg"
source: qgcPal.globalTheme === qgcPal.Light ? "/qmlimages/RCLossLight.svg" : "/qmlimages/RCLoss.svg"
anchors.verticalCenter: parent.verticalCenter
visible: _showIcons
}
......@@ -206,7 +205,7 @@ QGCView {
font.family: ScreenTools.demiboldFontFamily
}
Rectangle {
color: palette.windowShade
color: qgcPal.windowShade
width: rtlSettings.width
height: dlLossRow.height + _margins * 2
Row {
......@@ -220,7 +219,7 @@ QGCView {
sourceSize.width: width
mipmap: true
fillMode: Image.PreserveAspectFit
source: qgcPal.globalTheme === QGCPalette.Light ? "/qmlimages/DatalinkLossLight.svg" : "/qmlimages/DatalinkLoss.svg"
source: qgcPal.globalTheme === qgcPal.Light ? "/qmlimages/DatalinkLossLight.svg" : "/qmlimages/DatalinkLoss.svg"
anchors.verticalCenter: parent.verticalCenter
visible: _showIcons
}
......@@ -269,7 +268,7 @@ QGCView {
font.family: ScreenTools.demiboldFontFamily
}
Rectangle {
color: palette.windowShade
color: qgcPal.windowShade
width: rtlSettings.width
height: geofenceRow.height + _margins * 2
Row {
......@@ -283,7 +282,7 @@ QGCView {
sourceSize.width: width
mipmap: true
fillMode: Image.PreserveAspectFit
source: qgcPal.globalTheme === QGCPalette.Light ? "/qmlimages/GeoFenceLight.svg" : "/qmlimages/GeoFence.svg"
source: qgcPal.globalTheme === qgcPal.Light ? "/qmlimages/GeoFenceLight.svg" : "/qmlimages/GeoFence.svg"
anchors.verticalCenter: parent.verticalCenter
visible: _showIcons
}
......@@ -356,7 +355,7 @@ QGCView {
}
Rectangle {
id: rtlSettings
color: palette.windowShade
color: qgcPal.windowShade
width: rtlRow.width + _margins * 2
height: rtlRow.height + _margins * 2
Row {
......@@ -366,7 +365,7 @@ QGCView {
Item { width: _margins * 0.5; height: 1; }
QGCColoredImage {
id: icon
color: palette.text
color: qgcPal.text
height: ScreenTools.defaultFontPixelWidth * 10
width: ScreenTools.defaultFontPixelWidth * 20
sourceSize.width: width
......@@ -436,7 +435,7 @@ QGCView {
text: qsTr("Loiter Time")
width: _middleRowWidth
anchors.baseline: landDelayField.baseline
color: palette.text
color: qgcPal.text
enabled: homeLoiterLandRadio.checked === true
}
FactTextField {
......@@ -452,7 +451,7 @@ QGCView {
text: qsTr("Loiter Altitude")
width: _middleRowWidth
anchors.baseline: descendField.baseline
color: palette.text
color: qgcPal.text
enabled: homeLoiterLandRadio.checked === true || homeLoiterNoLandRadio.checked === true
}
FactTextField {
......@@ -474,7 +473,7 @@ QGCView {
font.family: ScreenTools.demiboldFontFamily
}
Rectangle {
color: palette.windowShade
color: qgcPal.windowShade
width: rtlSettings.width
height: landModeRow.height + _margins * 2
Row {
......@@ -486,7 +485,7 @@ QGCView {
height: 1
}
QGCColoredImage {
color: palette.text
color: qgcPal.text
height: ScreenTools.defaultFontPixelWidth * 13
width: ScreenTools.defaultFontPixelWidth * 20
sourceSize.width: width
......@@ -539,8 +538,8 @@ QGCView {
}
}
Item { width: 1; height: _margins * 0.5; }
}
}
}
}
} // Column
} // Item
} // Component
} // SetupPage
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment