Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
1142b6f3
Commit
1142b6f3
authored
Jun 27, 2013
by
Michael Carpenter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented Sonar Config
parent
be00fa35
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
113 additions
and
7 deletions
+113
-7
AC-0004-11-2.jpg
files/images/devices/AC-0004-11-2.jpg
+0
-0
qgroundcontrol.qrc
qgroundcontrol.qrc
+1
-0
SonarConfig.cc
src/ui/configuration/SonarConfig.cc
+59
-2
SonarConfig.h
src/ui/configuration/SonarConfig.h
+6
-2
SonarConfig.ui
src/ui/configuration/SonarConfig.ui
+47
-3
No files found.
files/images/devices/AC-0004-11-2.jpg
0 → 100644
View file @
1142b6f3
10.4 KB
qgroundcontrol.qrc
View file @
1142b6f3
...
...
@@ -111,6 +111,7 @@
<file>files/images/mavs/frames-05.png</file>
<file>files/images/devices/BR-HMC5883-01-2.jpg</file>
<file>files/images/devices/BR-APMPWRDEAN-2.jpg</file>
<file>files/images/devices/AC-0004-11-2.jpg</file>
</qresource>
<qresource prefix="/general">
<file alias="vera.ttf">files/styles/Vera.ttf</file>
...
...
src/ui/configuration/SonarConfig.cc
View file @
1142b6f3
#include "SonarConfig.h"
#include <QMessageBox>
SonarConfig
::
SonarConfig
(
QWidget
*
parent
)
:
QWidget
(
parent
)
SonarConfig
::
SonarConfig
(
QWidget
*
parent
)
:
AP2ConfigWidget
(
parent
)
{
ui
.
setupUi
(
this
);
connect
(
ui
.
enableCheckBox
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
checkBoxToggled
(
bool
)));
connect
(
ui
.
sonarTypeComboBox
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
sonarTypeChanged
(
int
)));
ui
.
sonarTypeComboBox
->
addItem
(
"XL-EZ0 / XL-EZ4"
);
ui
.
sonarTypeComboBox
->
addItem
(
"LV-EZ0"
);
ui
.
sonarTypeComboBox
->
addItem
(
"XL-EZL0"
);
ui
.
sonarTypeComboBox
->
addItem
(
"HRLV"
);
}
SonarConfig
::~
SonarConfig
()
{
}
void
SonarConfig
::
checkBoxToggled
(
bool
enabled
)
{
if
(
enabled
)
{
ui
.
sonarTypeComboBox
->
setEnabled
(
false
);
}
if
(
!
m_uas
)
{
QMessageBox
::
information
(
0
,
tr
(
"Error"
),
tr
(
"Please connect to a MAV before attempting to set configuration"
));
return
;
}
m_uas
->
setParameter
(
0
,
"SONAR_ENABLE"
,
ui
.
enableCheckBox
->
isChecked
()
?
1
:
0
);
}
void
SonarConfig
::
sonarTypeChanged
(
int
index
)
{
if
(
!
m_uas
)
{
QMessageBox
::
information
(
0
,
tr
(
"Error"
),
tr
(
"Please connect to a MAV before attempting to set configuration"
));
return
;
}
m_uas
->
setParameter
(
0
,
"SONAR_TYPE"
,
ui
.
sonarTypeComboBox
->
currentIndex
());
}
void
SonarConfig
::
parameterChanged
(
int
uas
,
int
component
,
QString
parameterName
,
QVariant
value
)
{
if
(
parameterName
==
"SONAR_ENABLE"
)
{
if
(
value
.
toInt
()
==
0
)
{
//Disabled
disconnect
(
ui
.
enableCheckBox
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
checkBoxToggled
(
bool
)));
ui
.
enableCheckBox
->
setChecked
(
false
);
connect
(
ui
.
enableCheckBox
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
checkBoxToggled
(
bool
)));
ui
.
sonarTypeComboBox
->
setEnabled
(
false
);
}
else
{
disconnect
(
ui
.
enableCheckBox
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
checkBoxToggled
(
bool
)));
ui
.
enableCheckBox
->
setChecked
(
true
);
connect
(
ui
.
enableCheckBox
,
SIGNAL
(
toggled
(
bool
)),
this
,
SLOT
(
checkBoxToggled
(
bool
)));
ui
.
sonarTypeComboBox
->
setEnabled
(
true
);
}
}
else
if
(
parameterName
==
"SONAR_TYPE"
)
{
disconnect
(
ui
.
sonarTypeComboBox
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
sonarTypeChanged
(
int
)));
ui
.
sonarTypeComboBox
->
setCurrentIndex
(
value
.
toInt
());
connect
(
ui
.
sonarTypeComboBox
,
SIGNAL
(
currentIndexChanged
(
int
)),
this
,
SLOT
(
sonarTypeChanged
(
int
)));
}
}
src/ui/configuration/SonarConfig.h
View file @
1142b6f3
...
...
@@ -2,16 +2,20 @@
#define SONARCONFIG_H
#include <QWidget>
#include "AP2ConfigWidget.h"
#include "ui_SonarConfig.h"
class
SonarConfig
:
public
Q
Widget
class
SonarConfig
:
public
AP2Config
Widget
{
Q_OBJECT
public:
explicit
SonarConfig
(
QWidget
*
parent
=
0
);
~
SonarConfig
();
private
slots
:
void
parameterChanged
(
int
uas
,
int
component
,
QString
parameterName
,
QVariant
value
);
void
checkBoxToggled
(
bool
enabled
);
void
sonarTypeChanged
(
int
index
);
private:
Ui
::
SonarConfig
ui
;
};
...
...
src/ui/configuration/SonarConfig.ui
View file @
1142b6f3
...
...
@@ -6,8 +6,8 @@
<rect>
<x>
0
</x>
<y>
0
</y>
<width>
400
</width>
<height>
300
</height>
<width>
651
</width>
<height>
432
</height>
</rect>
</property>
<property
name=
"windowTitle"
>
...
...
@@ -29,7 +29,51 @@
<bool>
false
</bool>
</property>
</widget>
<widget
class=
"QLabel"
name=
"label_2"
>
<property
name=
"geometry"
>
<rect>
<x>
30
</x>
<y>
60
</y>
<width>
91
</width>
<height>
81
</height>
</rect>
</property>
<property
name=
"text"
>
<string/>
</property>
<property
name=
"pixmap"
>
<pixmap
resource=
"../../../qgroundcontrol.qrc"
>
:/files/images/devices/AC-0004-11-2.jpg
</pixmap>
</property>
<property
name=
"scaledContents"
>
<bool>
true
</bool>
</property>
</widget>
<widget
class=
"QCheckBox"
name=
"enableCheckBox"
>
<property
name=
"geometry"
>
<rect>
<x>
140
</x>
<y>
60
</y>
<width>
70
</width>
<height>
17
</height>
</rect>
</property>
<property
name=
"text"
>
<string>
CheckBox
</string>
</property>
</widget>
<widget
class=
"QComboBox"
name=
"sonarTypeComboBox"
>
<property
name=
"geometry"
>
<rect>
<x>
150
</x>
<y>
100
</y>
<width>
171
</width>
<height>
22
</height>
</rect>
</property>
</widget>
</widget>
<resources/>
<resources>
<include
location=
"../../../qgroundcontrol.qrc"
/>
</resources>
<connections/>
</ui>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment