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
73b18544
Commit
73b18544
authored
Nov 29, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2310 from DonLakeFlyer/ACFix
Change disconnect model for vehicles
parents
c5c8871b
51b599a8
Changes
16
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
119 additions
and
160 deletions
+119
-160
AirframeComponentController.cc
src/AutoPilotPlugins/PX4/AirframeComponentController.cc
+1
-1
FlightDisplayView.qml
src/FlightDisplay/FlightDisplayView.qml
+0
-4
QGroundControlQmlGlobal.cc
src/QmlControls/QGroundControlQmlGlobal.cc
+2
-2
Vehicle.cc
src/Vehicle/Vehicle.cc
+4
-13
Vehicle.h
src/Vehicle/Vehicle.h
+1
-6
FirmwareUpgrade.qml
src/VehicleSetup/FirmwareUpgrade.qml
+15
-3
SetupView.qml
src/VehicleSetup/SetupView.qml
+1
-1
LinkInterface.h
src/comm/LinkInterface.h
+0
-5
LinkManager.cc
src/comm/LinkManager.cc
+52
-72
LinkManager.h
src/comm/LinkManager.h
+9
-18
SerialLink.cc
src/comm/SerialLink.cc
+0
-8
SerialLink.h
src/comm/SerialLink.h
+0
-1
UnitTest.cc
src/qgcunittest/UnitTest.cc
+1
-1
QGCLinkConfiguration.cc
src/ui/QGCLinkConfiguration.cc
+2
-2
MainToolBar.qml
src/ui/toolbar/MainToolBar.qml
+28
-21
MainToolBarIndicators.qml
src/ui/toolbar/MainToolBarIndicators.qml
+3
-2
No files found.
src/AutoPilotPlugins/PX4/AirframeComponentController.cc
View file @
73b18544
...
@@ -138,7 +138,7 @@ void AirframeComponentController::_rebootAfterStackUnwind(void)
...
@@ -138,7 +138,7 @@ void AirframeComponentController::_rebootAfterStackUnwind(void)
QGC
::
SLEEP
::
usleep
(
500
);
QGC
::
SLEEP
::
usleep
(
500
);
qgcApp
()
->
processEvents
(
QEventLoop
::
ExcludeUserInputEvents
);
qgcApp
()
->
processEvents
(
QEventLoop
::
ExcludeUserInputEvents
);
}
}
qgcApp
()
->
toolbox
()
->
linkManager
()
->
disconnectAll
(
false
/* disconnectAutoconnectLink */
);
qgcApp
()
->
toolbox
()
->
linkManager
()
->
disconnectAll
();
qgcApp
()
->
restoreOverrideCursor
();
qgcApp
()
->
restoreOverrideCursor
();
}
}
...
...
src/FlightDisplay/FlightDisplayView.qml
View file @
73b18544
...
@@ -228,8 +228,6 @@ Item {
...
@@ -228,8 +228,6 @@ Item {
QGCMapPalette
{
id
:
mapPal
;
lightColors
:
!
isBackgroundDark
}
QGCMapPalette
{
id
:
mapPal
;
lightColors
:
!
isBackgroundDark
}
Component.onCompleted
:
console
.
log
(
"
test
"
,
mapPal
)
MultiPointTouchArea
{
MultiPointTouchArea
{
anchors.fill
:
parent
anchors.fill
:
parent
touchPoints
:
[
touchPoints
:
[
...
@@ -254,7 +252,6 @@ Item {
...
@@ -254,7 +252,6 @@ Item {
var
point1
var
point1
if
(
touchPoints
.
length
>
0
)
{
if
(
touchPoints
.
length
>
0
)
{
//console.log("Point1", touchPoints[0].x, touchPoints[0].y)
point1
=
touchPoints
[
0
]
point1
=
touchPoints
[
0
]
if
(
pointInRect
(
leftRect
,
point1
))
{
if
(
pointInRect
(
leftRect
,
point1
))
{
point1Location
=
-
1
point1Location
=
-
1
...
@@ -265,7 +262,6 @@ Item {
...
@@ -265,7 +262,6 @@ Item {
var
point2
var
point2
if
(
touchPoints
.
length
==
2
)
{
if
(
touchPoints
.
length
==
2
)
{
//console.log("Point2", touchPoints[1].x, touchPoints[1].y)
point2
=
touchPoints
[
1
]
point2
=
touchPoints
[
1
]
if
(
pointInRect
(
leftRect
,
point2
))
{
if
(
pointInRect
(
leftRect
,
point2
))
{
point2Location
=
-
1
point2Location
=
-
1
...
...
src/QmlControls/QGroundControlQmlGlobal.cc
View file @
73b18544
...
@@ -81,7 +81,7 @@ void QGroundControlQmlGlobal::_startMockLink(MockConfiguration* mockConfig)
...
@@ -81,7 +81,7 @@ void QGroundControlQmlGlobal::_startMockLink(MockConfiguration* mockConfig)
mockConfig
->
setDynamic
(
true
);
mockConfig
->
setDynamic
(
true
);
linkManager
->
linkConfigurations
()
->
append
(
mockConfig
);
linkManager
->
linkConfigurations
()
->
append
(
mockConfig
);
linkManager
->
createConnectedLink
(
mockConfig
,
false
/* autoconnectLink */
);
linkManager
->
createConnectedLink
(
mockConfig
);
}
}
#endif
#endif
...
@@ -155,7 +155,7 @@ void QGroundControlQmlGlobal::stopAllMockLinks(void)
...
@@ -155,7 +155,7 @@ void QGroundControlQmlGlobal::stopAllMockLinks(void)
MockLink
*
mockLink
=
qobject_cast
<
MockLink
*>
(
link
);
MockLink
*
mockLink
=
qobject_cast
<
MockLink
*>
(
link
);
if
(
mockLink
)
{
if
(
mockLink
)
{
linkManager
->
disconnectLink
(
mockLink
,
false
/* disconnectAutoconnectLink */
);
linkManager
->
disconnectLink
(
mockLink
);
}
}
}
}
#endif
#endif
...
...
src/Vehicle/Vehicle.cc
View file @
73b18544
...
@@ -44,7 +44,6 @@ QGC_LOGGING_CATEGORY(VehicleLog, "VehicleLog")
...
@@ -44,7 +44,6 @@ QGC_LOGGING_CATEGORY(VehicleLog, "VehicleLog")
const
char
*
Vehicle
::
_settingsGroup
=
"Vehicle%1"
;
// %1 replaced with mavlink system id
const
char
*
Vehicle
::
_settingsGroup
=
"Vehicle%1"
;
// %1 replaced with mavlink system id
const
char
*
Vehicle
::
_joystickModeSettingsKey
=
"JoystickMode"
;
const
char
*
Vehicle
::
_joystickModeSettingsKey
=
"JoystickMode"
;
const
char
*
Vehicle
::
_joystickEnabledSettingsKey
=
"JoystickEnabled"
;
const
char
*
Vehicle
::
_joystickEnabledSettingsKey
=
"JoystickEnabled"
;
const
char
*
Vehicle
::
_communicationInactivityKey
=
"CommunicationInactivity"
;
Vehicle
::
Vehicle
(
LinkInterface
*
link
,
Vehicle
::
Vehicle
(
LinkInterface
*
link
,
int
vehicleId
,
int
vehicleId
,
...
@@ -102,7 +101,6 @@ Vehicle::Vehicle(LinkInterface* link,
...
@@ -102,7 +101,6 @@ Vehicle::Vehicle(LinkInterface* link,
,
_base_mode
(
0
)
,
_base_mode
(
0
)
,
_custom_mode
(
0
)
,
_custom_mode
(
0
)
,
_nextSendMessageMultipleIndex
(
0
)
,
_nextSendMessageMultipleIndex
(
0
)
,
_communicationInactivityTimeoutMSecs
(
_communicationInactivityTimeoutMSecsDefault
)
,
_firmwarePluginManager
(
firmwarePluginManager
)
,
_firmwarePluginManager
(
firmwarePluginManager
)
,
_autopilotPluginManager
(
autopilotPluginManager
)
,
_autopilotPluginManager
(
autopilotPluginManager
)
,
_joystickManager
(
joystickManager
)
,
_joystickManager
(
joystickManager
)
...
@@ -182,10 +180,6 @@ Vehicle::Vehicle(LinkInterface* link,
...
@@ -182,10 +180,6 @@ Vehicle::Vehicle(LinkInterface* link,
_mapTrajectoryTimer
.
setInterval
(
_mapTrajectoryMsecsBetweenPoints
);
_mapTrajectoryTimer
.
setInterval
(
_mapTrajectoryMsecsBetweenPoints
);
connect
(
&
_mapTrajectoryTimer
,
&
QTimer
::
timeout
,
this
,
&
Vehicle
::
_addNewMapTrajectoryPoint
);
connect
(
&
_mapTrajectoryTimer
,
&
QTimer
::
timeout
,
this
,
&
Vehicle
::
_addNewMapTrajectoryPoint
);
_communicationInactivityTimer
.
setInterval
(
_communicationInactivityTimeoutMSecs
);
connect
(
&
_communicationInactivityTimer
,
&
QTimer
::
timeout
,
this
,
&
Vehicle
::
_communicationInactivityTimedOut
);
_communicationInactivityTimer
.
start
();
}
}
Vehicle
::~
Vehicle
()
Vehicle
::~
Vehicle
()
...
@@ -209,8 +203,6 @@ void Vehicle::_mavlinkMessageReceived(LinkInterface* link, mavlink_message_t mes
...
@@ -209,8 +203,6 @@ void Vehicle::_mavlinkMessageReceived(LinkInterface* link, mavlink_message_t mes
return
;
return
;
}
}
_communicationInactivityTimer
.
start
();
if
(
!
_containsLink
(
link
))
{
if
(
!
_containsLink
(
link
))
{
_addLink
(
link
);
_addLink
(
link
);
}
}
...
@@ -311,6 +303,7 @@ void Vehicle::_linkInactiveOrDeleted(LinkInterface* link)
...
@@ -311,6 +303,7 @@ void Vehicle::_linkInactiveOrDeleted(LinkInterface* link)
_links
.
removeOne
(
link
);
_links
.
removeOne
(
link
);
if
(
_links
.
count
()
==
0
&&
!
_allLinksInactiveSent
)
{
if
(
_links
.
count
()
==
0
&&
!
_allLinksInactiveSent
)
{
qCDebug
(
VehicleLog
)
<<
"All links inactive"
;
// Make sure to not send this more than one time
// Make sure to not send this more than one time
_allLinksInactiveSent
=
true
;
_allLinksInactiveSent
=
true
;
emit
allLinksInactive
(
this
);
emit
allLinksInactive
(
this
);
...
@@ -771,7 +764,6 @@ void Vehicle::_loadSettings(void)
...
@@ -771,7 +764,6 @@ void Vehicle::_loadSettings(void)
}
}
_joystickEnabled
=
settings
.
value
(
_joystickEnabledSettingsKey
,
false
).
toBool
();
_joystickEnabled
=
settings
.
value
(
_joystickEnabledSettingsKey
,
false
).
toBool
();
_communicationInactivityTimeoutMSecs
=
settings
.
value
(
_communicationInactivityKey
,
_communicationInactivityTimeoutMSecsDefault
).
toInt
();
}
}
void
Vehicle
::
_saveSettings
(
void
)
void
Vehicle
::
_saveSettings
(
void
)
...
@@ -782,7 +774,6 @@ void Vehicle::_saveSettings(void)
...
@@ -782,7 +774,6 @@ void Vehicle::_saveSettings(void)
settings
.
setValue
(
_joystickModeSettingsKey
,
_joystickMode
);
settings
.
setValue
(
_joystickModeSettingsKey
,
_joystickMode
);
settings
.
setValue
(
_joystickEnabledSettingsKey
,
_joystickEnabled
);
settings
.
setValue
(
_joystickEnabledSettingsKey
,
_joystickEnabled
);
settings
.
setValue
(
_communicationInactivityKey
,
_communicationInactivityTimeoutMSecs
);
}
}
int
Vehicle
::
joystickMode
(
void
)
int
Vehicle
::
joystickMode
(
void
)
...
@@ -1035,13 +1026,13 @@ void Vehicle::_parametersReady(bool parametersReady)
...
@@ -1035,13 +1026,13 @@ void Vehicle::_parametersReady(bool parametersReady)
}
}
}
}
void
Vehicle
::
_communicationInactivityTimedOut
(
void
)
void
Vehicle
::
disconnectInactiveVehicle
(
void
)
{
{
// Vehicle is no longer communicating with us, disconnect all links
inactive
// Vehicle is no longer communicating with us, disconnect all links
LinkManager
*
linkMgr
=
qgcApp
()
->
toolbox
()
->
linkManager
();
LinkManager
*
linkMgr
=
qgcApp
()
->
toolbox
()
->
linkManager
();
for
(
int
i
=
0
;
i
<
_links
.
count
();
i
++
)
{
for
(
int
i
=
0
;
i
<
_links
.
count
();
i
++
)
{
linkMgr
->
disconnectLink
(
_links
[
i
]
,
false
/* disconnectAutoconnectLink */
);
linkMgr
->
disconnectLink
(
_links
[
i
]);
}
}
}
}
...
...
src/Vehicle/Vehicle.h
View file @
73b18544
...
@@ -125,6 +125,7 @@ public:
...
@@ -125,6 +125,7 @@ public:
Q_INVOKABLE
void
resetMessages
();
Q_INVOKABLE
void
resetMessages
();
Q_INVOKABLE
void
virtualTabletJoystickValue
(
double
roll
,
double
pitch
,
double
yaw
,
double
thrust
);
Q_INVOKABLE
void
virtualTabletJoystickValue
(
double
roll
,
double
pitch
,
double
yaw
,
double
thrust
);
Q_INVOKABLE
void
disconnectInactiveVehicle
(
void
);
// Property accessors
// Property accessors
...
@@ -311,7 +312,6 @@ private slots:
...
@@ -311,7 +312,6 @@ private slots:
void
_sendMessageMultipleNext
(
void
);
void
_sendMessageMultipleNext
(
void
);
void
_addNewMapTrajectoryPoint
(
void
);
void
_addNewMapTrajectoryPoint
(
void
);
void
_parametersReady
(
bool
parametersReady
);
void
_parametersReady
(
bool
parametersReady
);
void
_communicationInactivityTimedOut
(
void
);
void
_remoteControlRSSIChanged
(
uint8_t
rssi
);
void
_remoteControlRSSIChanged
(
uint8_t
rssi
);
void
_handleTextMessage
(
int
newCount
);
void
_handleTextMessage
(
int
newCount
);
...
@@ -436,10 +436,6 @@ private:
...
@@ -436,10 +436,6 @@ private:
bool
_mapTrajectoryHaveFirstCoordinate
;
bool
_mapTrajectoryHaveFirstCoordinate
;
static
const
int
_mapTrajectoryMsecsBetweenPoints
=
1000
;
static
const
int
_mapTrajectoryMsecsBetweenPoints
=
1000
;
QTimer
_communicationInactivityTimer
;
int
_communicationInactivityTimeoutMSecs
;
static
const
int
_communicationInactivityTimeoutMSecsDefault
=
30
*
1000
;
FirmwarePluginManager
*
_firmwarePluginManager
;
FirmwarePluginManager
*
_firmwarePluginManager
;
AutoPilotPluginManager
*
_autopilotPluginManager
;
AutoPilotPluginManager
*
_autopilotPluginManager
;
JoystickManager
*
_joystickManager
;
JoystickManager
*
_joystickManager
;
...
@@ -452,6 +448,5 @@ private:
...
@@ -452,6 +448,5 @@ private:
static
const
char
*
_settingsGroup
;
static
const
char
*
_settingsGroup
;
static
const
char
*
_joystickModeSettingsKey
;
static
const
char
*
_joystickModeSettingsKey
;
static
const
char
*
_joystickEnabledSettingsKey
;
static
const
char
*
_joystickEnabledSettingsKey
;
static
const
char
*
_communicationInactivityKey
;
};
};
#endif
#endif
src/VehicleSetup/FirmwareUpgrade.qml
View file @
73b18544
...
@@ -67,6 +67,8 @@ QGCView {
...
@@ -67,6 +67,8 @@ QGCView {
progressBar
:
progressBar
progressBar
:
progressBar
statusLog
:
statusTextArea
statusLog
:
statusTextArea
property
var
activeVehicle
:
QGroundControl
.
multiVehicleManager
.
activeVehicle
Component.onCompleted
:
{
Component.onCompleted
:
{
controllerCompleted
=
true
controllerCompleted
=
true
if
(
qgcView
.
completedSignalled
)
{
if
(
qgcView
.
completedSignalled
)
{
...
@@ -75,20 +77,30 @@ QGCView {
...
@@ -75,20 +77,30 @@ QGCView {
}
}
}
}
onActiveVehicleChanged
:
{
if
(
!
activeVehicle
)
{
statusTextArea
.
append
(
plugInText
)
}
}
onNoBoardFound
:
{
onNoBoardFound
:
{
initialBoardSearch
=
false
initialBoardSearch
=
false
statusTextArea
.
append
(
plugInText
)
if
(
!
QGroundControl
.
multiVehicleManager
.
activeVehicleAvailable
)
{
statusTextArea
.
append
(
plugInText
)
}
}
}
onBoardGone
:
{
onBoardGone
:
{
initialBoardSearch
=
false
initialBoardSearch
=
false
statusTextArea
.
append
(
plugInText
)
if
(
!
QGroundControl
.
multiVehicleManager
.
activeVehicleAvailable
)
{
statusTextArea
.
append
(
plugInText
)
}
}
}
onBoardFound
:
{
onBoardFound
:
{
if
(
initialBoardSearch
)
{
if
(
initialBoardSearch
)
{
// Board was found right away, so something is already plugged in before we've started upgrade
// Board was found right away, so something is already plugged in before we've started upgrade
if
(
QGroundControl
.
linkManager
.
anyActiveLinks
)
{
if
(
QGroundControl
.
multiVehicleManager
.
activeVehicleAvailable
)
{
statusTextArea
.
append
(
qgcDisconnectText
)
statusTextArea
.
append
(
qgcDisconnectText
)
}
else
{
}
else
{
statusTextArea
.
append
(
usbUnplugText
.
replace
(
'
{0}
'
,
controller
.
boardType
))
statusTextArea
.
append
(
usbUnplugText
.
replace
(
'
{0}
'
,
controller
.
boardType
))
...
...
src/VehicleSetup/SetupView.qml
View file @
73b18544
...
@@ -159,7 +159,7 @@ Rectangle {
...
@@ -159,7 +159,7 @@ Rectangle {
horizontalAlignment
:
Text
.
AlignHCenter
horizontalAlignment
:
Text
.
AlignHCenter
wrapMode
:
Text
.
WordWrap
wrapMode
:
Text
.
WordWrap
font.pixelSize
:
ScreenTools
.
largeFontPixelSize
font.pixelSize
:
ScreenTools
.
largeFontPixelSize
text
:
"
C
lick Connect on the top right to Fly
. Click Firmware on the left to upgrade your vehicle.
"
text
:
"
C
onnect vehicle to your device and QGroundControl will automatically detect to it
. Click Firmware on the left to upgrade your vehicle.
"
onLinkActivated
:
Qt
.
openUrlExternally
(
link
)
onLinkActivated
:
Qt
.
openUrlExternally
(
link
)
}
}
...
...
src/comm/LinkInterface.h
View file @
73b18544
...
@@ -57,12 +57,9 @@ class LinkInterface : public QThread
...
@@ -57,12 +57,9 @@ class LinkInterface : public QThread
friend
class
LinkManager
;
friend
class
LinkManager
;
public:
public:
Q_PROPERTY
(
bool
autoconnect
READ
autoconnect
WRITE
setAutoconnect
NOTIFY
autoconnectChanged
)
Q_PROPERTY
(
bool
active
READ
active
WRITE
setActive
NOTIFY
activeChanged
)
Q_PROPERTY
(
bool
active
READ
active
WRITE
setActive
NOTIFY
activeChanged
)
// Property accessors
// Property accessors
bool
autoconnect
(
void
)
{
return
_autoconnect
;
}
void
setAutoconnect
(
bool
autoconnect
)
{
_autoconnect
=
autoconnect
;
emit
autoconnectChanged
(
autoconnect
);
}
bool
active
(
void
)
{
return
_active
;
}
bool
active
(
void
)
{
return
_active
;
}
void
setActive
(
bool
active
)
{
_active
=
active
;
emit
activeChanged
(
active
);
}
void
setActive
(
bool
active
)
{
_active
=
active
;
emit
activeChanged
(
active
);
}
...
@@ -198,7 +195,6 @@ protected:
...
@@ -198,7 +195,6 @@ protected:
LinkInterface
()
:
LinkInterface
()
:
QThread
(
0
)
QThread
(
0
)
,
_mavlinkChannelSet
(
false
)
,
_mavlinkChannelSet
(
false
)
,
_autoconnect
(
false
)
,
_active
(
false
)
,
_active
(
false
)
{
{
// Initialize everything for the data rate calculation buffers.
// Initialize everything for the data rate calculation buffers.
...
@@ -361,7 +357,6 @@ private:
...
@@ -361,7 +357,6 @@ private:
mutable
QMutex
_dataRateMutex
;
// Mutex for accessing the data rate member variables
mutable
QMutex
_dataRateMutex
;
// Mutex for accessing the data rate member variables
bool
_autoconnect
;
///< true: Link is an autoconnect connection and should never be disconnected
bool
_active
;
///< true: link is actively receiving mavlink messages
bool
_active
;
///< true: link is actively receiving mavlink messages
};
};
...
...
src/comm/LinkManager.cc
View file @
73b18544
This diff is collapsed.
Click to expand it.
src/comm/LinkManager.h
View file @
73b18544
...
@@ -73,9 +73,7 @@ public:
...
@@ -73,9 +73,7 @@ public:
~
LinkManager
();
~
LinkManager
();
Q_PROPERTY
(
bool
anyActiveLinks
READ
anyActiveLinks
NOTIFY
anyActiveLinksChanged
)
Q_PROPERTY
(
bool
anyActiveLinks
READ
anyActiveLinks
NOTIFY
anyActiveLinksChanged
)
Q_PROPERTY
(
bool
anyNonAutoconnectActiveLinks
READ
anyNonAutoconnectActiveLinks
NOTIFY
anyNonAutoconnectActiveLinksChanged
)
Q_PROPERTY
(
bool
anyConnectedLinks
READ
anyConnectedLinks
NOTIFY
anyConnectedLinksChanged
)
Q_PROPERTY
(
bool
anyConnectedLinks
READ
anyConnectedLinks
NOTIFY
anyConnectedLinksChanged
)
Q_PROPERTY
(
bool
anyNonAutoconnectConnectedLinks
READ
anyNonAutoconnectConnectedLinks
NOTIFY
anyNonAutoconnectConnectedLinksChanged
)
Q_PROPERTY
(
bool
autoconnectUDP
READ
autoconnectUDP
WRITE
setAutoconnectUDP
NOTIFY
autoconnectUDPChanged
)
Q_PROPERTY
(
bool
autoconnectUDP
READ
autoconnectUDP
WRITE
setAutoconnectUDP
NOTIFY
autoconnectUDPChanged
)
Q_PROPERTY
(
bool
autoconnectPixhawk
READ
autoconnectPixhawk
WRITE
setAutoconnectPixhawk
NOTIFY
autoconnectPixhawkChanged
)
Q_PROPERTY
(
bool
autoconnectPixhawk
READ
autoconnectPixhawk
WRITE
setAutoconnectPixhawk
NOTIFY
autoconnectPixhawkChanged
)
Q_PROPERTY
(
bool
autoconnect3DRRadio
READ
autoconnect3DRRadio
WRITE
setAutoconnect3DRRadio
NOTIFY
autoconnect3DRRadioChanged
)
Q_PROPERTY
(
bool
autoconnect3DRRadio
READ
autoconnect3DRRadio
WRITE
setAutoconnect3DRRadio
NOTIFY
autoconnect3DRRadioChanged
)
...
@@ -88,9 +86,7 @@ public:
...
@@ -88,9 +86,7 @@ public:
// Property accessors
// Property accessors
bool
anyConnectedLinks
(
void
);
bool
anyConnectedLinks
(
void
);
bool
anyNonAutoconnectConnectedLinks
(
void
);
bool
anyActiveLinks
(
void
);
bool
anyActiveLinks
(
void
);
bool
anyNonAutoconnectActiveLinks
(
void
);
bool
autoconnectUDP
(
void
)
{
return
_autoconnectUDP
;
}
bool
autoconnectUDP
(
void
)
{
return
_autoconnectUDP
;
}
bool
autoconnectPixhawk
(
void
)
{
return
_autoconnectPixhawk
;
}
bool
autoconnectPixhawk
(
void
)
{
return
_autoconnectPixhawk
;
}
bool
autoconnect3DRRadio
(
void
)
{
return
_autoconnect3DRRadio
;
}
bool
autoconnect3DRRadio
(
void
)
{
return
_autoconnect3DRRadio
;
}
...
@@ -123,24 +119,19 @@ public:
...
@@ -123,24 +119,19 @@ public:
/// Creates, connects (and adds) a link based on the given configuration instance.
/// Creates, connects (and adds) a link based on the given configuration instance.
/// Link takes ownership of config.
/// Link takes ownership of config.
Q_INVOKABLE
LinkInterface
*
createConnectedLink
(
LinkConfiguration
*
config
,
bool
persistenLink
=
false
);
Q_INVOKABLE
LinkInterface
*
createConnectedLink
(
LinkConfiguration
*
config
);
/// Creates, connects (and adds) a link based on the given configuration name.
/// Creates, connects (and adds) a link based on the given configuration name.
LinkInterface
*
createConnectedLink
(
const
QString
&
name
,
bool
persistenLink
=
false
);
LinkInterface
*
createConnectedLink
(
const
QString
&
name
);
/// Disconnects all existing links, including persistent links.
/// Disconnects all existing links
/// @param disconnectAutoconnectLink See disconnectLink
void
disconnectAll
(
void
);
void
disconnectAll
(
bool
disconnectAutoconnectLink
);
/// Connect the specified link
/// Connect the specified link
bool
connectLink
(
LinkInterface
*
link
);
bool
connectLink
(
LinkInterface
*
link
);
/// Disconnect the specified link.
/// Disconnect the specified link
/// @param disconnectAutoconnectLink
Q_INVOKABLE
void
disconnectLink
(
LinkInterface
*
link
);
/// true: link is disconnected no matter what type
/// false: if autoconnect link, link is marked as inactive and linkInactive is signalled
/// false: if not autoconnect link, link is disconnected
Q_INVOKABLE
bool
disconnectLink
(
LinkInterface
*
link
,
bool
disconnectAutoconnectLink
);
/// Called to notify that a heartbeat was received with the specified information. Will transition
/// Called to notify that a heartbeat was received with the specified information. Will transition
/// a link to active as needed.
/// a link to active as needed.
...
@@ -163,9 +154,7 @@ public:
...
@@ -163,9 +154,7 @@ public:
signals:
signals:
void
anyActiveLinksChanged
(
bool
anyActiveLinks
);
void
anyActiveLinksChanged
(
bool
anyActiveLinks
);
void
anyNonAutoconnectActiveLinksChanged
(
bool
anyNonAutoconnectActiveLinks
);
void
anyConnectedLinksChanged
(
bool
anyConnectedLinks
);
void
anyConnectedLinksChanged
(
bool
anyConnectedLinks
);
void
anyNonAutoconnectConnectedLinksChanged
(
bool
anyNoAutoconnectConnectedLinks
);
void
autoconnectUDPChanged
(
bool
autoconnect
);
void
autoconnectUDPChanged
(
bool
autoconnect
);
void
autoconnectPixhawkChanged
(
bool
autoconnect
);
void
autoconnectPixhawkChanged
(
bool
autoconnect
);
void
autoconnect3DRRadioChanged
(
bool
autoconnect
);
void
autoconnect3DRRadioChanged
(
bool
autoconnect
);
...
@@ -216,7 +205,8 @@ private:
...
@@ -216,7 +205,8 @@ private:
QmlObjectListModel
_links
;
QmlObjectListModel
_links
;
QmlObjectListModel
_linkConfigurations
;
QmlObjectListModel
_linkConfigurations
;
QmlObjectListModel
_autoconnectConfigurations
;
QmlObjectListModel
_autoconnectConfigurations
;
UDPConfiguration
*
_autoconnectUDPConfig
;
QStringList
_autoconnectWaitList
;
bool
_autoconnectUDP
;
bool
_autoconnectUDP
;
bool
_autoconnectPixhawk
;
bool
_autoconnectPixhawk
;
...
@@ -228,6 +218,7 @@ private:
...
@@ -228,6 +218,7 @@ private:
static
const
char
*
_autoconnectPixhawkKey
;
static
const
char
*
_autoconnectPixhawkKey
;
static
const
char
*
_autoconnect3DRRadioKey
;
static
const
char
*
_autoconnect3DRRadioKey
;
static
const
char
*
_autoconnectPX4FlowKey
;
static
const
char
*
_autoconnectPX4FlowKey
;
static
const
char
*
_defaultUPDLinkName
;
};
};
#endif
#endif
src/comm/SerialLink.cc
View file @
73b18544
...
@@ -211,9 +211,6 @@ bool SerialLink::_hardwareConnect(QString &type)
...
@@ -211,9 +211,6 @@ bool SerialLink::_hardwareConnect(QString &type)
return
false
;
// couldn't create serial port.
return
false
;
// couldn't create serial port.
}
}
// We need to catch this signal and then emit disconnected. You can't connect
// signal to signal otherwise disonnected will have the wrong QObject::Sender
QObject
::
connect
(
_port
,
SIGNAL
(
aboutToClose
()),
this
,
SLOT
(
_rerouteDisconnected
()));
QObject
::
connect
(
_port
,
SIGNAL
(
error
(
QSerialPort
::
SerialPortError
)),
this
,
SLOT
(
linkError
(
QSerialPort
::
SerialPortError
)));
QObject
::
connect
(
_port
,
SIGNAL
(
error
(
QSerialPort
::
SerialPortError
)),
this
,
SLOT
(
linkError
(
QSerialPort
::
SerialPortError
)));
QObject
::
connect
(
_port
,
&
QIODevice
::
readyRead
,
this
,
&
SerialLink
::
_readBytes
);
QObject
::
connect
(
_port
,
&
QIODevice
::
readyRead
,
this
,
&
SerialLink
::
_readBytes
);
...
@@ -361,11 +358,6 @@ void SerialLink::_resetConfiguration()
...
@@ -361,11 +358,6 @@ void SerialLink::_resetConfiguration()
}
}
}
}
void
SerialLink
::
_rerouteDisconnected
(
void
)
{
emit
disconnected
();
}
void
SerialLink
::
_emitLinkError
(
const
QString
&
errorMsg
)
void
SerialLink
::
_emitLinkError
(
const
QString
&
errorMsg
)
{
{
QString
msg
(
"Error on link %1. %2"
);
QString
msg
(
"Error on link %1. %2"
);
...
...
src/comm/SerialLink.h
View file @
73b18544
...
@@ -150,7 +150,6 @@ protected:
...
@@ -150,7 +150,6 @@ protected:
QString
_type
;
QString
_type
;
private
slots
:
private
slots
:
void
_rerouteDisconnected
(
void
);
void
_readBytes
(
void
);
void
_readBytes
(
void
);
private:
private:
...
...
src/qgcunittest/UnitTest.cc
View file @
73b18544
...
@@ -387,7 +387,7 @@ void UnitTest::_disconnectMockLink(void)
...
@@ -387,7 +387,7 @@ void UnitTest::_disconnectMockLink(void)
if
(
_mockLink
)
{
if
(
_mockLink
)
{
QSignalSpy
linkSpy
(
_linkManager
,
SIGNAL
(
linkDeleted
(
LinkInterface
*
)));
QSignalSpy
linkSpy
(
_linkManager
,
SIGNAL
(
linkDeleted
(
LinkInterface
*
)));
_linkManager
->
disconnectLink
(
_mockLink
,
false
/* disconnectAutoconnectLink */
);
_linkManager
->
disconnectLink
(
_mockLink
);
// Wait for link to go away
// Wait for link to go away
linkSpy
.
wait
(
1000
);
linkSpy
.
wait
(
1000
);
...
...
src/ui/QGCLinkConfiguration.cc
View file @
73b18544
...
@@ -73,7 +73,7 @@ void QGCLinkConfiguration::on_delLinkButton_clicked()
...
@@ -73,7 +73,7 @@ void QGCLinkConfiguration::on_delLinkButton_clicked()
// Get link attached to this configuration (if any)
// Get link attached to this configuration (if any)
LinkInterface
*
iface
=
config
->
link
();
LinkInterface
*
iface
=
config
->
link
();
if
(
iface
)
{
if
(
iface
)
{
qgcApp
()
->
toolbox
()
->
linkManager
()
->
disconnectLink
(
iface
,
false
/* disconnectAutoconnectLink */
);
qgcApp
()
->
toolbox
()
->
linkManager
()
->
disconnectLink
(
iface
);
}
}
_viewModel
->
beginChange
();
_viewModel
->
beginChange
();
...
@@ -106,7 +106,7 @@ void QGCLinkConfiguration::on_connectLinkButton_clicked()
...
@@ -106,7 +106,7 @@ void QGCLinkConfiguration::on_connectLinkButton_clicked()
if
(
link
)
{
if
(
link
)
{
// Disconnect Link
// Disconnect Link
if
(
link
->
isConnected
())
{
if
(
link
->
isConnected
())
{
qgcApp
()
->
toolbox
()
->
linkManager
()
->
disconnectLink
(
link
,
false
/* disconnectAutoconnectLink */
);
qgcApp
()
->
toolbox
()
->
linkManager
()
->
disconnectLink
(
link
);
}
}
}
else
{
}
else
{
LinkInterface
*
link
=
qgcApp
()
->
toolbox
()
->
linkManager
()
->
createConnectedLink
(
config
);
LinkInterface
*
link
=
qgcApp
()
->
toolbox
()
->
linkManager
()
->
createConnectedLink
(
config
);
...
...
src/ui/toolbar/MainToolBar.qml
View file @
73b18544
...
@@ -152,10 +152,6 @@ Rectangle {
...
@@ -152,10 +152,6 @@ Rectangle {
toolBarMessageArea
.
visible
=
true
toolBarMessageArea
.
visible
=
true
}
}
function
showMavStatus
()
{
return
(
multiVehicleManager
.
activeVehicleAvailable
&&
activeVehicle
.
heartbeatTimeout
===
0
);
}
function
getBatteryColor
()
{
function
getBatteryColor
()
{
if
(
activeVehicle
)
{
if
(
activeVehicle
)
{
if
(
activeVehicle
.
batteryPercent
>
75
)
{
if
(
activeVehicle
.
batteryPercent
>
75
)
{
...
@@ -554,29 +550,40 @@ Rectangle {
...
@@ -554,29 +550,40 @@ Rectangle {
Item
{
Item
{
id
:
vehicleIndicators
id
:
vehicleIndicators
visible
:
showMavStatus
()
&&
!
connectionStatus
.
visible
height
:
mainWindow
.
tbCellHeight
height
:
mainWindow
.
tbCellHeight
width
:
(
toolBar
.
width
-
viewRow
.
width
)
anchors.left
:
viewRow
.
right
anchors.leftMargin
:
mainWindow
.
tbSpacing
*
2
anchors.leftMargin
:
mainWindow
.
tbSpacing
*
2
anchors.left
:
viewRow
.
right
anchors.right
:
parent
.
right
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
property
bool
vehicleInactive
:
activeVehicle
?
activeVehicle
.
heartbeatTimeout
!=
0
:
false
Loader
{
Loader
{
source
:
multiVehicleManager
.
activeVehicleAvailabl
e
?
"
MainToolBarIndicators.qml
"
:
""
source
:
activeVehicle
&&
!
parent
.
vehicleInactiv
e
?
"
MainToolBarIndicators.qml
"
:
""
anchors.left
:
parent
.
left
anchors.left
:
parent
.
left
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
}
}
}
QGCLabel
{
QGCLabel
{
id
:
connectionStatus
id
:
connectionLost
visible
:
(
_controller
.
connectionCount
>
0
&&
multiVehicleManager
.
activeVehicleAvailable
&&
activeVehicle
.
heartbeatTimeout
!=
0
)
text
:
"
CONNECTION LOST
"
text
:
"
CONNECTION LOST
"
font.pixelSize
:
tbFontLarge
font.pixelSize
:
tbFontLarge
font.weight
:
Font
.
DemiBold
font.weight
:
Font
.
DemiBold
color
:
colorRed
color
:
colorRed
anchors.left
:
parent
.
left
anchors.left
:
viewRow
.
right
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.leftMargin
:
mainWindow
.
tbSpacing
*
2
visible
:
parent
.
vehicleInactive
anchors.verticalCenter
:
parent
.
verticalCenter
}
QGCButton
{
anchors.rightMargin
:
mainWindow
.
tbSpacing
*
2
anchors.right
:
parent
.
right
anchors.verticalCenter
:
parent
.
verticalCenter
text
:
"
Disconnect
"
visible
:
parent
.
vehicleInactive
onClicked
:
activeVehicle
.
disconnectInactiveVehicle
()
}
}
}
// Progress bar
// Progress bar
...
...
src/ui/toolbar/MainToolBarIndicators.qml
View file @
73b18544
...
@@ -322,7 +322,7 @@ Row {
...
@@ -322,7 +322,7 @@ Row {
MenuItem
{
MenuItem
{
checkable
:
true
checkable
:
true
checked
:
vehicle
.
activ
e
checked
:
vehicle
?
vehicle
.
active
:
fals
e
onTriggered
:
multiVehicleManager
.
activeVehicle
=
vehicle
onTriggered
:
multiVehicleManager
.
activeVehicle
=
vehicle
property
int
vehicleId
:
Number
(
text
.
split
(
"
"
)[
1
])
property
int
vehicleId
:
Number
(
text
.
split
(
"
"
)[
1
])
...
@@ -360,6 +360,7 @@ Row {
...
@@ -360,6 +360,7 @@ Row {
//-- Mode Selector
//-- Mode Selector
Item
{
Item
{
id
:
flightModeSelector
width
:
selectorRow
.
width
*
1.1
width
:
selectorRow
.
width
*
1.1
height
:
mainWindow
.
tbCellHeight
height
:
mainWindow
.
tbCellHeight
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
...
@@ -425,7 +426,7 @@ Row {
...
@@ -425,7 +426,7 @@ Row {
Connections
{
Connections
{
target
:
multiVehicleManager
target
:
multiVehicleManager
onActiveVehicleChanged
:
parent
.
updateFlightModesMenu
onActiveVehicleChanged
:
flightModeSelector
.
updateFlightModesMenu
}
}
MouseArea
{
MouseArea
{
...
...
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