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
43f7d967
Commit
43f7d967
authored
Dec 14, 2021
by
Achim Morschhauser
Browse files
Check if other program reading from ObsDAQ
parent
a946e602
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/driver_obs_obsdaq.cpp
View file @
43f7d967
...
...
@@ -114,9 +114,24 @@ driver_obs_obsdaq::driver_obs_obsdaq(std::string port, int baud,
case
1
:
break
;
default:
find_baud
();
stop
();
set_baud
(
baud
);
// Check if sthg is arriving
int
n
=
0
;
int
N
=
10
;
char
buf
[
11
];
while
(
receive_raw
(
buf
,
10
,
0.2
)
==
-
1
&&
n
<
N
){
send
(
"$M"
);
n
++
;
}
if
(
n
<
N
){
throw
std
::
invalid_argument
(
"OTHER PROGRAM MAY BE READING FROM ObsDAQ! ABORTING."
);
}
if
(
find_baud
()
==
0
){
stop
();
// Probably obsolete as set in find_baud
set_baud
(
baud
);
}
else
{
throw
std
::
invalid_argument
(
"No ObsDAQ FOUND! ABORTING."
);
}
break
;
}
...
...
@@ -1574,11 +1589,13 @@ int driver_obs_obsdaq::set_baud(int baud) {
***************************************************************************/
int
driver_obs_obsdaq
::
find_baud
()
{
int
ret
;
// Try to find serial port
Driver_Obs_Serial
::
find_baud
(
this
,
ret
=
Driver_Obs_Serial
::
find_baud
(
this
,
static_cast
<
int
(
Driver_Obs_Serial
::*
)(
int
)
>
(
&
driver_obs_obsdaq
::
check_baud
));
return
(
0
);
return
(
ret
);
}
...
...
usr/src/OBSDAQ_Calibrate.cpp
View file @
43f7d967
...
...
@@ -62,6 +62,7 @@ int main(int argc, char* argv[]) {
buffer_obs_pipe
buf
(
5
);
// Initialize new OBSDAQ device
std
::
cout
<<
"OBSDAQ Initializing. Please wait!"
<<
std
::
endl
;
driver_obs_obsdaq
obsdaq
=
driver_obs_obsdaq
(
par
.
get_str
(
"PORT_VEC"
),
par
.
get_int
(
"BAUD_VEC"
),
&
buf
,
&
cal
,
par
.
get_int
(
"ADDRESS"
));
...
...
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