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

ADC calibrate #6 save cal

parent b9bc7b72
...@@ -96,6 +96,9 @@ public: ...@@ -96,6 +96,9 @@ public:
std::string& config, struct adc_cal& cal); std::string& config, struct adc_cal& cal);
int parse_adc_calibration(std::string line, int parse_adc_calibration(std::string line,
std::string& config, struct adc_cal& cal, std::string& comment); std::string& config, struct adc_cal& cal, std::string& comment);
/** Set the internal ADC calibration file */
int set_adc_calibrate(std::string filename);
}; };
......
...@@ -265,9 +265,12 @@ int Obs_Calibration_Vector::add_adc_calibrate(std::string config, ...@@ -265,9 +265,12 @@ int Obs_Calibration_Vector::add_adc_calibrate(std::string config,
if (file.is_open()) { if (file.is_open()) {
while ( getline (file,line) ) { while ( getline (file,line) ) {
// Parse from line // Parse from line
if (parse_adc_calibration(line,config,cal)) if (parse_adc_calibration(line,config,cal)==0) {
// Save key-value pair // Save key-value pair
map_ADC[config]=cal; map_ADC[config]=cal;
std::cout << "Read ADC: " << config << " " << cal.offset <<
" " << cal.scale << std::endl;
}
} }
file.close(); file.close();
} else { } else {
...@@ -319,11 +322,7 @@ int Obs_Calibration_Vector::add_adc_calibrate(std::string config, ...@@ -319,11 +322,7 @@ int Obs_Calibration_Vector::add_adc_calibrate(std::string config,
line=line.substr(pos_c+1); line=line.substr(pos_c+1);
pos_c=line.find(';'); pos_c=line.find(';');
cal.scale = line.substr(0,pos_c); cal.scale = line.substr(0,pos_c);
std::cout << "Read ADC: " << config << " " << cal.offset << return(0);
" " << cal.scale << std::endl;
return(0);
} }
int Obs_Calibration_Vector::parse_adc_calibration(std::string line, int Obs_Calibration_Vector::parse_adc_calibration(std::string line,
...@@ -333,4 +332,14 @@ int Obs_Calibration_Vector::add_adc_calibrate(std::string config, ...@@ -333,4 +332,14 @@ int Obs_Calibration_Vector::add_adc_calibrate(std::string config,
return(parse_adc_calibration(line,config,cal,comment)); 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() { ...@@ -31,7 +31,7 @@ int main() {
// Initialize the calibration constants // Initialize the calibration constants
Obs_Calibration_Vector cal = Obs_Calibration_Vector(X_s/R,Y_s/R,Z_s/R); 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; std::string offset,scale,config;
config="OD-550C0001/0203/1"; 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