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
9a7f6786
Commit
9a7f6786
authored
Nov 14, 2018
by
Achim Morschhauser
Browse files
ADC calibrate
#6
save cal
parent
b9bc7b72
Changes
3
Hide whitespace changes
Inline
Side-by-side
include/Obs_Calibration_Vector.hpp
View file @
9a7f6786
...
...
@@ -96,6 +96,9 @@ public:
std
::
string
&
config
,
struct
adc_cal
&
cal
);
int
parse_adc_calibration
(
std
::
string
line
,
std
::
string
&
config
,
struct
adc_cal
&
cal
,
std
::
string
&
comment
);
/** Set the internal ADC calibration file */
int
set_adc_calibrate
(
std
::
string
filename
);
};
...
...
src/Obs_Calibration_Vector.cpp
View file @
9a7f6786
...
...
@@ -265,9 +265,12 @@ int Obs_Calibration_Vector::add_adc_calibrate(std::string config,
if
(
file
.
is_open
())
{
while
(
getline
(
file
,
line
)
)
{
// Parse from line
if
(
parse_adc_calibration
(
line
,
config
,
cal
))
if
(
parse_adc_calibration
(
line
,
config
,
cal
)
==
0
)
{
// Save key-value pair
map_ADC
[
config
]
=
cal
;
std
::
cout
<<
"Read ADC: "
<<
config
<<
" "
<<
cal
.
offset
<<
" "
<<
cal
.
scale
<<
std
::
endl
;
}
}
file
.
close
();
}
else
{
...
...
@@ -319,11 +322,7 @@ int Obs_Calibration_Vector::add_adc_calibrate(std::string config,
line
=
line
.
substr
(
pos_c
+
1
);
pos_c
=
line
.
find
(
';'
);
cal
.
scale
=
line
.
substr
(
0
,
pos_c
);
std
::
cout
<<
"Read ADC: "
<<
config
<<
" "
<<
cal
.
offset
<<
" "
<<
cal
.
scale
<<
std
::
endl
;
return
(
0
);
return
(
0
);
}
int
Obs_Calibration_Vector
::
parse_adc_calibration
(
std
::
string
line
,
...
...
@@ -333,4 +332,14 @@ int Obs_Calibration_Vector::add_adc_calibrate(std::string config,
return
(
parse_adc_calibration
(
line
,
config
,
cal
,
comment
));
}
int
Obs_Calibration_Vector
::
set_adc_calibrate
(
std
::
string
filename
){
file_ADC
=
filename
;
read_adc_calibrate
(
filename
);
return
(
0
);
}
\ No newline at end of file
usr/OBSDAQ_Logger.cpp
View file @
9a7f6786
...
...
@@ -31,7 +31,7 @@ int main() {
// Initialize the calibration constants
Obs_Calibration_Vector
cal
=
Obs_Calibration_Vector
(
X_s
/
R
,
Y_s
/
R
,
Z_s
/
R
);
cal
.
read
_adc_calibrate
(
"usr/ADC.par"
);
cal
.
set
_adc_calibrate
(
"usr/ADC.par"
);
std
::
string
offset
,
scale
,
config
;
config
=
"OD-550C0001/0203/1"
;
...
...
Write
Preview
Markdown
is supported
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