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
6184126f
Commit
6184126f
authored
Nov 14, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add requiresUSBMavlinkStart support
parent
be4e5dc3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
11 deletions
+25
-11
LinkInterface.h
src/comm/LinkInterface.h
+3
-0
MAVLinkProtocol.cc
src/comm/MAVLinkProtocol.cc
+10
-8
SerialLink.cc
src/comm/SerialLink.cc
+10
-2
SerialLink.h
src/comm/SerialLink.h
+2
-1
No files found.
src/comm/LinkInterface.h
View file @
6184126f
...
...
@@ -125,6 +125,9 @@ public:
/// set into the link when it is added to LinkManager
uint8_t
getMavlinkChannel
(
void
)
const
{
Q_ASSERT
(
_mavlinkChannelSet
);
return
_mavlinkChannel
;
}
/// @return true: "sh /etc/init.d/rc.usb" must be sent on link to start mavlink
virtual
bool
requiresUSBMavlinkStart
(
void
)
const
{
return
false
;
}
// These are left unimplemented in order to cause linker errors which indicate incorrect usage of
// connect/disconnect on link directly. All connect/disconnect calls should be made through LinkManager.
bool
connect
(
void
);
...
...
src/comm/MAVLinkProtocol.cc
View file @
6184126f
...
...
@@ -200,14 +200,16 @@ void MAVLinkProtocol::_linkStatusChanged(LinkInterface* link, bool connected)
// Use the same shared pointer as LinkManager
_connectedLinks
.
append
(
_linkMgr
->
sharedPointerForLink
(
link
));
// Send command to start MAVLink
// XXX hacky but safe
// Start NSH
const
char
init
[]
=
{
0x0d
,
0x0d
,
0x0d
,
0x0d
};
link
->
writeBytes
(
init
,
sizeof
(
init
));
const
char
*
cmd
=
"sh /etc/init.d/rc.usb
\n
"
;
link
->
writeBytes
(
cmd
,
strlen
(
cmd
));
link
->
writeBytes
(
init
,
4
);
if
(
link
->
requiresUSBMavlinkStart
())
{
// Send command to start MAVLink
// XXX hacky but safe
// Start NSH
const
char
init
[]
=
{
0x0d
,
0x0d
,
0x0d
,
0x0d
};
link
->
writeBytes
(
init
,
sizeof
(
init
));
const
char
*
cmd
=
"sh /etc/init.d/rc.usb
\n
"
;
link
->
writeBytes
(
cmd
,
strlen
(
cmd
));
link
->
writeBytes
(
init
,
4
);
}
}
else
{
bool
found
=
false
;
for
(
int
i
=
0
;
i
<
_connectedLinks
.
count
();
i
++
)
{
...
...
src/comm/SerialLink.cc
View file @
6184126f
...
...
@@ -15,10 +15,8 @@
#ifdef __android__
#include "qserialport.h"
#include "qserialportinfo.h"
#else
#include <QSerialPort>
#include <QSerialPortInfo>
#endif
#include "SerialLink.h"
...
...
@@ -26,6 +24,7 @@
#include "MG.h"
#include "QGCLoggingCategory.h"
#include "QGCApplication.h"
#include "QGCSerialPortInfo.h"
QGC_LOGGING_CATEGORY
(
SerialLinkLog
,
"SerialLinkLog"
)
...
...
@@ -380,6 +379,15 @@ LinkConfiguration* SerialLink::getLinkConfiguration()
return
_config
;
}
bool
SerialLink
::
requiresUSBMavlinkStart
(
void
)
const
{
if
(
_port
)
{
return
QGCSerialPortInfo
(
*
_port
).
boardTypePixhawk
();
}
else
{
return
false
;
}
}
//--------------------------------------------------------------------------
//-- SerialConfiguration
...
...
src/comm/SerialLink.h
View file @
6184126f
...
...
@@ -119,7 +119,8 @@ public:
void
requestReset
();
bool
isConnected
()
const
;
qint64
getConnectionSpeed
()
const
;
bool
requiresUSBMavlinkStart
(
void
)
const
;
// These are left unimplemented in order to cause linker errors which indicate incorrect usage of
// connect/disconnect on link directly. All connect/disconnect calls should be made through LinkManager.
bool
connect
(
void
);
...
...
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