Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
587238c2
Commit
587238c2
authored
Mar 30, 2011
by
James Goppert
Browse files
Fixed serial lag issues.
parent
cbcb6dc5
Changes
3
Hide whitespace changes
Inline
Side-by-side
lib/QMapControl/src/mapnetwork.cpp
View file @
587238c2
...
...
@@ -100,7 +100,8 @@ namespace qmapcontrol
// Silently ignore map request for a
// 0xn pixel map
qDebug
()
<<
"QMapControl: IGNORED 0x0 pixel map request, widthxheight:"
<<
pm
.
width
()
<<
"x"
<<
pm
.
height
();
qDebug
()
<<
"QMapControl: HTML ERROR MESSAGE:"
<<
ax
<<
"at "
<<
__FILE__
<<
__LINE__
;
// showing this html error message is horribly time consuming
//qDebug() << "QMapControl: HTML ERROR MESSAGE:" << ax << "at " << __FILE__ << __LINE__;
}
else
{
...
...
@@ -108,7 +109,8 @@ namespace qmapcontrol
// TODO Error is currently undetected
//qDebug() << "NETWORK_PIXMAP_ERROR: " << ax;
qDebug
()
<<
"QMapControl external library: ERROR loading map:"
<<
"width:"
<<
pm
.
width
()
<<
"heigh:"
<<
pm
.
height
()
<<
"at "
<<
__FILE__
<<
__LINE__
;
qDebug
()
<<
"QMapControl: HTML ERROR MESSAGE:"
<<
ax
<<
"at "
<<
__FILE__
<<
__LINE__
;
// showing this html error message is horribly time consuming
//qDebug() << "QMapControl: HTML ERROR MESSAGE:" << ax << "at " << __FILE__ << __LINE__;
}
}
...
...
src/comm/SerialInterface.h
View file @
587238c2
...
...
@@ -118,7 +118,7 @@ public:
virtual
bool
isOpen
()
=
0
;
virtual
bool
isWritable
()
=
0
;
virtual
bool
bytesAvailable
()
=
0
;
virtual
qint64
bytesAvailable
()
=
0
;
virtual
int
write
(
const
char
*
data
,
qint64
size
)
=
0
;
virtual
void
read
(
char
*
data
,
qint64
numBytes
)
=
0
;
virtual
void
flush
()
=
0
;
...
...
@@ -141,17 +141,20 @@ signals:
void
aboutToClose
();
public:
SerialQextserial
(
QString
porthandle
,
QextSerialPort
::
QueryMode
mode
)
:
_port
(
NULL
)
{
std
::
cout
<<
"DEBUG: "
<<
porthandle
.
toStdString
()
<<
std
::
endl
;
_port
=
new
QextSerialPort
(
porthandle
,
QextSerialPort
::
Polling
);
QObject
::
connect
(
_port
,
SIGNAL
(
aboutToClose
()),
this
,
SIGNAL
(
aboutToClose
()));
}
~
SerialQextserial
()
{
delete
_port
;
_port
=
NULL
;
}
virtual
bool
isOpen
()
{
return
_port
->
isOpen
();
}
virtual
bool
isWritable
()
{
return
_port
->
isWritable
();
}
virtual
bool
bytesAvailable
()
{
virtual
qint64
bytesAvailable
()
{
return
_port
->
bytesAvailable
();
}
virtual
int
write
(
const
char
*
data
,
qint64
size
)
{
...
...
@@ -203,12 +206,17 @@ public:
SerialQserial
(
QString
porthandle
,
QIODevice
::
OpenModeFlag
flag
=
QIODevice
::
ReadWrite
)
:
_port
(
NULL
)
{
QObject
::
connect
(
_port
,
SIGNAL
(
aboutToClose
()),
this
,
SIGNAL
(
aboutToClose
()));
settings
.
setBaudRate
(
QPortSettings
::
BAUDR_
384
00
);
settings
.
setStopBits
(
QPortSettings
::
STOP_
2
);
settings
.
setBaudRate
(
QPortSettings
::
BAUDR_
576
00
);
settings
.
setStopBits
(
QPortSettings
::
STOP_
1
);
settings
.
setDataBits
(
QPortSettings
::
DB_8
);
settings
.
setFlowControl
(
QPortSettings
::
FLOW_OFF
);
settings
.
setParity
(
QPortSettings
::
PAR_NONE
);
_port
=
new
QSerialPort
(
porthandle
,
settings
);
_port
->
setCommTimeouts
(
QSerialPort
::
CtScheme_NonBlockingRead
);
}
~
SerialQserial
()
{
delete
_port
;
_port
=
NULL
;
}
virtual
bool
isOpen
()
{
return
_port
->
isOpen
();
...
...
@@ -216,7 +224,7 @@ public:
virtual
bool
isWritable
()
{
_port
->
isWritable
();
}
virtual
bool
bytesAvailable
()
{
virtual
qint64
bytesAvailable
()
{
return
_port
->
bytesAvailable
();
}
virtual
int
write
(
const
char
*
data
,
qint64
size
)
{
...
...
@@ -234,11 +242,11 @@ public:
}
virtual
void
open
(
QIODevice
::
OpenModeFlag
flag
)
{
_port
->
open
(
flag
);
std
::
cout
<<
"opened port"
<<
std
::
endl
;
//flush()
;
}
virtual
void
setBaudRate
(
SerialInterface
::
baudRateType
baudrate
)
{
// TODO get the baudrate enum to map to one another
settings
.
setBaudRate
(
QPortSettings
::
BAUDR_
384
00
);
settings
.
setBaudRate
(
QPortSettings
::
BAUDR_
576
00
);
}
virtual
void
setParity
(
SerialInterface
::
parityType
parity
)
{
settings
.
setParity
(
QPortSettings
::
PAR_NONE
);
...
...
src/comm/SerialLink.cc
View file @
587238c2
...
...
@@ -191,6 +191,7 @@ void SerialLink::readBytes()
const
qint64
maxLength
=
2048
;
char
data
[
maxLength
];
qint64
numBytes
=
port
->
bytesAvailable
();
//qDebug() << "numBytes: " << numBytes;
if
(
numBytes
>
0
)
{
/* Read as much data in buffer as possible without overflow */
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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