Skip to content

Commit 657499c

Browse files
committed
LP-525 Added GCS HW page for SPRacing F3 EVO
1 parent 2f1e7cd commit 657499c

9 files changed

Lines changed: 842 additions & 916 deletions
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
/**
2+
******************************************************************************
3+
*
4+
* @file commonhwsettingswidget.cpp
5+
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2017.
6+
* @addtogroup GCSPlugins GCS Plugins
7+
* @{
8+
* @addtogroup ConfigPlugin Config Plugin
9+
* @{
10+
* @brief Common hardware configuration panel
11+
*****************************************************************************/
12+
/*
13+
* This program is free software; you can redistribute it and/or modify
14+
* it under the terms of the GNU General Public License as published by
15+
* the Free Software Foundation; either version 3 of the License, or
16+
* (at your option) any later version.
17+
*
18+
* This program is distributed in the hope that it will be useful, but
19+
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20+
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21+
* for more details.
22+
*
23+
* You should have received a copy of the GNU General Public License along
24+
* with this program; if not, write to the Free Software Foundation, Inc.,
25+
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26+
*/
27+
#include "commonhwsettingswidget.h"
28+
29+
#include "ui_commonhwsettingswidget.h"
30+
31+
#include <QDebug>
32+
33+
CommonHWSettingsWidget::CommonHWSettingsWidget(QWidget *parent) : QWidget(parent)
34+
{
35+
m_ui = new Ui_CommonHWSettingsWidget();
36+
m_ui->setupUi(this);
37+
38+
setFeatures(0);
39+
40+
/* Relay signals from private members */
41+
connect(m_ui->cbUSBHID, SIGNAL(currentIndexChanged(int)), this, SIGNAL(USBHIDFunctionChanged(int)));
42+
connect(m_ui->cbUSBVCP, SIGNAL(currentIndexChanged(int)), this, SIGNAL(USBVCPFunctionChanged(int)));
43+
}
44+
45+
CommonHWSettingsWidget::~CommonHWSettingsWidget()
46+
{
47+
delete m_ui;
48+
}
49+
50+
void CommonHWSettingsWidget::registerWidgets(ConfigTaskWidget &ct)
51+
{
52+
// addAutoBindings();
53+
54+
// ct.addUAVObject("HwSettings");
55+
56+
ct.addWidgetBinding("HwSettings", "USB_HIDPort", m_ui->cbUSBHID);
57+
ct.addWidgetBinding("HwSettings", "USB_VCPPort", m_ui->cbUSBVCP);
58+
59+
ct.addWidgetBinding("HwSettings", "TelemetrySpeed", m_ui->cbTelemetrySpeed);
60+
ct.addWidgetBinding("HwSettings", "GPSSpeed", m_ui->cbGPSSpeed);
61+
ct.addWidgetBinding("HwSettings", "DebugConsoleSpeed", m_ui->cbDebugConsoleSpeed);
62+
ct.addWidgetBinding("HwSettings", "SBusMode", m_ui->cbSBUSMode);
63+
ct.addWidgetBinding("HwSettings", "DSMxBind", m_ui->cbDSMxBind, 0, 1, true);
64+
65+
ct.addWidgetBinding("GPSSettings", "DataProtocol", m_ui->cbGPSProtocol);
66+
}
67+
68+
69+
void CommonHWSettingsWidget::setFeatures(quint32 features)
70+
{
71+
bool flag = features != 0;
72+
73+
setVisible(flag);
74+
75+
flag = (features & F_USB) != 0;
76+
77+
m_ui->lbUSBHID->setVisible(flag);
78+
m_ui->cbUSBHID->setVisible(flag);
79+
m_ui->lbUSBVCP->setVisible(flag);
80+
m_ui->cbUSBVCP->setVisible(flag);
81+
82+
flag = (features & F_SBUS) != 0;
83+
84+
m_ui->lbSBUSMode->setVisible(flag);
85+
m_ui->cbSBUSMode->setVisible(flag);
86+
87+
flag = (features & F_DSM) != 0;
88+
89+
m_ui->lbDSMxBind->setVisible(flag);
90+
m_ui->cbDSMxBind->setVisible(flag);
91+
92+
flag = (features & F_TELEMETRY) != 0;
93+
94+
m_ui->lbTelemetrySpeed->setVisible(flag);
95+
m_ui->cbTelemetrySpeed->setVisible(flag);
96+
97+
flag = (features & F_DEBUGCONSOLE) != 0;
98+
99+
m_ui->lbDebugConsoleSpeed->setVisible(flag);
100+
m_ui->cbDebugConsoleSpeed->setVisible(flag);
101+
102+
flag = (features & F_GPS) != 0;
103+
104+
m_ui->lbGPSSpeed->setVisible(flag);
105+
m_ui->cbGPSSpeed->setVisible(flag);
106+
m_ui->lbGPSProtocol->setVisible(flag);
107+
m_ui->cbGPSProtocol->setVisible(flag);
108+
}
109+
110+
QComboBox *CommonHWSettingsWidget::USBVCPComboBox()
111+
{
112+
return m_ui->cbUSBVCP;
113+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/**
2+
******************************************************************************
3+
*
4+
* @file commonhwsettingswidget.h
5+
* @author The LibrePilot Project, http://www.librepilot.org Copyright (C) 2017.
6+
* @addtogroup GCSPlugins GCS Plugins
7+
* @{
8+
* @addtogroup ConfigPlugin Config Plugin
9+
* @{
10+
* @brief Common hardware configuration panel
11+
*****************************************************************************/
12+
/*
13+
* This program is free software; you can redistribute it and/or modify
14+
* it under the terms of the GNU General Public License as published by
15+
* the Free Software Foundation; either version 3 of the License, or
16+
* (at your option) any later version.
17+
*
18+
* This program is distributed in the hope that it will be useful, but
19+
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
20+
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21+
* for more details.
22+
*
23+
* You should have received a copy of the GNU General Public License along
24+
* with this program; if not, write to the Free Software Foundation, Inc.,
25+
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26+
*/
27+
#ifndef COMMONHWSETTINGSWIDGET_H
28+
#define COMMONHWSETTINGSWIDGET_H
29+
30+
#include "../uavobjectwidgetutils/configtaskwidget.h"
31+
32+
class Ui_CommonHWSettingsWidget;
33+
34+
class CommonHWSettingsWidget : public QWidget {
35+
Q_OBJECT
36+
37+
public:
38+
static const quint32 F_USB = (1 << 0);
39+
static const quint32 F_SBUS = (1 << 1);
40+
static const quint32 F_DSM = (1 << 2);
41+
static const quint32 F_TELEMETRY = (1 << 3);
42+
static const quint32 F_DEBUGCONSOLE = (1 << 4);
43+
static const quint32 F_GPS = (1 << 5);
44+
45+
CommonHWSettingsWidget(QWidget *parent = 0);
46+
virtual ~CommonHWSettingsWidget();
47+
48+
void registerWidgets(ConfigTaskWidget &ct);
49+
50+
void setFeatures(quint32 features);
51+
52+
QComboBox *USBVCPComboBox();
53+
54+
signals:
55+
void USBHIDFunctionChanged(int index);
56+
void USBVCPFunctionChanged(int index);
57+
58+
private:
59+
Ui_CommonHWSettingsWidget *m_ui;
60+
};
61+
62+
#endif // COMMONHWSETTINGSWIDGET_H

0 commit comments

Comments
 (0)