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
Achim Morschhauser
GeomagLogger
Commits
cc971b06
Commit
cc971b06
authored
Mar 11, 2021
by
Thomas Edwards
Browse files
Modified ioctl and timing as part of stall debugging
parent
9f297b4d
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/Filter_Obs.cpp
View file @
cc971b06
...
...
@@ -306,7 +306,7 @@ int Filter_Obs::lowpass_PLASMON_1Hz(buffer_obs* buffer_in,
// =================================================
//
//int counter = 0;
//
std::string datastr;
std
::
string
datastr
;
while
(
1
)
{
// Grab new data
...
...
@@ -318,16 +318,17 @@ int Filter_Obs::lowpass_PLASMON_1Hz(buffer_obs* buffer_in,
this_msec
=
this_timespec
.
tv_nsec
;
//counter++;
/*
data
->
string
(
&
datastr
,
5
);
std::cerr << "INCOMING: " << std::endl;
//
std::cerr << "INCOMING: " << std::endl;
std
::
cerr
<<
data
->
get_sec
()
<< "."
// << "."
<<
" "
<<
data
->
get_msec
()
<<
" "
<<
datastr
<<
" "
<< counter
//
<< counter
<<
std
::
endl
;
*/
// One data point is produced from filter1 for each block of
// data, corresponding to its output filter frequency
...
...
src/driver_serial.cpp
View file @
cc971b06
...
...
@@ -194,6 +194,7 @@ int driver_serial::receive(char *buf, int buflen, double timeout,
// Starting time and current time
struct
timespec
start_time
,
end_time
;
// struct timespec test_time;
//////////////////////////////////////////////////////////////////////////////
//
...
...
@@ -209,21 +210,23 @@ int driver_serial::receive(char *buf, int buflen, double timeout,
// Timeout in nanoseconds
if
(
timeout
>
0
){
clock_gettime
(
CLOCK_REALTIME
,
&
start_time
);
// clock_gettime(CLOCK_REALTIME, &start_time);
clock_gettime
(
CLOCK_MONOTONIC_RAW
,
&
start_time
);
}
// Repeat loop until all termination characters have been received
while
(
n
<
termlen
)
{
//clock_gettime(CLOCK_
REALTIME
, &test_time);
//fprintf(stderr,"LOOP TIME: %d\n",(int)(test_time.tv_nsec/1e3));
//
clock_gettime(CLOCK_
MONOTONIC
, &test_time);
//
fprintf(stderr,"LOOP TIME: %d\n",(int)(test_time.tv_nsec/1e3));
//
// Check for timeout
//
if
(
timeout
>
0
)
{
clock_gettime
(
CLOCK_REALTIME
,
&
end_time
);
// clock_gettime(CLOCK_REALTIME, &end_time);
clock_gettime
(
CLOCK_MONOTONIC_RAW
,
&
end_time
);
if
(
(
end_time
.
tv_sec
-
start_time
.
tv_sec
)
+
end_time
.
tv_nsec
/
1e9
>=
start_time
.
tv_nsec
/
1e9
+
timeout
)
{
//flush();
...
...
@@ -699,7 +702,8 @@ int driver_serial::init() {
// O_NDELAY - Use no-blocking I/O. Ignore control characters and
// transmit raw data- REMOVED as it overwrites VMIN and VTIME
if
((
fd
=
open
((
char
*
)
port
.
c_str
(),
O_RDWR
|
O_NOCTTY
|
O_NDELAY
))
<
0
)
{
// if ((fd = open((char *) port.c_str(), O_RDWR | O_NOCTTY | O_NDELAY)) < 0) {
if
((
fd
=
open
((
char
*
)
port
.
c_str
(),
O_RDWR
))
<
0
)
{
std
::
cerr
<<
"Couldn't open serial port "
<<
port
<<
std
::
endl
;
return
(
-
1
);
}
...
...
@@ -736,14 +740,16 @@ int driver_serial::init() {
// IGNBRK - Ignore break conditions
// IGNPAR - Ignore parity errors
tio
.
c_iflag
=
IGNBRK
|
IGNPAR
;
// tio.c_iflag = IGNBRK | IGNPAR;
tio
.
c_iflag
&=
(
IGNBRK
|
IGNPAR
);
//
// Set the output flags (c_oflag)
//
// No output processing.
tio
.
c_oflag
=
0
;
// tio.c_oflag = 0;
tio
.
c_oflag
&=
~
OPOST
;
//
// Set the flag constants (c_cflag)
...
...
@@ -752,14 +758,15 @@ int driver_serial::init() {
// CS8 - Eight bits per byte
// CREAD - Enable to receive data
// CLOCAL - Ignore modem control lines
tio
.
c_cflag
=
CS8
|
CREAD
|
CLOCAL
;
//
tio.c_cflag = CS8 | CREAD | CLOCAL;
tio
.
c_cflag
&=
(
CS8
|
CREAD
|
CLOCAL
);
//
// Set the local flags (c_lflag)
//
// No higher-level input processing, non-canonical.
tio
.
c_lflag
=
0
;
// tio.c_lflag = 0;
tio
.
c_lflag
&=
~
ICANON
;
//
// Set some special characters (c_cc).
...
...
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