fixed problem with different classes of cameras

This commit is contained in:
eddyem 2015-05-12 17:52:25 +03:00
parent aec7b906e1
commit 891e304df0
3 changed files with 34 additions and 12 deletions

1
.gitignore vendored
View File

@ -1,4 +1,3 @@
.hg* .hg*
*.tgz
.dropbox.attr .dropbox.attr
*~ *~

View File

@ -35,7 +35,7 @@
#include <FindDeviceEthernet.h> #include <FindDeviceEthernet.h>
#include <ApogeeFilterWheel.h> #include <ApogeeFilterWheel.h>
#include <ApogeeCam.h> #include <ApogeeCam.h>
/*
#if defined APOGEE_ASCENT #if defined APOGEE_ASCENT
#define CCD Ascent #define CCD Ascent
#elif defined APOGEE_ALTA #elif defined APOGEE_ALTA
@ -50,9 +50,11 @@
#error "You must define camera type: APOGEE_ASCENT, APOGEE_ALTA, \ #error "You must define camera type: APOGEE_ASCENT, APOGEE_ALTA, \
APOGEE_ALTAF, APOGEE_ASPEN or APOGEE_QUAD" APOGEE_ALTAF, APOGEE_ASPEN or APOGEE_QUAD"
#endif #endif
*/
// static class for CCD device // static class for CCD device
static CCD *alta = NULL; //static CCD *alta = NULL;
static ApogeeCam *alta = NULL;
static bool isethernet = false; static bool isethernet = false;
int ApnGlueIsEthernet(){ int ApnGlueIsEthernet(){
if(isethernet) return 1; if(isethernet) return 1;
@ -143,7 +145,7 @@ CamParams *getCamParams(std::string & msg){
par.model = GetItemFromFindStr(msg, "model="); par.model = GetItemFromFindStr(msg, "model=");
return &par; return &par;
} }
/*
static bool IsProperDevice(const std::string & msg){ static bool IsProperDevice(const std::string & msg){
std::string model = GetItemFromFindStr(msg, "model="); std::string model = GetItemFromFindStr(msg, "model=");
std::string std::string
@ -161,6 +163,17 @@ static bool IsProperDevice(const std::string & msg){
return false; return false;
#endif #endif
return(0 == model.compare(0, cam.size(), cam) ? true : false ); return(0 == model.compare(0, cam.size(), cam) ? true : false );
}*/
static bool assignAlta(const std::string & msg){
std::string model = GetItemFromFindStr(msg, "model=");
if(model.compare(0,6,"Ascent")==0) alta = (Ascent*) new Ascent();
else if(model.compare(0,4,"Alta")==0) alta = (Alta*) new Alta();
else if(model.compare(0,5,"AltaF")==0) alta = (AltaF*) new AltaF();
else if(model.compare(0,5,"Aspen")==0) alta = (Aspen*) new Aspen();
else if(model.compare(0,4,"Quad")==0) alta = (Quad*) new Quad();
else return false;
return true;
} }
/** /**
@ -198,9 +211,13 @@ void ApnGlueSetSubnet(char *val){
static CamParams *findUSB(){ static CamParams *findUSB(){
FindDeviceUsb look4cam; FindDeviceUsb look4cam;
std::string msg = look4cam.Find(); std::string msg = look4cam.Find();
if(!IsProperDevice(msg)) // device not found // if(!IsProperDevice(msg)) // device not found
return NULL; // return NULL;
std::cout << "Camera MSG_ID=" << msg << std::endl; std::cout << "Camera MSG_ID=" << msg << std::endl;
if(!assignAlta(msg)){
std::cerr << "Unknown camera!" << std::endl;
return NULL;
}
isethernet = false; isethernet = false;
return getCamParams(msg); return getCamParams(msg);
} }
@ -214,9 +231,13 @@ static CamParams *findNET(){
DBG(subnet); DBG(subnet);
clearenv(); // clear all proxy & other data clearenv(); // clear all proxy & other data
std::string msg = look4cam.Find(subnet); std::string msg = look4cam.Find(subnet);
if(!IsProperDevice(msg)) // device not found // if(!IsProperDevice(msg)) // device not found
return NULL; // return NULL;
std::cout << "Camera MSG_ID=" << msg << std::endl; std::cout << "Camera MSG_ID=" << msg << std::endl;
if(!assignAlta(msg)){
std::cerr << "Unknown camera!" << std::endl;
return NULL;
}
isethernet = true; isethernet = true;
return getCamParams(msg); return getCamParams(msg);
} }
@ -234,14 +255,15 @@ int ApnGlueOpen(_U_ unsigned int id){
TRY{ TRY{
if(cam_msg_id.size()){ // user had set MSG param, try it if(cam_msg_id.size()){ // user had set MSG param, try it
DBG("Try to find camera by given id"); DBG("Try to find camera by given id");
if(IsProperDevice(cam_msg_id) && (campar = getCamParams(cam_msg_id))){ //if(IsProperDevice(cam_msg_id) && (campar = getCamParams(cam_msg_id))){
if(assignAlta(cam_msg_id) && (campar = getCamParams(cam_msg_id))){
found = true; found = true;
if(GetItemFromFindStr(cam_msg_id, "interface=") == "ethernet"){ if(GetItemFromFindStr(cam_msg_id, "interface=") == "ethernet"){
clearenv(); // clear all proxy & other data clearenv(); // clear all proxy & other data
isethernet = true; isethernet = true;
}else }else
isethernet = false; isethernet = false;
} }else std::cerr << "Can't find camera with given ID" << std::endl;
} }
if(!found && subnet.size()){ // there's an ability of network camera presence if(!found && subnet.size()){ // there's an ability of network camera presence
DBG("Try to find network camera"); DBG("Try to find network camera");
@ -258,7 +280,7 @@ int ApnGlueOpen(_U_ unsigned int id){
ioInterface = "ethernet"; ioInterface = "ethernet";
else else
ioInterface = "usb"; ioInterface = "usb";
alta = (CCD*) new CCD(); //alta = (CCD*) new CCD();
alta->OpenConnection(ioInterface, campar->address, campar->FirmwareRev, campar->Id); alta->OpenConnection(ioInterface, campar->address, campar->FirmwareRev, campar->Id);
alta->Init(); alta->Init();
}CATCH(ALTA_NO_SUCH_DEVICE); }CATCH(ALTA_NO_SUCH_DEVICE);

View File

@ -441,6 +441,8 @@ DBG("open %d", Ncam);
} }
} }
if(only_T || exptime < 0) goto returning;
// òÁÚÍÅÒ ĞÉËÓÅÌÑ: %g x %g // òÁÚÍÅÒ ĞÉËÓÅÌÑ: %g x %g
//info(_("Pixel size: %g x %g"), pixX, pixY); //info(_("Pixel size: %g x %g"), pixX, pixY);
@ -459,7 +461,6 @@ DBG("open %d", Ncam);
if(hbin > binw) hbin = binw; if(hbin > binw) hbin = binw;
if(vbin > binh) vbin = binh; if(vbin > binh) vbin = binh;
if(only_T) goto returning;
AutoadjustFanSpeed(FALSE); AutoadjustFanSpeed(FALSE);
if(noflash) ApnGluePreFlash(0); if(noflash) ApnGluePreFlash(0);
if(noclean) ApnGlueDisablePostExpFlushing(1); if(noclean) ApnGlueDisablePostExpFlushing(1);