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
1dfb5e50
Commit
1dfb5e50
authored
Jan 13, 2011
by
lm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allowed the removal of UAS objects, added aggressive disconnect warning
parent
16ee3c6a
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
100 additions
and
13 deletions
+100
-13
SerialLink.cc
src/comm/SerialLink.cc
+1
-1
UAS.cc
src/uas/UAS.cc
+6
-0
UASInterface.h
src/uas/UASInterface.h
+3
-0
MainWindow.cc
src/ui/MainWindow.cc
+5
-1
UASView.ui
src/ui/UASView.ui
+25
-1
UASView.cc
src/ui/uas/UASView.cc
+56
-10
UASView.h
src/ui/uas/UASView.h
+4
-0
No files found.
src/comm/SerialLink.cc
View file @
1dfb5e50
...
...
@@ -151,7 +151,7 @@ void SerialLink::run()
void
SerialLink
::
checkForBytes
()
{
/* Check if bytes are available */
if
(
port
&&
port
->
isOpen
())
if
(
port
&&
port
->
isOpen
()
&&
port
->
isWritable
()
)
{
dataMutex
.
lock
();
qint64
available
=
port
->
bytesAvailable
();
...
...
src/uas/UAS.cc
View file @
1dfb5e50
...
...
@@ -271,6 +271,12 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
GAudioOutput
::
instance
()
->
stopEmergency
();
GAudioOutput
::
instance
()
->
say
(
audiostring
);
}
if
(
state
.
status
==
MAV_STATE_POWEROFF
)
{
emit
systemRemoved
(
this
);
emit
systemRemoved
();
}
}
break
;
case
MAVLINK_MSG_ID_RAW_IMU
:
...
...
src/uas/UASInterface.h
View file @
1dfb5e50
...
...
@@ -262,6 +262,9 @@ signals:
* @param description longer textual description. Should be however limited to a short text, e.g. 200 chars.
*/
void
statusChanged
(
UASInterface
*
uas
,
QString
status
,
QString
description
);
/** @brief System has been removed / disconnected / shutdown cleanly, remove */
void
systemRemoved
(
UASInterface
*
uas
);
void
systemRemoved
();
/**
* @brief Received a plain text message from the robot
* This signal should NOT be used for standard communication, but rather for VERY IMPORTANT
...
...
src/ui/MainWindow.cc
View file @
1dfb5e50
...
...
@@ -1299,7 +1299,11 @@ void MainWindow::UASCreated(UASInterface* uas)
break
;
}
ui
.
menuConnected_Systems
->
addAction
(
icon
,
tr
(
"Select %1 for control"
).
arg
(
uas
->
getUASName
()),
uas
,
SLOT
(
setSelected
()));
QAction
*
uasAction
=
new
QAction
(
icon
,
tr
(
"Select %1 for control"
).
arg
(
uas
->
getUASName
()),
ui
.
menuConnected_Systems
);
connect
(
uas
,
SIGNAL
(
systemRemoved
()),
uasAction
,
SLOT
(
deleteLater
()));
connect
(
uasAction
,
SIGNAL
(
triggered
()),
uas
,
SLOT
(
setSelected
()));
ui
.
menuConnected_Systems
->
addAction
(
uasAction
);
// FIXME Should be not inside the mainwindow
if
(
debugConsoleDockWidget
)
...
...
src/ui/UASView.ui
View file @
1dfb5e50
...
...
@@ -181,7 +181,31 @@ QProgressBar::chunk#speedBar {
QProgressBar::chunk#thrustBar {
background-color: orange;
}
</string>
}
QToolTip {
background-color: #090909;
border: 1px solid #379AC3;
border-radius: 3px;
color: #DDDDDF;
}
QMenu {
border: 1px solid #379AC3;
background-color: #050508;
color: #DDDDDF;
background-clip: border;
font-size: 11px;
}
QMenu::separator {
height: 1px;
background: #379AC3;
margin-top: 8px;
margin-bottom: 4px;
margin-left: 5px;
margin-right: 5px;
}
</string>
</property>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_2"
>
<property
name=
"spacing"
>
...
...
src/ui/uas/UASView.cc
View file @
1dfb5e50
...
...
@@ -31,6 +31,7 @@ This file is part of the PIXHAWK project
#include <cmath>
#include <QDateTime>
#include <QDebug>
#include <QMenu>
#include "QGC.h"
#include "MG.h"
...
...
@@ -42,6 +43,8 @@ This file is part of the PIXHAWK project
UASView
::
UASView
(
UASInterface
*
uas
,
QWidget
*
parent
)
:
QWidget
(
parent
),
startTime
(
0
),
lastHeartbeat
(
0
),
iconIsRed
(
true
),
timeRemaining
(
0
),
chargeLevel
(
0
),
uas
(
uas
),
...
...
@@ -60,6 +63,7 @@ UASView::UASView(UASInterface* uas, QWidget *parent) :
alt
(
0
),
groundDistance
(
0
),
localFrame
(
false
),
removeAction
(
new
QAction
(
"Remove this system"
,
this
)),
m_ui
(
new
Ui
::
UASView
)
{
m_ui
->
setupUi
(
this
);
...
...
@@ -92,6 +96,10 @@ UASView::UASView(UASInterface* uas, QWidget *parent) :
connect
(
m_ui
->
abortButton
,
SIGNAL
(
clicked
()),
uas
,
SLOT
(
emergencySTOP
()));
connect
(
m_ui
->
killButton
,
SIGNAL
(
clicked
()),
uas
,
SLOT
(
emergencyKILL
()));
connect
(
m_ui
->
shutdownButton
,
SIGNAL
(
clicked
()),
uas
,
SLOT
(
shutdown
()));
// Allow to delete this widget
connect
(
removeAction
,
SIGNAL
(
triggered
()),
this
,
SLOT
(
deleteLater
()));
connect
(
uas
,
SIGNAL
(
systemRemoved
()),
this
,
SLOT
(
deleteLater
()));
// Set static values
...
...
@@ -230,12 +238,11 @@ void UASView::hideEvent(QHideEvent* event)
void
UASView
::
receiveHeartbeat
(
UASInterface
*
uas
)
{
Q_UNUSED
(
uas
);
QString
colorstyle
;
heartbeatColor
=
QColor
(
20
,
200
,
20
);
colorstyle
=
colorstyle
.
sprintf
(
"QGroupBox { border: 1px solid #EEEEEE; border-radius: 4px; padding: 0px; margin: 0px; background-color: #%02X%02X%02X;}"
,
heartbeatColor
.
red
(),
heartbeatColor
.
green
(),
heartbeatColor
.
blue
(
));
m_ui
->
heartbeatIcon
->
setStyleSheet
(
colorstyle
);
m_ui
->
heartbeatIcon
->
setAutoFillBackground
(
true
);
QString
colorstyle
(
"QGroupBox { border-radius: 5px; padding: 2px; margin: 2px; border: 0px; background-color: %1; }"
);
m_ui
->
heartbeatIcon
->
setStyleSheet
(
colorstyle
.
arg
(
heartbeatColor
.
name
()
));
lastHeartbeat
=
QGC
::
groundTimeUsecs
(
);
//
m_ui->heartbeatIcon->setAutoFillBackground(true);
}
/**
...
...
@@ -391,6 +398,16 @@ void UASView::updateLoad(UASInterface* uas, double load)
}
}
void
UASView
::
contextMenuEvent
(
QContextMenuEvent
*
event
)
{
if
(
QGC
::
groundTimeUsecs
()
-
lastHeartbeat
>
1500000
)
{
QMenu
menu
(
this
);
menu
.
addAction
(
removeAction
);
menu
.
exec
(
event
->
globalPos
());
}
}
void
UASView
::
refresh
()
{
//setUpdatesEnabled(false);
...
...
@@ -494,15 +511,44 @@ void UASView::refresh()
}
generalUpdateCount
++
;
QString
colorstyle
(
"QGroupBox { border-radius: 5px; padding: 2px; margin: 2px; border: 0px; background-color: %1; }"
);
if
(
QGC
::
groundTimeUsecs
()
-
lastHeartbeat
>
1500000
)
{
// CRITICAL CONDITION, NO HEARTBEAT
if
(
iconIsRed
)
{
QColor
warnColor
(
Qt
::
red
);
m_ui
->
heartbeatIcon
->
setStyleSheet
(
colorstyle
.
arg
(
warnColor
.
name
()));
QString
style
=
QString
(
"QGroupBox { border-radius: 12px; padding: 0px; margin: 0px; background-color: %1; }"
).
arg
(
warnColor
.
name
());
m_ui
->
uasViewFrame
->
setStyleSheet
(
style
);
}
else
{
QColor
warnColor
(
Qt
::
black
);
m_ui
->
heartbeatIcon
->
setStyleSheet
(
colorstyle
.
arg
(
warnColor
.
name
()));
QString
style
=
QString
(
"QGroupBox { border-radius: 12px; padding: 0px; margin: 0px; background-color: %1; }"
).
arg
(
warnColor
.
name
());
m_ui
->
uasViewFrame
->
setStyleSheet
(
style
);
}
iconIsRed
=
!
iconIsRed
;
}
else
{
// Break alert once everything is back to normal
if
(
!
iconIsRed
)
{
setBackgroundColor
();
iconIsRed
=
true
;
}
// Fade heartbeat icon
// Make color darker
heartbeatColor
=
heartbeatColor
.
darker
(
150
);
QString
colorstyle
;
colorstyle
=
colorstyle
.
sprintf
(
"QGroupBox { border: 1px solid #EEEEEE; border-radius: 8px; padding: 0px; margin: 0px; background-color: #%02X%02X%02X;}"
,
heartbeatColor
.
red
(),
heartbeatColor
.
green
(),
heartbeatColor
.
blue
());
m_ui
->
heartbeatIcon
->
setStyleSheet
(
colorstyle
);
m_ui
->
heartbeatIcon
->
setAutoFillBackground
(
true
);
//m_ui->heartbeatIcon->setAutoFillBackground(true);
m_ui
->
heartbeatIcon
->
setStyleSheet
(
colorstyle
.
arg
(
heartbeatColor
.
name
()));
}
//setUpdatesEnabled(true);
//setUpdatesEnabled(false);
...
...
src/ui/uas/UASView.h
View file @
1dfb5e50
...
...
@@ -82,6 +82,8 @@ protected:
QTimer
*
refreshTimer
;
QColor
heartbeatColor
;
quint64
startTime
;
quint64
lastHeartbeat
;
bool
iconIsRed
;
int
timeRemaining
;
float
chargeLevel
;
UASInterface
*
uas
;
...
...
@@ -100,6 +102,7 @@ protected:
float
alt
;
float
groundDistance
;
bool
localFrame
;
QAction
*
removeAction
;
static
const
int
updateInterval
=
300
;
...
...
@@ -112,6 +115,7 @@ protected:
void
showEvent
(
QShowEvent
*
event
);
/** @brief Stop widget updating */
void
hideEvent
(
QHideEvent
*
event
);
void
contextMenuEvent
(
QContextMenuEvent
*
event
);
private:
Ui
::
UASView
*
m_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