Commit 9a7f6786 authored by Achim Morschhauser's avatar Achim Morschhauser
Browse files

ADC calibrate #6 save cal

parent b9bc7b72
......@@ -97,6 +97,9 @@ public:
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);
};
#endif /* INCLUDE_OBS_CALIBRATION_VECTOR_HPP_ */
......@@ -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);
}
int Obs_Calibration_Vector::parse_adc_calibration(std::string line,
......@@ -334,3 +333,13 @@ 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
......@@ -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";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment