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
740da9fe
Commit
740da9fe
authored
Dec 06, 2021
by
Achim Morschhauser
Browse files
Allow to read single datum for ObsDAQ
parent
87b8349b
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/driver_obs_obsdaq.cpp
View file @
740da9fe
...
...
@@ -179,18 +179,21 @@ int driver_obs_obsdaq::get(data_obs_vector *data) {
// Stop free-run mode (just in case).
stop
();
//
Synchronize channels
send
(
"#PP10000500"
);
//
Channel synchronization
checked_
send
(
"#PP10000500"
,
""
,
0
,
1
);
usleep
(
200e3
);
send
(
"#PP00000000"
);
int
res
=
sleep
(
5
);
std
::
cerr
<<
"PROBLEM WIH SLEEP: "
<<
res
<<
std
::
endl
;
checked_send
(
"#PP00000000"
,
""
,
0
,
1
);
usleep
(
2e6
);
// Flush
usleep
(
1e6
);
flush
();
// Ask for latest values.
send
(
"#A"
);
// Wait for answer
if
(
receive
(
buf
,
sizeof
(
buf
),
1
,
&
recv_time
)
>=
0
)
{
if
(
receive
(
buf
,
sizeof
(
buf
),
0
,
&
recv_time
)
>=
0
)
{
// Parse data from answer
if
(
parse_data_ascii
(
data
,
buf
)
>=
0
)
{
...
...
@@ -448,7 +451,7 @@ int driver_obs_obsdaq::calibrate(int repeat, std::string mode,
// Get temperature
get
(
&
data
);
double
T
=
data
.
get_supp
(
1
);
std
::
cout
<<
"
T: "
<<
std
::
endl
;
std
::
cout
<<
"
OBSDAQ temperature: "
<<
T
<<
std
::
endl
;
// Iterate over all three channels
for
(
int
i
=
0
;
i
<
3
;
i
++
)
{
...
...
@@ -1069,6 +1072,9 @@ int driver_obs_obsdaq::parse_data_ascii(data_obs_vector *data, char *buf) {
std
::
vector
<
double
>
n
;
unsigned
long
int
n32
,
num
;
// Flag for mode: 1 -> free-run; 2 -> single data request; 0: undefined
char
mode
=
0
;
// Set data to missing
data
->
set_values_MD
();
n
.
assign
(
data
->
get_N
(),
data
->
get_MD
());
...
...
@@ -1079,10 +1085,16 @@ int driver_obs_obsdaq::parse_data_ascii(data_obs_vector *data, char *buf) {
//
/////////////////////////////////////////////////////////////////////////
//std::cerr << "Received ASCII: " << buf << " / " << strlen(buf) << std::endl;
std
::
cerr
<<
"Received ASCII: "
<<
buf
<<
" / "
<<
strlen
(
buf
)
<<
std
::
endl
;
// CHeck if ASCII free-run format
if
(
strncmp
(
buf
,
"*"
,
1
)
!=
0
)
{
// Check if ASCII free-run format
if
(
strncmp
(
buf
,
"*"
,
1
)
==
0
)
{
mode
=
1
;
}
else
if
(
strncmp
(
buf
,
">"
,
1
)
==
0
)
{
mode
=
2
;
}
else
{
std
::
cerr
<<
"WARNING: INVALID DATA FORMAT"
<<
std
::
endl
;
return
(
-
1
);
}
...
...
@@ -1104,7 +1116,9 @@ int driver_obs_obsdaq::parse_data_ascii(data_obs_vector *data, char *buf) {
}
// Skip t:
pos
=
pos
+
2
;
if
(
mode
==
1
){
pos
=
pos
+
2
;
}
// TODO: Use all auxiliary channels
// ObsDaq Voltage and Temperature
...
...
@@ -1146,8 +1160,8 @@ int driver_obs_obsdaq::parse_data_ascii(data_obs_vector *data, char *buf) {
n[4]=n[4]*0.000575+1.0;
*/
// Save the data
data
->
set_
data
(
n
);
// Save the data
data
->
set_
all
(
n
);
return
(
0
);
...
...
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