diff --git a/slsDetectorSoftware/slsDetector/slsDetector.cpp b/slsDetectorSoftware/slsDetector/slsDetector.cpp index 22ad9d4b5..bbdcc25e7 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetector.cpp @@ -1764,7 +1764,6 @@ int slsDetector::readRegister(int addr){ PREAMP, TEMPERATURE, HUMIDITY, - DETECTOR_BIAS }{}; */ @@ -4544,7 +4543,52 @@ int slsDetector:: writeAngularConversion(ofstream &ofs) { } +int slsDetector::loadImageToDetector(int index,string const fname){ + int retval; + int fnum=F_LOAD_IMAGE; + int ret=FAIL; + char mess[100]; + short int arg[1280]; +#ifdef VERBOSE + std::cout<< std::endl<< "Loading "; + if(!index) + std::cout<<"Dark"; + else + std::cout<<"Gain"; + std::cout<<" image from file " << fname << std::endl; +#endif + + if(readDataFile(fname,arg)){ + std::cout<< "Could not open file "<< fname << std::endl; + return -1; + } + if (thisDetector->onlineFlag==ONLINE_FLAG) { + if (controlSocket) { + if (controlSocket->Connect()>=0) { + controlSocket->SendDataOnly(&fnum,sizeof(fnum)); + controlSocket->SendDataOnly(&index,sizeof(index)); + controlSocket->SendDataOnly(arg,sizeof(arg)); + controlSocket->ReceiveDataOnly(&ret,sizeof(ret)); + if (ret!=FAIL) + controlSocket->ReceiveDataOnly(&retval,sizeof(retval)); + else { + controlSocket->ReceiveDataOnly(mess,sizeof(mess)); + std::cout<< "Detector returned error: " << mess << std::endl; + } + controlSocket->Disconnect(); + if (ret==FORCE_UPDATE) + updateDetector(); + } + + } + } + if (ret==FAIL) { + std::cout<< "failed " << std::endl; + return -1; + } + return 0; +} diff --git a/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp b/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp index 7eaaba563..7fac72256 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp @@ -109,6 +109,14 @@ slsDetectorCommand::slsDetectorCommand() { descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdThreaded; i++; + descrToFuncMap[i].m_pFuncName="darkimage"; // + descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdImage; + i++; + + descrToFuncMap[i].m_pFuncName="gainimage"; // + descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdImage; + i++; + /* trim/cal directories */ descrToFuncMap[i].m_pFuncName="trimdir"; //OK descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdSettingsDir; @@ -438,12 +446,14 @@ slsDetectorCommand::slsDetectorCommand() { descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDAC; i++; + /* r/w timers */ + descrToFuncMap[i].m_pFuncName="temp_adc"; // - descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDAC; + descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdADC; i++; descrToFuncMap[i].m_pFuncName="temp_fpga"; // - descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDAC; + descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdADC; i++; /* r/w timers */ @@ -769,8 +779,10 @@ string slsDetectorCommand::executeLine(int narg, char *args[], int action) { /* otherwise one could try if truncated key is unique */ - size_t p=(descrToFuncMap[i].m_pFuncName).find(key); - if (p==0) { + // size_t p=(descrToFuncMap[i].m_pFuncName).find(); + // if (p==0) { + + if(key==descrToFuncMap[i].m_pFuncName){ #ifdef VERBOSE std::cout<> ichan >> idata; + if (ssstr.fail() || ssstr.bad()) { + interrupt=1; + break; + } + if (ichan!=iline) { + std::cout<< " Expected channel "<< iline <<" but read channel "<< ichan << std::endl; + interrupt=1; + break; + } else { + if (iline