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
4d23912a
Commit
4d23912a
authored
Oct 25, 2016
by
Gus Grubba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Receiving and writing logs.
Forcing QGC to use Mavlink V2 if vehicle supports it.
parent
f91c5bef
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
168 additions
and
74 deletions
+168
-74
Vehicle.cc
src/Vehicle/Vehicle.cc
+8
-4
Vehicle.h
src/Vehicle/Vehicle.h
+1
-1
MAVLinkProtocol.cc
src/comm/MAVLinkProtocol.cc
+12
-9
MavlinkLogManager.cc
src/uas/MavlinkLogManager.cc
+130
-48
MavlinkLogManager.h
src/uas/MavlinkLogManager.h
+6
-0
MavlinkSettings.qml
src/ui/preferences/MavlinkSettings.qml
+11
-12
No files found.
src/Vehicle/Vehicle.cc
View file @
4d23912a
...
...
@@ -481,7 +481,7 @@ void Vehicle::_mavlinkMessageReceived(LinkInterface* link, mavlink_message_t mes
_handleCommandAck
(
message
);
break
;
case
MAVLINK_MSG_ID_AUTOPILOT_VERSION
:
_handleAutopilotVersion
(
message
);
_handleAutopilotVersion
(
link
,
message
);
break
;
case
MAVLINK_MSG_ID_WIND_COV
:
_handleWindCov
(
message
);
...
...
@@ -508,11 +508,17 @@ void Vehicle::_mavlinkMessageReceived(LinkInterface* link, mavlink_message_t mes
_uas
->
receiveMessage
(
message
);
}
void
Vehicle
::
_handleAutopilotVersion
(
mavlink_message_t
&
message
)
void
Vehicle
::
_handleAutopilotVersion
(
LinkInterface
*
link
,
mavlink_message_t
&
message
)
{
mavlink_autopilot_version_t
autopilotVersion
;
mavlink_msg_autopilot_version_decode
(
&
message
,
&
autopilotVersion
);
bool
isMavlink2
=
(
autopilotVersion
.
capabilities
&
MAV_PROTOCOL_CAPABILITY_MAVLINK2
)
!=
0
;
if
(
isMavlink2
)
{
mavlink_status_t
*
mavlinkStatus
=
mavlink_get_channel_status
(
link
->
mavlinkChannel
());
mavlinkStatus
->
flags
&=
~
MAVLINK_STATUS_FLAG_OUT_MAVLINK1
;
}
if
(
autopilotVersion
.
flight_sw_version
!=
0
)
{
int
majorVersion
,
minorVersion
,
patchVersion
;
FIRMWARE_VERSION_TYPE
versionType
;
...
...
@@ -2002,7 +2008,6 @@ Vehicle::_ackMavlinkLogData(uint16_t sequence)
void
Vehicle
::
_handleMavlinkLoggingData
(
mavlink_message_t
&
message
)
{
qDebug
()
<<
"MAVLINK_MSG_ID_LOGGING_DATA"
;
mavlink_logging_data_t
log
;
mavlink_msg_logging_data_decode
(
&
message
,
&
log
);
emit
mavlinkLogData
(
this
,
log
.
target_system
,
log
.
target_component
,
log
.
sequence
,
log
.
length
,
log
.
first_message_offset
,
log
.
data
,
false
);
...
...
@@ -2012,7 +2017,6 @@ Vehicle::_handleMavlinkLoggingData(mavlink_message_t& message)
void
Vehicle
::
_handleMavlinkLoggingDataAcked
(
mavlink_message_t
&
message
)
{
qDebug
()
<<
"MAVLINK_MSG_ID_LOGGING_DATA_ACKED"
;
mavlink_logging_data_t
log
;
mavlink_msg_logging_data_decode
(
&
message
,
&
log
);
_ackMavlinkLogData
(
log
.
sequence
);
...
...
src/Vehicle/Vehicle.h
View file @
4d23912a
...
...
@@ -692,7 +692,7 @@ private:
void
_handleVibration
(
mavlink_message_t
&
message
);
void
_handleExtendedSysState
(
mavlink_message_t
&
message
);
void
_handleCommandAck
(
mavlink_message_t
&
message
);
void
_handleAutopilotVersion
(
mavlink_message_t
&
message
);
void
_handleAutopilotVersion
(
LinkInterface
*
link
,
mavlink_message_t
&
message
);
void
_handleHilActuatorControls
(
mavlink_message_t
&
message
);
void
_missionManagerError
(
int
errorCode
,
const
QString
&
errorMsg
);
void
_geoFenceManagerError
(
int
errorCode
,
const
QString
&
errorMsg
);
...
...
src/comm/MAVLinkProtocol.cc
View file @
4d23912a
...
...
@@ -73,7 +73,7 @@ MAVLinkProtocol::MAVLinkProtocol(QGCApplication* app)
MAVLinkProtocol
::~
MAVLinkProtocol
()
{
storeSettings
();
#ifndef __mobile__
_closeLogFile
();
#endif
...
...
@@ -162,7 +162,7 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
if
(
!
_linkMgr
->
links
()
->
contains
(
link
))
{
return
;
}
// receiveMutex.lock();
mavlink_message_t
message
;
mavlink_status_t
status
;
...
...
@@ -214,6 +214,8 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
{
decodedFirstPacket
=
true
;
/*
* Handled in Vehicle.cc now.
mavlink_status_t* mavlinkStatus = mavlink_get_channel_status(mavlinkChannel);
if (!(mavlinkStatus->flags & MAVLINK_STATUS_FLAG_IN_MAVLINK1) && (mavlinkStatus->flags & MAVLINK_STATUS_FLAG_OUT_MAVLINK1)) {
qDebug() << "switch to mavlink 2.0" << mavlinkStatus << mavlinkChannel << mavlinkStatus->flags;
...
...
@@ -222,6 +224,7 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
qDebug() << "switch to mavlink 1.0" << mavlinkStatus << mavlinkChannel << mavlinkStatus->flags;
mavlinkStatus->flags |= MAVLINK_STATUS_FLAG_OUT_MAVLINK1;
}
*/
if
(
message
.
msgid
==
MAVLINK_MSG_ID_RADIO_STATUS
)
{
...
...
@@ -255,7 +258,7 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
#ifndef __mobile__
// Log data
if
(
!
_logSuspendError
&&
!
_logSuspendReplay
&&
_tempLogFile
.
isOpen
())
{
uint8_t
buf
[
MAVLINK_MAX_PACKET_LEN
+
sizeof
(
quint64
)];
...
...
@@ -280,7 +283,7 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
_stopLogging
();
_logSuspendError
=
true
;
}
// Check for the vehicle arming going by. This is used to trigger log save.
if
(
!
_logPromptForSave
&&
message
.
msgid
==
MAVLINK_MSG_ID_HEARTBEAT
)
{
mavlink_heartbeat_t
state
;
...
...
@@ -412,7 +415,7 @@ bool MAVLinkProtocol::_closeLogFile(void)
return
true
;
}
}
return
false
;
}
...
...
@@ -458,11 +461,11 @@ void MAVLinkProtocol::_stopLogging(void)
void
MAVLinkProtocol
::
checkForLostLogFiles
(
void
)
{
QDir
tempDir
(
QStandardPaths
::
writableLocation
(
QStandardPaths
::
TempLocation
));
QString
filter
(
QString
(
"*.%1"
).
arg
(
_logFileExtension
));
QFileInfoList
fileInfoList
=
tempDir
.
entryInfoList
(
QStringList
(
filter
),
QDir
::
Files
);
qDebug
()
<<
"Orphaned log file count"
<<
fileInfoList
.
count
();
foreach
(
const
QFileInfo
fileInfo
,
fileInfoList
)
{
qDebug
()
<<
"Orphaned log file"
<<
fileInfo
.
filePath
();
if
(
fileInfo
.
size
()
==
0
)
{
...
...
@@ -488,10 +491,10 @@ void MAVLinkProtocol::suspendLogForReplay(bool suspend)
void
MAVLinkProtocol
::
deleteTempLogFiles
(
void
)
{
QDir
tempDir
(
QStandardPaths
::
writableLocation
(
QStandardPaths
::
TempLocation
));
QString
filter
(
QString
(
"*.%1"
).
arg
(
_logFileExtension
));
QFileInfoList
fileInfoList
=
tempDir
.
entryInfoList
(
QStringList
(
filter
),
QDir
::
Files
);
foreach
(
const
QFileInfo
fileInfo
,
fileInfoList
)
{
QFile
::
remove
(
fileInfo
.
filePath
());
}
...
...
src/uas/MavlinkLogManager.cc
View file @
4d23912a
This diff is collapsed.
Click to expand it.
src/uas/MavlinkLogManager.h
View file @
4d23912a
...
...
@@ -131,6 +131,8 @@ private slots:
private:
bool
_sendLog
(
const
QString
&
logFile
);
bool
_processUploadResponse
(
int
http_code
,
QByteArray
&
data
);
bool
_createNewLog
();
int
_getFirstSelected
();
private:
QString
_description
;
...
...
@@ -144,6 +146,10 @@ private:
MavlinkLogFiles
*
_currentLogfile
;
Vehicle
*
_vehicle
;
bool
_logRunning
;
bool
_loggingDisabled
;
FILE
*
_currentSavingFileFd
;
QString
_currentSavingFileStr
;
uint16_t
_sequence
;
};
#endif
src/ui/preferences/MavlinkSettings.qml
View file @
4d23912a
...
...
@@ -37,12 +37,10 @@ Rectangle {
var
selected
=
0
for
(
var
i
=
0
;
i
<
QGroundControl
.
mavlinkLogManager
.
logFiles
.
count
;
i
++
)
{
var
logFile
=
QGroundControl
.
mavlinkLogManager
.
logFiles
.
get
(
i
)
console
.
log
(
logFile
.
selected
)
if
(
logFile
.
selected
)
selected
++
}
_selectedCount
=
selected
console
.
log
(
_selectedCount
)
}
}
...
...
@@ -296,26 +294,27 @@ Rectangle {
id
:
logFilesColumn
spacing
:
ScreenTools
.
defaultFontPixelWidth
anchors.centerIn
:
parent
width
:
ScreenTools
.
defaultFontPixelWidth
*
68
Rectangle
{
width
:
ScreenTools
.
defaultFontPixelWidth
*
52
width
:
ScreenTools
.
defaultFontPixelWidth
*
64
height
:
ScreenTools
.
defaultFontPixelHeight
*
10
anchors.horizontalCenter
:
parent
.
horizontalCenter
color
:
qgcPal
.
window
Shade
color
:
qgcPal
.
window
border.color
:
qgcPal
.
text
border.width
:
0.5
ListView
{
width
:
ScreenTools
.
defaultFontPixelWidth
*
5
0
height
:
ScreenTools
.
defaultFontPixelHeight
*
9
width
:
ScreenTools
.
defaultFontPixelWidth
*
5
6
height
:
ScreenTools
.
defaultFontPixelHeight
*
8.75
anchors.centerIn
:
parent
orientation
:
ListView
.
Vertical
model
:
QGroundControl
.
mavlinkLogManager
.
logFiles
clip
:
true
delegate
:
Rectangle
{
width
:
ScreenTools
.
defaultFontPixelWidth
*
48
width
:
ScreenTools
.
defaultFontPixelWidth
*
52
height
:
ScreenTools
.
defaultFontPixelHeight
*
1.25
color
:
index
%
2
==
0
?
qgcPal
.
window
:
qgcPal
.
windowShade
anchors.horizontalCenter
:
parent
.
horizontalCenter
;
color
:
qgcPal
.
window
Row
{
width
:
ScreenTools
.
defaultFontPixelWidth
*
46
width
:
ScreenTools
.
defaultFontPixelWidth
*
50
anchors.centerIn
:
parent
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCCheckBox
{
...
...
@@ -327,10 +326,10 @@ Rectangle {
}
QGCLabel
{
text
:
object
.
name
width
:
ScreenTools
.
defaultFontPixelWidth
*
2
0
width
:
ScreenTools
.
defaultFontPixelWidth
*
2
8
}
QGCLabel
{
text
:
object
.
size
text
:
Number
(
object
.
size
).
toLocaleString
(
Qt
.
locale
(),
'
f
'
,
0
)
visible
:
!
object
.
uploading
width
:
ScreenTools
.
defaultFontPixelWidth
*
20
;
horizontalAlignment
:
Text
.
AlignRight
...
...
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