Commit 63dc9511 authored by Achim Morschhauser's avatar Achim Morschhauser
Browse files

auto_calibrate

parent 065a4fd4
......@@ -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);
......
Supports Markdown
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