added iodelay with setttings

This commit is contained in:
Dhanya Maliakal
2016-02-24 18:05:17 +01:00
parent 0b1710c267
commit 5af05c24c1
9 changed files with 60 additions and 26 deletions

View File

@ -163,7 +163,7 @@ int energyConversion::writeCalibrationFile(string fname, int *gain, int *offset,
/* I/O */
slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string fname, detectorType myDetectorType, sls_detector_module *myMod){
slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string fname, detectorType myDetectorType, sls_detector_module *myMod, int* iodelay){
@ -353,10 +353,12 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
infile.open(myfname.c_str(),ifstream::binary);
if (infile.is_open()) {
infile.read((char*) myMod->dacs,sizeof(dacs_t)*(myMod->ndac));
infile.read((char*) iodelay,sizeof(iodelay));
infile.read((char*) myMod->chanregs,sizeof(int)*(myMod->nchan));
#ifdef VERBOSE
for(int i=0;i<myMod->ndac;i++)
std::cout << "dac " << i << ":" << myMod->dacs[i] << std::endl;
std::cout << "iodelay:" << *iodelay << std::endl;
#endif
if(infile.eof()){
cout<<endl<<"Error, could not load trimbits end of file, "<<myfname<<", reached."<<endl<<endl;
@ -436,7 +438,7 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
};
int energyConversion::writeSettingsFile(string fname, detectorType myDetectorType, sls_detector_module mod){
int energyConversion::writeSettingsFile(string fname, detectorType myDetectorType, sls_detector_module mod, int* iodelay){
ofstream outfile;
@ -512,8 +514,10 @@ int energyConversion::writeSettingsFile(string fname, detectorType myDetectorTyp
#ifdef VERBOSE
for(int i=0;i<mod.ndac;i++)
std::cout << "dac " << i << ":" << mod.dacs[i] << std::endl;
std::cout << "iodelay: " << *iodelay << std::endl;
#endif
outfile.write((char*)mod.dacs, sizeof(dacs_t)*(mod.ndac));
outfile.write((char*)iodelay, sizeof(iodelay));
outfile.write((char*)mod.chanregs, sizeof(int)*(mod.nchan));
outfile.close();