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
5f536d0d
Commit
5f536d0d
authored
Jun 04, 2013
by
Michael Carpenter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Addition of extra debug output to comms console during Serial Comms issues
parent
3fba7256
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
3 deletions
+26
-3
LinkInterface.h
src/comm/LinkInterface.h
+2
-0
SerialLink.cc
src/comm/SerialLink.cc
+14
-3
DebugConsole.cc
src/ui/DebugConsole.cc
+8
-0
DebugConsole.h
src/ui/DebugConsole.h
+2
-0
No files found.
src/comm/LinkInterface.h
View file @
5f536d0d
...
@@ -232,6 +232,8 @@ signals:
...
@@ -232,6 +232,8 @@ signals:
/** @brief Communication error occured */
/** @brief Communication error occured */
void
communicationError
(
const
QString
&
linkname
,
const
QString
&
error
);
void
communicationError
(
const
QString
&
linkname
,
const
QString
&
error
);
void
communicationUpdate
(
const
QString
&
linkname
,
const
QString
&
text
);
/** @brief destroying element */
/** @brief destroying element */
void
deleteLink
(
LinkInterface
*
const
link
);
void
deleteLink
(
LinkInterface
*
const
link
);
...
...
src/comm/SerialLink.cc
View file @
5f536d0d
...
@@ -20,7 +20,6 @@
...
@@ -20,7 +20,6 @@
#ifdef _WIN32
#ifdef _WIN32
#include "windows.h"
#include "windows.h"
#endif
#endif
#ifdef _WIN32
#ifdef _WIN32
#include <qextserialenumerator.h>
#include <qextserialenumerator.h>
#endif
#endif
...
@@ -397,6 +396,8 @@ void SerialLink::run()
...
@@ -397,6 +396,8 @@ void SerialLink::run()
if
(
!
hardwareConnect
())
if
(
!
hardwareConnect
())
{
{
//Need to error out here.
//Need to error out here.
emit
communicationError
(
getName
(),
"Error connecting: "
+
port
->
errorString
());
return
;
}
}
...
@@ -406,7 +407,7 @@ void SerialLink::run()
...
@@ -406,7 +407,7 @@ void SerialLink::run()
quint64
bytes
=
0
;
quint64
bytes
=
0
;
bool
triedreset
=
false
;
bool
triedreset
=
false
;
bool
triedDTR
=
false
;
bool
triedDTR
=
false
;
int
timeout
=
25
00
;
int
timeout
=
50
00
;
forever
forever
{
{
{
{
...
@@ -442,6 +443,7 @@ void SerialLink::run()
...
@@ -442,6 +443,7 @@ void SerialLink::run()
if
(
!
triedDTR
&&
triedreset
)
if
(
!
triedDTR
&&
triedreset
)
{
{
triedDTR
=
true
;
triedDTR
=
true
;
communicationUpdate
(
getName
(),
"No data to receive on COM port. Attempting to reset via DTR signal"
);
qDebug
()
<<
"No data!!! Attempting reset via DTR."
;
qDebug
()
<<
"No data!!! Attempting reset via DTR."
;
port
->
setDtr
(
true
);
port
->
setDtr
(
true
);
this
->
msleep
(
250
);
this
->
msleep
(
250
);
...
@@ -450,11 +452,13 @@ void SerialLink::run()
...
@@ -450,11 +452,13 @@ void SerialLink::run()
else
if
(
!
triedreset
)
else
if
(
!
triedreset
)
{
{
qDebug
()
<<
"No data!!! Attempting reset via reboot command."
;
qDebug
()
<<
"No data!!! Attempting reset via reboot command."
;
communicationUpdate
(
getName
(),
"No data to receive on COM port. Assuming possible terminal mode, attempting to reset via
\"
reboot
\"
command"
);
port
->
write
(
"reboot
\r\n
"
,
8
);
port
->
write
(
"reboot
\r\n
"
,
8
);
triedreset
=
true
;
triedreset
=
true
;
}
}
else
else
{
{
communicationUpdate
(
getName
(),
"No data to receive on COM port...."
);
qDebug
()
<<
"No data!!!"
;
qDebug
()
<<
"No data!!!"
;
}
}
}
}
...
@@ -665,7 +669,14 @@ bool SerialLink::hardwareConnect()
...
@@ -665,7 +669,14 @@ bool SerialLink::hardwareConnect()
port
->
setCommTimeouts
(
QSerialPort
::
CtScheme_NonBlockingRead
);
port
->
setCommTimeouts
(
QSerialPort
::
CtScheme_NonBlockingRead
);
connectionStartTime
=
MG
::
TIME
::
getGroundTimeNow
();
connectionStartTime
=
MG
::
TIME
::
getGroundTimeNow
();
port
->
open
();
if
(
!
port
->
open
())
{
emit
communicationUpdate
(
getName
(),
"Error opening port: "
+
port
->
errorString
());
}
else
{
emit
communicationUpdate
(
getName
(),
"Opened port!"
);
}
bool
connectionUp
=
isConnected
();
bool
connectionUp
=
isConnected
();
if
(
connectionUp
)
{
if
(
connectionUp
)
{
...
...
src/ui/DebugConsole.cc
View file @
5f536d0d
...
@@ -215,6 +215,12 @@ void DebugConsole::removeLink(LinkInterface* const linkInterface)
...
@@ -215,6 +215,12 @@ void DebugConsole::removeLink(LinkInterface* const linkInterface)
}
}
if
(
linkInterface
==
currLink
)
currLink
=
NULL
;
if
(
linkInterface
==
currLink
)
currLink
=
NULL
;
}
}
void
DebugConsole
::
linkStatusUpdate
(
const
QString
&
name
,
const
QString
&
text
)
{
m_ui
->
receiveText
->
appendPlainText
(
text
);
// Ensure text area scrolls correctly
m_ui
->
receiveText
->
ensureCursorVisible
();
}
void
DebugConsole
::
linkSelected
(
int
linkId
)
void
DebugConsole
::
linkSelected
(
int
linkId
)
{
{
...
@@ -222,6 +228,7 @@ void DebugConsole::linkSelected(int linkId)
...
@@ -222,6 +228,7 @@ void DebugConsole::linkSelected(int linkId)
if
(
currLink
)
{
if
(
currLink
)
{
disconnect
(
currLink
,
SIGNAL
(
bytesReceived
(
LinkInterface
*
,
QByteArray
)),
this
,
SLOT
(
receiveBytes
(
LinkInterface
*
,
QByteArray
)));
disconnect
(
currLink
,
SIGNAL
(
bytesReceived
(
LinkInterface
*
,
QByteArray
)),
this
,
SLOT
(
receiveBytes
(
LinkInterface
*
,
QByteArray
)));
disconnect
(
currLink
,
SIGNAL
(
connected
(
bool
)),
this
,
SLOT
(
setConnectionState
(
bool
)));
disconnect
(
currLink
,
SIGNAL
(
connected
(
bool
)),
this
,
SLOT
(
setConnectionState
(
bool
)));
disconnect
(
currLink
,
SIGNAL
(
communicationUpdate
(
QString
,
QString
)),
this
,
SLOT
(
linkStatusUpdate
(
QString
,
QString
)));
}
}
// Clear data
// Clear data
m_ui
->
receiveText
->
clear
();
m_ui
->
receiveText
->
clear
();
...
@@ -230,6 +237,7 @@ void DebugConsole::linkSelected(int linkId)
...
@@ -230,6 +237,7 @@ void DebugConsole::linkSelected(int linkId)
currLink
=
links
[
linkId
];
currLink
=
links
[
linkId
];
connect
(
currLink
,
SIGNAL
(
bytesReceived
(
LinkInterface
*
,
QByteArray
)),
this
,
SLOT
(
receiveBytes
(
LinkInterface
*
,
QByteArray
)));
connect
(
currLink
,
SIGNAL
(
bytesReceived
(
LinkInterface
*
,
QByteArray
)),
this
,
SLOT
(
receiveBytes
(
LinkInterface
*
,
QByteArray
)));
connect
(
currLink
,
SIGNAL
(
connected
(
bool
)),
this
,
SLOT
(
setConnectionState
(
bool
)));
connect
(
currLink
,
SIGNAL
(
connected
(
bool
)),
this
,
SLOT
(
setConnectionState
(
bool
)));
connect
(
currLink
,
SIGNAL
(
communicationUpdate
(
QString
,
QString
)),
this
,
SLOT
(
linkStatusUpdate
(
QString
,
QString
)));
setConnectionState
(
currLink
->
isConnected
());
setConnectionState
(
currLink
->
isConnected
());
}
}
...
...
src/ui/DebugConsole.h
View file @
5f536d0d
...
@@ -96,6 +96,8 @@ public slots:
...
@@ -96,6 +96,8 @@ public slots:
/** @brief A new special symbol is selected */
/** @brief A new special symbol is selected */
void
specialSymbolSelected
(
const
QString
&
text
);
void
specialSymbolSelected
(
const
QString
&
text
);
void
linkStatusUpdate
(
const
QString
&
name
,
const
QString
&
text
);
protected
slots
:
protected
slots
:
/** @brief Draw information overlay */
/** @brief Draw information overlay */
void
paintEvent
(
QPaintEvent
*
event
);
void
paintEvent
(
QPaintEvent
*
event
);
...
...
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