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
57ef8d67
Commit
57ef8d67
authored
Oct 14, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1995 from DonLakeFlyer/HomePositionFixes
Home position fixes
parents
1c552042
24ae7b64
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
51 additions
and
82 deletions
+51
-82
MissionEditor.cc
src/MissionEditor/MissionEditor.cc
+0
-46
MissionEditor.h
src/MissionEditor/MissionEditor.h
+0
-2
MissionEditor.qml
src/MissionEditor/MissionEditor.qml
+1
-3
QGCApplication.cc
src/QGCApplication.cc
+2
-0
MissionItemEditor.qml
src/QmlControls/MissionItemEditor.qml
+18
-24
LogReplayLink.cc
src/comm/LogReplayLink.cc
+4
-0
MAVLinkProtocol.cc
src/comm/MAVLinkProtocol.cc
+14
-0
MAVLinkProtocol.h
src/comm/MAVLinkProtocol.h
+12
-7
No files found.
src/MissionEditor/MissionEditor.cc
View file @
57ef8d67
...
...
@@ -142,52 +142,6 @@ void MissionEditor::removeMissionItem(int index)
_recalcAll
();
}
void
MissionEditor
::
moveUp
(
int
index
)
{
if
(
!
_canEdit
)
{
qWarning
()
<<
"addMissionItem called with _canEdit == false"
;
return
;
}
if
(
_missionItems
->
count
()
<
2
||
index
<=
0
||
index
>=
_missionItems
->
count
())
{
return
;
}
MissionItem
item1
=
*
qobject_cast
<
MissionItem
*>
(
_missionItems
->
get
(
index
-
1
));
MissionItem
item2
=
*
qobject_cast
<
MissionItem
*>
(
_missionItems
->
get
(
index
));
_missionItems
->
removeAt
(
index
-
1
);
_missionItems
->
removeAt
(
index
-
1
);
_missionItems
->
insert
(
index
-
1
,
new
MissionItem
(
item2
,
_missionItems
));
_missionItems
->
insert
(
index
,
new
MissionItem
(
item1
,
_missionItems
));
_recalcAll
();
}
void
MissionEditor
::
moveDown
(
int
index
)
{
if
(
!
_canEdit
)
{
qWarning
()
<<
"addMissionItem called with _canEdit == false"
;
return
;
}
if
(
_missionItems
->
count
()
<
2
||
index
>=
_missionItems
->
count
()
-
1
)
{
return
;
}
MissionItem
item1
=
*
qobject_cast
<
MissionItem
*>
(
_missionItems
->
get
(
index
));
MissionItem
item2
=
*
qobject_cast
<
MissionItem
*>
(
_missionItems
->
get
(
index
+
1
));
_missionItems
->
removeAt
(
index
);
_missionItems
->
removeAt
(
index
);
_missionItems
->
insert
(
index
,
new
MissionItem
(
item2
,
_missionItems
));
_missionItems
->
insert
(
index
+
1
,
new
MissionItem
(
item1
,
_missionItems
));
_recalcAll
();
}
void
MissionEditor
::
loadMissionFromFile
(
void
)
{
QString
errorString
;
...
...
src/MissionEditor/MissionEditor.h
View file @
57ef8d67
...
...
@@ -48,8 +48,6 @@ public:
Q_INVOKABLE
void
loadMissionFromFile
(
void
);
Q_INVOKABLE
void
saveMissionToFile
(
void
);
Q_INVOKABLE
void
removeMissionItem
(
int
index
);
Q_INVOKABLE
void
moveUp
(
int
index
);
Q_INVOKABLE
void
moveDown
(
int
index
);
// Property accessors
...
...
src/MissionEditor/MissionEditor.qml
View file @
57ef8d67
...
...
@@ -440,6 +440,7 @@ QGCView {
MissionItemEditor
{
missionItem
:
object
width
:
parent
.
width
readOnly
:
object
.
sequenceNumber
==
0
&&
liveHomePositionAvailable
onClicked
:
setCurrentItem
(
object
.
sequenceNumber
)
...
...
@@ -451,9 +452,6 @@ QGCView {
setCurrentItem
(
newCurrentItem
)
}
}
onMoveUp
:
controller
.
moveUp
(
object
.
sequenceNumber
)
onMoveDown
:
controller
.
moveDown
(
object
.
sequenceNumber
)
}
}
// ListView
...
...
src/QGCApplication.cc
View file @
57ef8d67
...
...
@@ -448,9 +448,11 @@ bool QGCApplication::_initForNormalAppBoot(void)
splashScreen
->
finish
(
mainWindow
);
mainWindow
->
splashScreenFinished
();
#ifndef __mobile__
// Now that main window is up check for lost log files
connect
(
this
,
&
QGCApplication
::
checkForLostLogFiles
,
MAVLinkProtocol
::
instance
(),
&
MAVLinkProtocol
::
checkForLostLogFiles
);
emit
checkForLostLogFiles
();
#endif
// Load known link configurations
LinkManager
::
instance
()
->
loadLinkConfigurationList
();
...
...
src/QmlControls/MissionItemEditor.qml
View file @
57ef8d67
...
...
@@ -13,17 +13,16 @@ import QGroundControl.Palette 1.0
Rectangle
{
id
:
_root
property
var
missionItem
property
var
missionItem
///< MissionItem associated with this editor
property
bool
readOnly
///< true: read only view, false: full editing view
signal
clicked
signal
remove
signal
moveUp
signal
moveDown
height
:
missionItem
.
isCurrentItem
?
(
missionItem
.
textFieldFacts
.
count
*
(
measureTextField
.
height
+
_margin
))
+
(
missionItem
.
checkboxFacts
.
count
*
(
measureCheckbox
.
height
+
_margin
))
+
commandPicker
.
height
+
deleteButton
.
height
+
(
_margin
*
9
)
:
commandPicker
.
height
+
(
deleteButton
.
visible
?
deleteButton
.
height
:
0
)
+
(
_margin
*
9
)
:
commandPicker
.
height
+
(
_margin
*
2
)
color
:
missionItem
.
isCurrentItem
?
qgcPal
.
buttonHighlight
:
qgcPal
.
windowShade
...
...
@@ -63,7 +62,6 @@ Rectangle {
onClicked
:
_root
.
clicked
()
}
QGCComboBox
{
id
:
commandPicker
anchors.leftMargin
:
ScreenTools
.
defaultFontPixelWidth
*
10
...
...
@@ -71,7 +69,7 @@ Rectangle {
anchors.right
:
parent
.
right
currentIndex
:
missionItem
.
commandByIndex
model
:
missionItem
.
commandNames
visible
:
missionItem
.
sequenceNumber
!=
0
visible
:
missionItem
.
sequenceNumber
!=
0
// Item 0 is home position, can't change item type
onActivated
:
missionItem
.
commandByIndex
=
index
}
...
...
@@ -79,7 +77,7 @@ Rectangle {
Rectangle
{
anchors.fill
:
commandPicker
color
:
qgcPal
.
button
visible
:
missionItem
.
sequenceNumber
==
0
visible
:
missionItem
.
sequenceNumber
==
0
// Item 0 is home position, can't change item type
QGCLabel
{
id
:
homeLabel
...
...
@@ -119,6 +117,7 @@ Rectangle {
height
:
textField
.
height
QGCLabel
{
id
:
textFieldLabel
anchors.baseline
:
textField
.
baseline
text
:
object
.
name
}
...
...
@@ -129,6 +128,14 @@ Rectangle {
width
:
_editFieldWidth
showUnits
:
true
fact
:
object
visible
:
!
_root
.
readOnly
}
FactLabel
{
anchors.baseline
:
textFieldLabel
.
baseline
anchors.right
:
parent
.
right
fact
:
object
visible
:
_root
.
readOnly
}
}
}
...
...
@@ -160,26 +167,13 @@ Rectangle {
readonly
property
real
buttonWidth
:
(
width
-
(
_margin
*
2
))
/
3
QGCButton
{
id
:
deleteButton
width
:
parent
.
buttonWidth
text
:
"
Delete
"
id
:
deleteButton
width
:
parent
.
buttonWidth
text
:
"
Delete
"
visible
:
!
readOnly
onClicked
:
_root
.
remove
()
}
QGCButton
{
width
:
parent
.
buttonWidth
text
:
"
Up
"
onClicked
:
_root
.
moveUp
()
}
QGCButton
{
width
:
parent
.
buttonWidth
text
:
"
Down
"
onClicked
:
_root
.
moveDown
()
}
}
}
// Column
...
...
src/comm/LogReplayLink.cc
View file @
57ef8d67
...
...
@@ -367,7 +367,9 @@ void LogReplayLink::_play(void)
{
// FIXME: With move to link I don't think this is needed any more? Except for the replay widget handling multi-uas?
LinkManager
::
instance
()
->
setConnectionsSuspended
(
tr
(
"Connect not allowed during Flight Data replay."
));
#ifndef __mobile__
MAVLinkProtocol
::
instance
()
->
suspendLogForReplay
(
true
);
#endif
// Make sure we aren't at the end of the file, if we are, reset to the beginning and play from there.
if
(
_logFile
.
atEnd
())
{
...
...
@@ -397,7 +399,9 @@ void LogReplayLink::_play(void)
void
LogReplayLink
::
_pause
(
void
)
{
LinkManager
::
instance
()
->
setConnectionsAllowed
();
#ifndef __mobile__
MAVLinkProtocol
::
instance
()
->
suspendLogForReplay
(
false
);
#endif
_readTickTimer
.
stop
();
...
...
src/comm/MAVLinkProtocol.cc
View file @
57ef8d67
...
...
@@ -33,8 +33,10 @@ Q_DECLARE_METATYPE(mavlink_message_t)
IMPLEMENT_QGC_SINGLETON
(
MAVLinkProtocol
,
MAVLinkProtocol
)
QGC_LOGGING_CATEGORY
(
MAVLinkProtocolLog
,
"MAVLinkProtocolLog"
)
#ifndef __mobile__
const
char
*
MAVLinkProtocol
::
_tempLogFileTemplate
=
"FlightDataXXXXXX"
;
///< Template for temporary log file
const
char
*
MAVLinkProtocol
::
_logFileExtension
=
"mavlink"
;
///< Extension for log files
#endif
/**
* The default constructor will create a new MAVLink object sending heartbeats at
...
...
@@ -52,10 +54,12 @@ MAVLinkProtocol::MAVLinkProtocol(QObject* parent) :
m_actionRetransmissionTimeout
(
100
),
versionMismatchIgnore
(
false
),
systemId
(
QGC
::
defaultSystemId
),
#ifndef __mobile__
_logSuspendError
(
false
),
_logSuspendReplay
(
false
),
_logWasArmed
(
false
),
_tempLogFile
(
QString
(
"%2.%3"
).
arg
(
_tempLogFileTemplate
).
arg
(
_logFileExtension
)),
#endif
_linkMgr
(
LinkManager
::
instance
()),
_heartbeatRate
(
MAVLINK_HEARTBEAT_DEFAULT_RATE
),
_heartbeatsEnabled
(
true
)
...
...
@@ -91,7 +95,9 @@ MAVLinkProtocol::~MAVLinkProtocol()
{
storeSettings
();
#ifndef __mobile__
_closeLogFile
();
#endif
}
void
MAVLinkProtocol
::
loadSettings
()
...
...
@@ -181,10 +187,12 @@ void MAVLinkProtocol::_linkStatusChanged(LinkInterface* link, bool connected)
// Use the same shared pointer as LinkManager
_connectedLinks
.
append
(
LinkManager
::
instance
()
->
sharedPointerForLink
(
link
));
#ifndef __mobile__
if
(
_connectedLinks
.
count
()
==
1
)
{
// This is the first link, we need to start logging
_startLogging
();
}
#endif
// Send command to start MAVLink
// XXX hacky but safe
...
...
@@ -206,10 +214,12 @@ void MAVLinkProtocol::_linkStatusChanged(LinkInterface* link, bool connected)
Q_UNUSED
(
found
);
Q_ASSERT
(
found
);
#ifndef __mobile__
if
(
_connectedLinks
.
count
()
==
0
)
{
// Last link is gone, close out logging
_stopLogging
();
}
#endif
}
}
...
...
@@ -303,6 +313,7 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
rstatus
.
txbuf
,
rstatus
.
noise
,
rstatus
.
remnoise
);
}
#ifndef __mobile__
// Log data
if
(
!
_logSuspendError
&&
!
_logSuspendReplay
&&
_tempLogFile
.
isOpen
())
{
...
...
@@ -339,6 +350,7 @@ void MAVLinkProtocol::receiveBytes(LinkInterface* link, QByteArray b)
}
}
}
#endif
if
(
message
.
msgid
==
MAVLINK_MSG_ID_HEARTBEAT
)
{
// Notify the vehicle manager of the heartbeat. This will create/update vehicles as needed.
...
...
@@ -613,6 +625,7 @@ int MAVLinkProtocol::getHeartbeatRate()
return
_heartbeatRate
;
}
#ifndef __mobile__
/// @brief Closes the log file if it is open
bool
MAVLinkProtocol
::
_closeLogFile
(
void
)
{
...
...
@@ -707,3 +720,4 @@ void MAVLinkProtocol::deleteTempLogFiles(void)
QFile
::
remove
(
fileInfo
.
filePath
());
}
}
#endif
src/comm/MAVLinkProtocol.h
View file @
57ef8d67
...
...
@@ -203,11 +203,13 @@ public slots:
/** @brief Store protocol settings */
void
storeSettings
();
#ifndef __mobile__
/// @brief Deletes any log files which are in the temp directory
static
void
deleteTempLogFiles
(
void
);
/// Checks for lost log files
void
checkForLostLogFiles
(
void
);
#endif
protected:
bool
m_multiplexingEnabled
;
///< Enable/disable packet multiplexing
...
...
@@ -281,22 +283,25 @@ private:
~
MAVLinkProtocol
();
void
_linkStatusChanged
(
LinkInterface
*
link
,
bool
connected
);
#ifndef __mobile__
bool
_closeLogFile
(
void
);
void
_startLogging
(
void
);
void
_stopLogging
(
void
);
/// List of all links connected to protocol. We keep SharedLinkInterface objects
/// which are QSharedPointer's in order to maintain reference counts across threads.
/// This way Link deletion works correctly.
QList
<
SharedLinkInterface
>
_connectedLinks
;
bool
_logSuspendError
;
///< true: Logging suspended due to error
bool
_logSuspendReplay
;
///< true: Logging suspended due to replay
bool
_logWasArmed
;
///< true: vehicle was armed during logging
QGCTemporaryFile
_tempLogFile
;
///< File to log to
static
const
char
*
_tempLogFileTemplate
;
///< Template for temporary log file
static
const
char
*
_logFileExtension
;
///< Extension for log files
#endif
/// List of all links connected to protocol. We keep SharedLinkInterface objects
/// which are QSharedPointer's in order to maintain reference counts across threads.
/// This way Link deletion works correctly.
QList
<
SharedLinkInterface
>
_connectedLinks
;
LinkManager
*
_linkMgr
;
...
...
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