Browse Source

Improve Syslink UI

QGC4.4
Dennis Shtatnov 8 years ago
parent
commit
3bc22fdc53
  1. 236
      src/AutoPilotPlugins/Common/SyslinkComponent.qml
  2. 6
      src/comm/LinkManager.cc
  3. 53
      src/comm/QGCSerialPortInfo.cc

236
src/AutoPilotPlugins/Common/SyslinkComponent.qml

@ -8,145 +8,133 @@ @@ -8,145 +8,133 @@
****************************************************************************/
import QtQuick 2.5
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.2
import QGroundControl 1.0
import QGroundControl.Palette 1.0
import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Controllers 1.0
QGCView {
id: qgcView
viewPanel: panel
SetupPage {
id: syslinkPage
pageComponent: pageComponent
QGCPalette { id: palette; colorGroupEnabled: panel.enabled }
Component {
id: pageComponent
property real _margins: ScreenTools.defaultFontPixelHeight
property real _editFieldWidth: ScreenTools.defaultFontPixelWidth * 16
property real _labelWidth: ScreenTools.defaultFontPixelWidth * 18
Column {
id: innerColumn
width: availableWidth
spacing: ScreenTools.defaultFontPixelHeight * 0.5
SyslinkComponentController {
id: controller
factPanel: panel
}
property int textEditWidth: ScreenTools.defaultFontPixelWidth * 12
SyslinkComponentController {
id: controller
factPanel: syslinkPage.viewPanel
}
QGCLabel {
text: qsTr("Radio Settings")
font.family: ScreenTools.demiboldFontFamily
}
Rectangle {
width: parent.width
height: radioGrid.height + ScreenTools.defaultFontPixelHeight
color: qgcPal.windowShade
QGCViewPanel {
id: panel
anchors.fill: parent
Flickable {
clip: true
anchors.fill: parent
contentHeight: mainCol.height
flickableDirection: Flickable.VerticalFlick
Column {
id: mainCol
spacing: _margins
anchors.horizontalCenter: parent.horizontalCenter
Item { width: 1; height: _margins * 0.5; }
Rectangle {
color: palette.windowShade
height: settingsRow.height + _margins * 2
Row {
id: settingsRow
spacing: _margins * 4
anchors.centerIn: parent
Column {
spacing: _margins * 0.5
anchors.verticalCenter: parent.verticalCenter
Row {
QGCLabel {
text: qsTr("NRF Radio Settings")
font.family: ScreenTools.demiboldFontFamily
}
}
Row {
QGCLabel {
text: qsTr("Channel")
width: _labelWidth
anchors.baseline: channelField.baseline
}
QGCTextField {
id: channelField
width: _editFieldWidth
text: controller.radioChannel
validator: IntValidator {bottom: 0; top: 125;}
inputMethodHints: Qt.ImhDigitsOnly
onEditingFinished: {
controller.radioChannel = text
}
}
}
Row {
anchors.right: parent.right
QGCLabel {
wrapMode: Text.WordWrap
text: qsTr("Channel can be between 0 and 125")
}
}
Row {
QGCLabel {
text: qsTr("Address")
width: _labelWidth
anchors.baseline: addressField.baseline
}
QGCTextField {
id: addressField
width: _editFieldWidth
text: controller.radioAddress
maximumLength: 10
validator: RegExpValidator { regExp: /^[0-9A-Fa-f]*$/ }
onEditingFinished: {
controller.radioAddress = text
}
}
}
Row {
anchors.right: parent.right
QGCLabel {
wrapMode: Text.WordWrap
text: qsTr("Address in hex. Default E7E7E7E7E7")
}
}
Row {
QGCLabel {
text: qsTr("Data Rate")
width: _labelWidth
anchors.baseline: rateField.baseline
}
QGCComboBox {
id: rateField
width: _editFieldWidth
model: controller.radioRates
currentIndex: controller.radioRate
onActivated: {
controller.radioRate = index
}
}
}
Row {
spacing: _margins
anchors.horizontalCenter: parent.horizontalCenter
QGCButton {
text: qsTr("Restore Defaults")
width: _editFieldWidth
onClicked: {
controller.resetDefaults()
}
}
}
GridLayout {
id: radioGrid
anchors.margins: ScreenTools.defaultFontPixelHeight / 2
anchors.left: parent.left
anchors.top: parent.top
columns: 2
columnSpacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
text: qsTr("Channel")
}
QGCTextField {
id: channelField
width: textEditWidth
text: controller.radioChannel
validator: IntValidator {bottom: 0; top: 125;}
inputMethodHints: Qt.ImhDigitsOnly
onEditingFinished: {
controller.radioChannel = text
}
}
}
}
QGCLabel {
id: channelHelp
Layout.columnSpan: radioGrid.columns
Layout.fillWidth: true
font.pointSize: ScreenTools.smallFontPointSize
wrapMode: Text.WordWrap
text: "Channel can be between 0 and 125"
}
QGCLabel {
id: addressLabel
text: qsTr("Address")
}
QGCTextField {
id: addressField
width: textEditWidth
text: controller.radioAddress
maximumLength: 10
validator: RegExpValidator { regExp: /^[0-9A-Fa-f]*$/ }
onEditingFinished: {
controller.radioAddress = text
}
}
QGCLabel {
id: addressHelp
Layout.columnSpan: radioGrid.columns
Layout.fillWidth: true
font.pointSize: ScreenTools.smallFontPointSize
wrapMode: Text.WordWrap
text: "Address in hex. Default is E7E7E7E7E7."
}
QGCLabel {
id: rateLabel
text: qsTr("Data Rate")
}
QGCComboBox {
id: rateField
Layout.fillWidth: true
model: controller.radioRates
currentIndex: controller.radioRate
onActivated: {
controller.radioRate = index
}
}
QGCButton {
text: "Restore Defaults"
width: textEditWidth
onClicked: {
controller.resetDefaults()
}
}
} // Grid
} // Rectangle - Radio Settings
}
}
}

6
src/comm/LinkManager.cc

@ -526,12 +526,6 @@ void LinkManager::_updateAutoConnectLinks(void) @@ -526,12 +526,6 @@ void LinkManager::_updateAutoConnectLinks(void)
pSerialConfig->setUsbDirect(true);
}
break;
case QGCSerialPortInfo::BoardTypeCrazyflie2:
if (_autoconnectPixhawk) {
pSerialConfig = new SerialConfiguration(QString("Crazyflie on %1").arg(portInfo.portName().trimmed()));
pSerialConfig->setUsbDirect(true);
}
break;
case QGCSerialPortInfo::BoardTypePX4Flow:
if (_autoConnectSettings->autoConnectPX4Flow()->rawValue().toBool()) {
pSerialConfig = new SerialConfiguration(tr("%1 on %2 (AutoConnect)").arg(boardName).arg(portInfo.portName().trimmed()));

53
src/comm/QGCSerialPortInfo.cc

@ -204,8 +204,6 @@ bool QGCSerialPortInfo::getBoardInfo(QGCSerialPortInfo::BoardType_t& boardType, @@ -204,8 +204,6 @@ bool QGCSerialPortInfo::getBoardInfo(QGCSerialPortInfo::BoardType_t& boardType,
if (boardType == BoardTypeUnknown) {
// Fall back to port name matching which could lead to incorrect board mapping. But in some cases the
// vendor and product id do not come through correctly so this is used as a last chance detection method.
<<<<<<< c4da69536e067addfbf394609e9369c1c2d00129
for (int i=0; i<_boardFallbackList.count(); i++) {
const BoardFallback_t& boardFallback = _boardFallbackList[i];
@ -214,44 +212,6 @@ bool QGCSerialPortInfo::getBoardInfo(QGCSerialPortInfo::BoardType_t& boardType, @@ -214,44 +212,6 @@ bool QGCSerialPortInfo::getBoardInfo(QGCSerialPortInfo::BoardType_t& boardType,
if (boardFallback.androidOnly) {
continue;
}
=======
if (description() == "PX4 FMU v4.x" || description() == "PX4 BL FMU v4.x") {
qCDebug(QGCSerialPortInfoLog) << "Found PX4 FMU V4 (by name matching fallback)";
boardType = BoardTypePX4FMUV4;
} else if (description() == "PX4 FMU v2.x" || description() == "PX4 BL FMU v2.x") {
qCDebug(QGCSerialPortInfoLog) << "Found PX4 FMU V2 (by name matching fallback)";
boardType = BoardTypePX4FMUV2;
} else if (description() == "PX4 FMU v1.x" || description() == "PX4 BL FMU v1.x") {
qCDebug(QGCSerialPortInfoLog) << "Found PX4 FMU V1 (by name matching fallback)";
boardType = BoardTypePX4FMUV1;
} else if (description().startsWith("PX4 FMU")) {
qCDebug(QGCSerialPortInfoLog) << "Found PX4 FMU, assuming V2 (by name matching fallback)";
boardType = BoardTypePX4FMUV2;
} else if (description().contains(QRegExp("PX4.*Flow", Qt::CaseInsensitive))) {
qCDebug(QGCSerialPortInfoLog) << "Found possible px4 flow camera (by name matching fallback)";
boardType = BoardTypePX4Flow;
} else if (description() == "MindPX FMU v2.x" || description() == "MindPX BL FMU v2.x") {
qCDebug(QGCSerialPortInfoLog) << "Found MindPX FMU V2 (by name matching fallback)";
boardType = BoardTypeMINDPXFMUV2;
} else if (description() == "PX4 TAP v1.x" || description() == "PX4 BL TAP v1.x") {
qCDebug(QGCSerialPortInfoLog) << "Found TAP V1 (by name matching fallback)";
boardType = BoardTypeTAPV1;
} else if (description() == "PX4 ASC v1.x" || description() == "PX4 BL ASC v1.x") {
qCDebug(QGCSerialPortInfoLog) << "Found ASC V1 (by name matching fallback)";
boardType = BoardTypeASCV1;
} else if (description() == "PX4 Crazyflie v2.0" || description() == "Crazyflie BL") {
qCDebug(QGCSerialPortInfoLog) << "Found Crazyflie 2.0 (by name matching fallback)";
boardType = BoardTypeCrazyflie2;
} else if (description() == "FT231X USB UART") {
qCDebug(QGCSerialPortInfoLog) << "Found possible Radio (by name matching fallback)";
boardType = BoardTypeSikRadio;
#ifdef __android__
} else if (description().endsWith("USB UART")) {
// This is a fairly broad fallbacks for radios which will also catch most FTDI devices. That would
// cause problems on desktop due to incorrect connections. Since mobile is more anal about connecting
// it will work fine here.
boardType = BoardTypeSikRadio;
>>>>>>> Add firmware upgrade support for CF2
#endif
boardType = boardFallback.boardType;
name = _boardTypeToString(boardType);
@ -298,19 +258,6 @@ QList<QGCSerialPortInfo> QGCSerialPortInfo::availablePorts(void) @@ -298,19 +258,6 @@ QList<QGCSerialPortInfo> QGCSerialPortInfo::availablePorts(void)
return list;
}
<<<<<<< c4da69536e067addfbf394609e9369c1c2d00129
=======
bool QGCSerialPortInfo::boardTypePixhawk(void) const
{
BoardType_t boardType = this->boardType();
return boardType == BoardTypePX4FMUV1 || boardType == BoardTypePX4FMUV2
|| boardType == BoardTypePX4FMUV4 || boardType == BoardTypeAeroCore
|| boardType == BoardTypeMINDPXFMUV2 || boardType == BoardTypeTAPV1
|| boardType == BoardTypeASCV1 || boardType == BoardTypeCrazyflie2;
}
>>>>>>> Add firmware upgrade support for CF2
bool QGCSerialPortInfo::isBootloader(void) const
{
BoardType_t boardType;

Loading…
Cancel
Save