Skip to content
GitLab
Menu
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
63dc9511
Commit
63dc9511
authored
Nov 06, 2018
by
Achim Morschhauser
Browse files
auto_calibrate
parent
065a4fd4
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/driver_obs_obsdaq.cpp
View file @
63dc9511
...
...
@@ -322,7 +322,7 @@ int driver_obs_obsdaq::freerun(double freq) {
usleep
(
1e6
);
flush
();
if
(
freq
<
10.0
){
if
(
driver_obs
::
freq
<
10.0
){
// Use ASCII mode
checked_send
(
"#CS"
,
""
,
0
,
1
);
parse_data
=
&
driver_obs_obsdaq
::
parse_data_ascii
;
...
...
@@ -452,6 +452,7 @@ int driver_obs_obsdaq::auto_calibrate(int channel, int repeat){
// Check if calibration is finished
sprintf
(
cmd
,
"$%1dRR"
,
channel
);
usleep
(
4.0
/
driver_obs
::
freq
*
1e6
);
while
(
checked_send
(
cmd
,
"R0"
,
2
,
5
)
<
0
){
}
...
...
@@ -488,6 +489,14 @@ int driver_obs_obsdaq::auto_calibrate(int channel, int repeat){
// Calculate the average of calibration constants and send them to
// OBSDAQ.
//
// Offset
n32
=
((
int32_t
)
(
scale
/
repeat
)
+
(
int32_t
)
0x800000L
)
^
(
int32_t
)
0x800000L
;
sprintf
(
cmd
,
"$%1dWF%06X"
,
channel
,
n32
);
send
(
cmd
);
std
::
cerr
<<
"Set offset: "
<<
scale
/
repeat
<<
" "
<<
cmd
<<
std
::
endl
;
// Full-scale
n32
=
((
int32_t
)
(
offset
/
repeat
)
+
(
int32_t
)
0x800000L
)
...
...
@@ -495,15 +504,7 @@ int driver_obs_obsdaq::auto_calibrate(int channel, int repeat){
sprintf
(
cmd
,
"$%1dWO%06X"
,
channel
,
n32
);
send
(
cmd
);
std
::
cerr
<<
"AUTO CAL: "
<<
scale
/
repeat
<<
" "
<<
cmd
<<
std
::
endl
;
// Offset
n32
=
((
int32_t
)
(
scale
/
repeat
)
+
(
int32_t
)
0x800000L
)
^
(
int32_t
)
0x800000L
;
sprintf
(
cmd
,
"$%1dWF%06X"
,
channel
,
n32
);
send
(
cmd
);
std
::
cerr
<<
"AUTO CAL: "
<<
scale
/
repeat
<<
" "
<<
cmd
<<
std
::
endl
;
std
::
cerr
<<
"Set scale: "
<<
scale
/
repeat
<<
" "
<<
cmd
<<
std
::
endl
;
return
(
0
);
...
...
Write
Preview
Supports
Markdown
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