diff --git a/CMakeLists.txt b/CMakeLists.txt index 5936694..20cf250 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -56,26 +56,29 @@ if(DEFINED IMAGEVIEW AND IMAGEVIEW STREQUAL "yes") endif() add_subdirectory(Dummy_cameras) -list(APPEND ${PROJ}_INCLUDE_DIRS Dummy_cameras) -list(APPEND ${PROJ}_LIBRARIES ${DUMMYLIB}) -include_directories(Dummy_cameras) +#list(APPEND ${PROJ}_INCLUDE_DIRS Dummy_cameras) +#list(APPEND ${PROJ}_LIBRARIES ${DUMMYLIB}) +#include_directories(Dummy_cameras) + +#add_custom_target(plugins) +#add_dependencies(plugins devdummy) # additional modules with CCD/CMOS support if(DEFINED ZWO AND ZWO STREQUAL "yes") add_subdirectory(ZWO_cameras) - list(APPEND ${PROJ}_INCLUDE_DIRS ZWO_cameras) - add_definitions(-DUSEZWO) - list(APPEND ${PROJ}_LIBRARIES ${ZWOLIB}) - include_directories(ZWO_cameras) +# list(APPEND ${PROJ}_INCLUDE_DIRS ZWO_cameras) +# add_definitions(-DUSEZWO) +# list(APPEND ${PROJ}_LIBRARIES ${ZWOLIB}) +# include_directories(ZWO_cameras) endif() # additional modules with CCD/CMOS support if(DEFINED FLI AND FLI STREQUAL "yes") add_subdirectory(FLI_cameras) - list(APPEND ${PROJ}_INCLUDE_DIRS FLI_cameras) - add_definitions(-DUSEFLI) - list(APPEND ${PROJ}_LIBRARIES ${FLILIB}) - include_directories(FLI_cameras) +# list(APPEND ${PROJ}_INCLUDE_DIRS FLI_cameras) +# add_definitions(-DUSEFLI) +# list(APPEND ${PROJ}_LIBRARIES ${FLILIB}) +# include_directories(FLI_cameras) endif() diff --git a/Dummy_cameras/CMakeLists.txt b/Dummy_cameras/CMakeLists.txt index 1b9651d..700289e 100644 --- a/Dummy_cameras/CMakeLists.txt +++ b/Dummy_cameras/CMakeLists.txt @@ -1,12 +1,12 @@ cmake_minimum_required(VERSION 3.20) -set(CCDLIB dummy_module) -set(DUMMYLIB ${CCDLIB} PARENT_SCOPE) +set(CCDLIB devdummy) find_package(PkgConfig REQUIRED) pkg_check_modules(${CCDLIB} REQUIRED usefull_macros) - aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} SRC) -add_library(${CCDLIB} ${SRC}) -target_link_libraries(${CCDLIB} ${${CCDLIB}_LIBRARIES}) + include_directories(${${CCDLIB}_INCLUDE_DIRS} ..) link_directories(${${CCDLIB}_LIBRARY_DIRS}) + +add_library(${CCDLIB} SHARED ${SRC}) +target_link_libraries(${CCDLIB} ${${CCDLIB}_LIBRARIES}) diff --git a/Dummy_cameras/dummyfunc.c b/Dummy_cameras/dummyfunc.c index 962c687..d993d64 100644 --- a/Dummy_cameras/dummyfunc.c +++ b/Dummy_cameras/dummyfunc.c @@ -25,7 +25,11 @@ #include #include -#include "dummyfunc.h" +#include "ccdfunc.h" + +extern Camera camera; +extern Focuser focuser; +extern Wheel wheel; static const int filtermax = 5; static const float focmaxpos = 10.; @@ -120,7 +124,7 @@ static int camshutter(_U_ shutter_op s){ static int camsetgeom(frameformat *f){ if(!f) return FALSE; - DUMMYcam.geometry = *f; + camera.geometry = *f; return TRUE; } @@ -135,7 +139,7 @@ static int camgmg(float *mg){ } static int camggl(frameformat *max, frameformat *step){ - if(max) *max = DUMMYcam.array; + if(max) *max = camera.array; if(step) *step = (frameformat){1,1,1,1}; return TRUE; } @@ -210,6 +214,7 @@ static int stub(){ } static void vstub(){ + FNAME(); return; } static int istub(_U_ int N){return TRUE;} @@ -217,13 +222,14 @@ static int istub(_U_ int N){return TRUE;} /* * Global objects: camera, focuser and wheel */ -Camera DUMMYcam = { +__attribute__ ((visibility("default"))) Camera camera = { .check = stub, .Ndevices = 1, .close = vstub, .pollcapture = campoll, .capture = camcapt, .cancel = camcancel, + .startexposition = stub, // setters: .setDevNo = setdevno, .setbrightness = camsetbrig, @@ -258,7 +264,7 @@ Camera DUMMYcam = { .geometry = {0}, }; -Focuser DUMMYfocus = { +__attribute__ ((visibility("default"))) Focuser focuser = { .check = stub, .Ndevices = 1, .close = vstub, @@ -274,7 +280,7 @@ Focuser DUMMYfocus = { .getMinPos = focmp, }; -Wheel DUMMYwheel = { +__attribute__ ((visibility("default"))) Wheel wheel = { .check = stub, .Ndevices = 1, .close = vstub, diff --git a/Dummy_cameras/dummyfunc.h b/Dummy_cameras/dummyfunc.h deleted file mode 100644 index ca4cb30..0000000 --- a/Dummy_cameras/dummyfunc.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * This file is part of the CCD_Capture project. - * Copyright 2022 Edward V. Emelianov . - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#pragma once -#ifndef DUMMYFUNC_H__ -#define DUMMYFUNC_H__ - -#include "ccdfunc.h" - -extern Camera DUMMYcam; -extern Focuser DUMMYfocus; -extern Wheel DUMMYwheel; - -#endif // DUMMYFUNC_H__ diff --git a/FLI_cameras/CMakeLists.txt b/FLI_cameras/CMakeLists.txt index bfb0962..b667ae7 100644 --- a/FLI_cameras/CMakeLists.txt +++ b/FLI_cameras/CMakeLists.txt @@ -1,12 +1,12 @@ cmake_minimum_required(VERSION 3.20) -set(CCDLIB fli_module) -set(FLILIB ${CCDLIB} PARENT_SCOPE) +set(CCDLIB devfli) find_package(PkgConfig REQUIRED) pkg_check_modules(${CCDLIB} REQUIRED fli>=1.71 usefull_macros) aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} SRC) -add_library(${CCDLIB} ${SRC}) -target_link_libraries(${CCDLIB} ${${CCDLIB}_LIBRARIES}) include_directories(${${CCDLIB}_INCLUDE_DIRS} ..) link_directories(${${CCDLIB}_LIBRARY_DIRS}) + +add_library(${CCDLIB} SHARED ${SRC}) +target_link_libraries(${CCDLIB} ${${CCDLIB}_LIBRARIES}) diff --git a/FLI_cameras/flifunc.c b/FLI_cameras/flifunc.c index 19d9714..d74cd8c 100644 --- a/FLI_cameras/flifunc.c +++ b/FLI_cameras/flifunc.c @@ -21,7 +21,11 @@ #include #include -#include "flifunc.h" +#include "ccdfunc.h" + +extern Camera camera; +extern Focuser focuser; +extern Wheel wheel; #define LIBVERSIZ 1024 @@ -124,12 +128,12 @@ static int fli_findCCD(){ return FALSE; } if(!camz){ // build cameras list - FLIcam.Ndevices = findcams(FLIDOMAIN_USB | FLIDEVICE_CAMERA, &camz); - if(!FLIcam.Ndevices){ + camera.Ndevices = findcams(FLIDOMAIN_USB | FLIDEVICE_CAMERA, &camz); + if(!camera.Ndevices){ DBG("No cameras"); return FALSE; } - for(int i = 0; i < FLIcam.Ndevices; i++){ + for(int i = 0; i < camera.Ndevices; i++){ DBG("Camera '%s', domain %s", camz[i].name, camz[i].dname); } } @@ -137,7 +141,7 @@ static int fli_findCCD(){ } static int fli_setActiceCam(int n){ if(!camz && !fli_findCCD()) return FALSE; - if(n >= FLIcam.Ndevices){ + if(n >= camera.Ndevices){ return FALSE; } FLIClose(camdev); @@ -157,25 +161,25 @@ static int fli_setActiceCam(int n){ TRYFUNC(FLIGetPixelSize, camdev, &x, &y); if(!fli_err){ DBG("Pixel size: %g x %g", x,y); - FLIcam.pixX = (float)x; - FLIcam.pixY = (float)y; + camera.pixX = (float)x; + camera.pixY = (float)y; } long x0, x1, y0, y1; TRYFUNC(FLIGetVisibleArea, camdev, &x0, &y0, &x1, &y1); if(!fli_err){ DBG("Field of view: (%ld, %ld)(%ld, %ld)", x0, y0, x1, y1); - FLIcam.field = (frameformat){.w = x1 - x0, .h = y1 - y0, .xoff = x0, .yoff = y0}; + camera.field = (frameformat){.w = x1 - x0, .h = y1 - y0, .xoff = x0, .yoff = y0}; } TRYFUNC(FLIGetArrayArea, camdev, &x0, &y0, &x1, &y1); if(!fli_err){ DBG("Array field: (%ld, %ld)(%ld, %ld)", x0, y0, x1, y1); - FLIcam.array = (frameformat){.w = x1 - x0, .h = y1 - y0, .xoff = x0, .yoff = y0}; + camera.array = (frameformat){.w = x1 - x0, .h = y1 - y0, .xoff = x0, .yoff = y0}; } return TRUE; } static int fli_geomlimits(frameformat *l, frameformat *s){ - if(l) *l = FLIcam.array; + if(l) *l = camera.array; if(s) *s = (frameformat){.w = 1, .h = 1, .xoff = 1, .yoff = 1}; return TRUE; } @@ -187,12 +191,12 @@ static int fli_findFocuser(){ return FALSE; } if(!focz){ - FLIfocus.Ndevices = findcams(FLIDOMAIN_USB | FLIDEVICE_FOCUSER, &focz); - if(!FLIfocus.Ndevices){ + focuser.Ndevices = findcams(FLIDOMAIN_USB | FLIDEVICE_FOCUSER, &focz); + if(!focuser.Ndevices){ DBG("No focusers"); return FALSE; } - for(int i = 0; i < FLIfocus.Ndevices; i++){ + for(int i = 0; i < focuser.Ndevices; i++){ DBG("Focuser '%s', domain %s", focz[i].name, focz[i].dname); } } @@ -200,10 +204,10 @@ static int fli_findFocuser(){ } static int fli_setActiceFocuser(int n){ if(!focz && !fli_findFocuser()) return FALSE; - if(n >= FLIfocus.Ndevices) return FALSE; + if(n >= focuser.Ndevices) return FALSE; FLIClose(focdev); int OK = FALSE; - for(int i = 0; i < FLIfocus.Ndevices; ++i){ + for(int i = 0; i < focuser.Ndevices; ++i){ DBG("Try %s", focz[i].name); TRYFUNC(FLIOpen, &focdev, focz[i].name, focz[i].domain); if(fli_err) continue; @@ -295,12 +299,12 @@ static int fli_findWheel(){ DBG("FLI not found"); return FALSE; } - FLIwheel.Ndevices = findcams(FLIDOMAIN_USB | FLIDEVICE_FILTERWHEEL, &whlz); - if(!FLIwheel.Ndevices){ + wheel.Ndevices = findcams(FLIDOMAIN_USB | FLIDEVICE_FILTERWHEEL, &whlz); + if(!wheel.Ndevices){ DBG("No wheels"); return FALSE; } - for(int i = 0; i < FLIwheel.Ndevices; i++){ + for(int i = 0; i < wheel.Ndevices; i++){ DBG("Wheel '%s', domain %s", whlz[i].name, whlz[i].dname); } return TRUE; @@ -310,10 +314,10 @@ static int fli_wgetpos(int *p); static int fli_setActiceWheel(int n){ if(!whlz && !fli_findWheel()) return FALSE; - if(n >= FLIwheel.Ndevices) return FALSE; + if(n >= wheel.Ndevices) return FALSE; FLIClose(whldev); int OK = FALSE; - for(int i = 0; i < FLIfocus.Ndevices; ++i){ + for(int i = 0; i < focuser.Ndevices; ++i){ DBG("Try %s", whlz[i].name); TRYFUNC(FLIOpen, &whldev, whlz[i].name, whlz[i].domain); if(fli_err) continue; @@ -390,6 +394,17 @@ static int fli_wgett(float *t){ return TRUE; } +static int fli_startexp(){ + DBG("Start exposition"); + TRYFUNC(FLIExposeFrame, camdev); + if(fli_err){ + TRYFUNC(FLICancelExposure, camdev); + return FALSE; + } + capStatus = CAPTURE_PROCESS; + return TRUE; +} + static int fli_pollcapt(capture_status *st, float *remain){ static int errctr = 0; if(capStatus == CAPTURE_READY){ @@ -398,14 +413,7 @@ static int fli_pollcapt(capture_status *st, float *remain){ } if(capStatus == CAPTURE_NO){ // start capture errctr = 0; - DBG("Start exposition"); - TRYFUNC(FLIExposeFrame, camdev); - if(fli_err){ - TRYFUNC(FLICancelExposure, camdev); - if(st) *st = CAPTURE_CANTSTART; - return FALSE; - } - capStatus = CAPTURE_PROCESS; + goto retn; } if(capStatus == CAPTURE_PROCESS){ TRYFUNC(FLIGetExposureStatus, camdev, &tmpl); @@ -428,6 +436,7 @@ static int fli_pollcapt(capture_status *st, float *remain){ }else{ // some error if(st) *st = CAPTURE_ABORTED; capStatus = CAPTURE_NO; + return FALSE; } retn: if(st) *st = capStatus; @@ -469,7 +478,7 @@ static int fli_setgeometry(frameformat *f){ TRYFUNC(FLISetImageArea, camdev, f->xoff, f->yoff, f->xoff + f->w/curhbin, f->yoff + f->h/curvbin); if(fli_err) return FALSE; - FLIcam.geometry = *f; + camera.geometry = *f; return TRUE; } @@ -571,7 +580,7 @@ static int fli_setio(int io){ } static int fli_setexp(float t){ - long e = (long)(t*1000.); + long e = (long)(t*1000.); // milliseconds! TRYFUNC(FLISetExposureTime, camdev, e); if(fli_err) return FALSE; return TRUE; @@ -615,15 +624,15 @@ static void camt_free(cam_t **c, int n, flidev_t dev){ static void fli_closecam(){ DBG("CAMERA CLOSE"); - camt_free(&camz, FLIcam.Ndevices, camdev); + camt_free(&camz, camera.Ndevices, camdev); } static void fli_closefocuser(){ DBG("FOCUSER CLOSE"); - camt_free(&focz, FLIfocus.Ndevices, focdev); + camt_free(&focz, focuser.Ndevices, focdev); } static void fli_closewheel(){ DBG("WHEEL CLOSE"); - camt_free(&whlz, FLIwheel.Ndevices, whldev); + camt_free(&whlz, wheel.Ndevices, whldev); } static int fli_ffalse(_U_ float f){ return FALSE; } @@ -632,12 +641,13 @@ static int fli_fpfalse(_U_ float *f){ return FALSE; } /* * Global objects: camera, focuser and wheel */ -Camera FLIcam = { +Camera camera = { .check = fli_findCCD, .close = fli_closecam, .pollcapture = fli_pollcapt, .capture = fli_capt, .cancel = fli_cancel, + .startexposition = fli_startexp, // setters: .setDevNo = fli_setActiceCam, .setbrightness = fli_ffalse, @@ -665,10 +675,9 @@ Camera FLIcam = { .getTbody = fli_getTbody, .getbin = fli_getbin, .getio = fli_getio, - .geometry = {0}, }; -Focuser FLIfocus = { +Focuser focuser = { .check = fli_findFocuser, .setDevNo = fli_setActiceFocuser, .close = fli_closefocuser, @@ -681,7 +690,7 @@ Focuser FLIfocus = { .setAbsPos = fli_fgoto, }; -Wheel FLIwheel = { +Wheel wheel = { .check = fli_findWheel, .setDevNo = fli_setActiceWheel, .close = fli_closewheel, diff --git a/FLI_cameras/flifunc.h b/FLI_cameras/flifunc.h deleted file mode 100644 index 9875700..0000000 --- a/FLI_cameras/flifunc.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * This file is part of the CCD_Capture project. - * Copyright 2022 Edward V. Emelianov . - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#pragma once -#ifndef FLIFUNC_H__ -#define FLIFUNC_H__ - -#include "ccdfunc.h" - -extern Camera FLIcam; -extern Focuser FLIfocus; -extern Wheel FLIwheel; - -#endif // FLIFUNC_H__ diff --git a/README.md b/Readme.md similarity index 100% rename from README.md rename to Readme.md diff --git a/ZWO_cameras/CMakeLists.txt b/ZWO_cameras/CMakeLists.txt index bf16c3b..6cb099c 100644 --- a/ZWO_cameras/CMakeLists.txt +++ b/ZWO_cameras/CMakeLists.txt @@ -1,12 +1,12 @@ cmake_minimum_required(VERSION 3.20) -set(CCDLIB zwo_module) -set(ZWOLIB ${CCDLIB} PARENT_SCOPE) +set(CCDLIB devzwo) find_package(PkgConfig REQUIRED) pkg_check_modules(${CCDLIB} REQUIRED usefull_macros) aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} SRC) -add_library(${CCDLIB} ${SRC}) -target_link_libraries(${CCDLIB} ${${CCDLIB}_LIBRARIES} -lASICamera2) include_directories(${${CCDLIB}_INCLUDE_DIRS} ..) link_directories(${${CCDLIB}_LIBRARY_DIRS}) + +add_library(${CCDLIB} SHARED ${SRC}) +target_link_libraries(${CCDLIB} ${${CCDLIB}_LIBRARIES} -lASICamera2) diff --git a/ZWO_cameras/zwofunc.c b/ZWO_cameras/zwofunc.c index 78344c0..6a70be1 100644 --- a/ZWO_cameras/zwofunc.c +++ b/ZWO_cameras/zwofunc.c @@ -16,8 +16,495 @@ * along with this program. If not, see . */ -#include "zwofunc.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include -Camera ZWOcam; -Focuser ZWOfocus; -Wheel ZWOwheel; +#include "ccdfunc.h" + +extern Camera camera; +extern Focuser focuser; +extern Wheel wheel; + +// remove all these after removing stubs! +// VVV +static const int filtermax = 5; +static const float focmaxpos = 10.; +static int filterpos = 0; +static float focuserpos = 1.; +// AAA + +static int curbin = 1; +static ASI_BOOL isdark = ASI_FALSE; +static struct{ + float maxgain; + float mingain; + float maxbright; + float minbright; +} extrvalues = {0}; // extremal values + +static double starttime = 0.; // time when exposure started +static float exptime = 0.; // exposition time + +static ASI_CAMERA_INFO caminfo = {0}; + +// setters and getters of some parameters +static int zwo_setfloat(float f, ASI_CONTROL_TYPE t){ + DBG("Try to set float %f, type %d", f, t); + long val = (long) f; + if(ASI_SUCCESS != ASISetControlValue(caminfo.CameraID, t, val, ASI_FALSE)){ + DBG("FAILED"); + return FALSE; + } + return TRUE; +} +static int zwo_getfloat(float *f, ASI_CONTROL_TYPE t){ + if(!f) return FALSE; + long val; ASI_BOOL aut = ASI_FALSE; + if(ASI_SUCCESS != ASIGetControlValue(caminfo.CameraID, t, &val, &aut)) + return FALSE; + *f = (float) val; + return TRUE; +} + +static int asi_checkcam(){ + camera.Ndevices = ASIGetNumOfConnectedCameras(); + DBG("found %d ZWO's", camera.Ndevices); + if(camera.Ndevices) return TRUE; + return FALSE; +} + +static int campoll(capture_status *st, float *remain){ + if(!st) return FALSE; + ASI_EXPOSURE_STATUS s; + if(ASI_SUCCESS != ASIGetExpStatus(caminfo.CameraID, &s)) return FALSE; + switch(s){ + case ASI_EXP_IDLE: + *st = CAPTURE_NO; + break; + case ASI_EXP_WORKING: + *st = CAPTURE_PROCESS; + break; + case ASI_EXP_SUCCESS: + *st = CAPTURE_READY; + break; + default: // failed + *st = CAPTURE_ABORTED; + } + if(remain){ + float diff = exptime - (dtime() - starttime); + if(diff < 0.) diff = 0.; + *remain = diff; + } + return TRUE; +} + +static int camcapt(IMG *ima){ + if(!ima || !ima->data) return FALSE; + unsigned char *d = (unsigned char *)ima->data; + long image_size = ima->h * ima->w * 2; + if(ASI_SUCCESS != ASIGetDataAfterExp(caminfo.CameraID, d, image_size)){ + printf("Couldn't read exposure data\n"); + return 1; + } + return TRUE; +} + +static void camcancel(){ + ASI_EXPOSURE_STATUS s; + if(ASI_SUCCESS == ASIGetExpStatus(caminfo.CameraID, &s) && s == ASI_EXP_WORKING){ + ASIStopExposure(caminfo.CameraID); + } +} + +static int setframetype(int l){ + if(l) isdark = ASI_FALSE; + else isdark = ASI_TRUE; + return TRUE; +} + +static int startcapt(){ + camcancel(); + //red("ISDARK = %s\n", isdark ? "true" : "false"); + if(ASI_SUCCESS == ASIStartExposure(caminfo.CameraID, isdark)){ + starttime = dtime(); + return TRUE; + } + return FALSE; +} + +static void asi_closecam(){ + FNAME(); + if(caminfo.CameraID){ + ASICloseCamera(caminfo.CameraID); + caminfo.CameraID = 0; + } +} + +static int setdevno(int n){ + if(n > camera.Ndevices - 1 || n < 0) return FALSE; + asi_closecam(); + if(ASI_SUCCESS != ASIGetCameraProperty(&caminfo, n)) return FALSE; + DBG("Camera #%d, name: %s, ID: %d", n, caminfo.Name, caminfo.CameraID); + DBG("WxH: %ldx%ld, %s", caminfo.MaxWidth, caminfo.MaxHeight, caminfo.IsColorCam == ASI_TRUE ? "color" : "monochrome"); + DBG("Pixel size: %1.1f mkm; gain: %1.2f e/ADU", caminfo.PixelSize, caminfo.ElecPerADU); +#ifdef EBUG + int *sup = caminfo.SupportedBins; + while(*sup){ + green("Supported bin: %d\n", *sup++); + } +#endif + camera.pixX = camera.pixY = (float)caminfo.PixelSize / 1e6; // um -> m + camera.array = (frameformat){.w = caminfo.MaxWidth, .h = caminfo.MaxHeight, .xoff = 0, .yoff = 0}; + camera.field = camera.array; // initial setup (will update later) + if(ASI_SUCCESS != ASIOpenCamera(caminfo.CameraID)){ + WARNX("Can't open device for camera %s", caminfo.Name); + return FALSE; + } + if(ASI_SUCCESS != ASIInitCamera(caminfo.CameraID)){ + WARNX("Can't init device for camera %s", caminfo.Name); + asi_closecam(); + return FALSE; + } + // get binning + int imtype; + if(ASI_SUCCESS == ASIGetROIFormat(caminfo.CameraID, &camera.field.w, &camera.field.h, &curbin, &imtype)){ + ASIGetStartPos(caminfo.CameraID, &camera.field.xoff, &camera.field.yoff); + DBG("FIELD: %dx%d, offset %dx%d, binning %d", camera.field.w, camera.field.h, camera.field.xoff, camera.field.yoff, curbin); + } + int ncontrols = 0; + if(ASI_SUCCESS == ASIGetNumOfControls(caminfo.CameraID, &ncontrols)){ + ASI_CONTROL_CAPS asicon; + for(int i = 0; i < ncontrols; ++i){ + if(ASI_SUCCESS == ASIGetControlCaps(caminfo.CameraID, i, &asicon)){ +#ifdef EBUG + green("Control #%d: '%s' ", i, asicon.Name); +#endif + long val; + ASI_BOOL aut; + if(ASI_SUCCESS == ASIGetControlValue(caminfo.CameraID, asicon.ControlType, &val, &aut)){ +#ifdef EBUG + printf("curval: %ld%s, ", val, aut ? " (auto)": ""); +#endif + switch(asicon.ControlType){ // get extremal values of brightness and gain + case ASI_GAIN: + extrvalues.maxgain = (float) asicon.MaxValue; + extrvalues.mingain = (float) asicon.MinValue; + break; + case ASI_BRIGHTNESS: + extrvalues.maxbright = (float) asicon.MaxValue; + extrvalues.minbright = (float) asicon.MinValue; + break; + default: + break; + } + } +#ifdef EBUG + printf("min/max: %ld/%ld; def: %ld, writeable: %d, descr: %s\n", + asicon.MinValue, asicon.MaxValue, asicon.DefaultValue, asicon.IsWritable, + asicon.Description); +#endif + } + } + } + return TRUE; +} + +static int camsetbrig(float b){ + if(b < extrvalues.minbright || b > extrvalues.maxbright) return FALSE; + return zwo_setfloat(b, ASI_BRIGHTNESS); +} + +static int camgetbrig(float *b){ + if(!b) return FALSE; + return zwo_getfloat(b, ASI_BRIGHTNESS); +} + +static int camsetexp(float t){ + if(!zwo_setfloat(t*1e6, ASI_EXPOSURE)) return FALSE; + exptime = t; + return TRUE; +} + +static int camsetgain(float g){ + if(g < extrvalues.mingain || g > extrvalues.maxgain) return FALSE; + return zwo_setfloat(g, ASI_GAIN); +} + +static int camgetgain(float *g){ + if(!g) return FALSE; + return zwo_getfloat(g, ASI_GAIN); +} + +static int camsett(float t){ + if(!zwo_setfloat(1., ASI_FAN_ON)){ + DBG("Can't set fan on"); + return FALSE; + } + float f; + if(zwo_getfloat(&f, ASI_FAN_ON)){ + DBG("FAN: %g", f); + } + if(!zwo_setfloat(t, ASI_TARGET_TEMP)){ + DBG("Can't set target temperature"); + return FALSE; + } + if(zwo_getfloat(&f, ASI_TARGET_TEMP)){ + DBG("Ttarg = %g", f); + } + if(!zwo_setfloat(1., ASI_COOLER_ON)){ + DBG("Can't set cooler on"); + return FALSE; + } + if(!zwo_getfloat(&f, ASI_COOLER_ON)) return FALSE; + DBG("COOLERON = %g", f); + usleep(100000); + double t0 = dtime(); + float c, p, tn; + while(dtime() - t0 < 10.){ + green("%.1f", dtime()-t0); + zwo_getfloat(&f, ASI_FAN_ON); + zwo_getfloat(&t, ASI_TARGET_TEMP); + zwo_getfloat(&c, ASI_COOLER_ON); + zwo_getfloat(&tn, ASI_TEMPERATURE); + zwo_getfloat(&p, ASI_COOLER_POWER_PERC); + printf("fan: %g, t: %g, cooler: %g, perc: %g, tnow: %g\n", f, t, c, p, tn/10.); + if(f > 0.) break; + usleep(100000); + } + return TRUE; +} + + +static int camgett(float *t){ + if(!t) return FALSE; + float curt; + if(!zwo_getfloat(&curt, ASI_TEMPERATURE)) return FALSE; + *t = curt / 10.; + return TRUE; +} +// get Tbody & Thot unsupported +static int gett(_U_ float *t){ + return FALSE; +} + +static int camsetbin(int h, int v){ + if(h != v) return FALSE; + if(zwo_setfloat(1., ASI_HARDWARE_BIN)){ + curbin = h; + return TRUE; + } + return FALSE; +} + +// unsupported, but return TRUE if have mechanical shutter +static int camshutter(_U_ shutter_op s){ + if(!caminfo.MechanicalShutter) return FALSE; + return TRUE; +} + +// set ROI +static int camsetgeom(frameformat *f){ // w,h, xoff, yoff + if(!f) return FALSE; + int imtype; + DBG("w: %g, h: %g, bin: %d", (double)f->w / curbin, (double)f->h / curbin, curbin); + if(ASI_SUCCESS != ASISetROIFormat(caminfo.CameraID, f->w/curbin, f->h/curbin, curbin, ASI_IMG_RAW16)){ + DBG(_("Can't set geometry")); + return FALSE; + } + if(ASI_SUCCESS != ASIGetROIFormat(caminfo.CameraID, &f->w, &f->h, &curbin, &imtype)){ + DBG(_("Can't get geometry")); + return FALSE; + } + DBG("w=%d, h=%d, bin=%d", f->w, f->h, curbin); + if(ASI_SUCCESS != ASISetStartPos(caminfo.CameraID, f->xoff, f->yoff)){ + DBG("Can't set start pos"); + return FALSE; + } + if(ASI_SUCCESS != ASIGetStartPos(caminfo.CameraID, &f->xoff, &f->yoff)){ + DBG("Can't get start pos"); + return FALSE; + } + camera.geometry = *f; + return TRUE; +} + +static int camgetnam(char *n, int l){ + strncpy(n, caminfo.Name, l); + return TRUE; +} + +static int camgmg(float *mg){ // get max gain + if(mg) *mg = extrvalues.maxgain; + return TRUE; +} + +static int camggl(frameformat *max, frameformat *step){ // get geometry limits + if(max) *max = camera.array; + if(step) *step = (frameformat){1,1,1,1}; + return TRUE; +} + +static int camgetbin(int *binh, int *binv){ + if(binh) *binh = curbin; + if(binv) *binv = curbin; + return TRUE; +} + +static int setfspd(int spd){ // set fast speed (0..3): 0 - 40% bandwidthovrl, 3 - 100% + float bw = 40.; + if(spd > 2) bw = 100.; + else if(spd > 0) bw += 20. * spd; + DBG("set BANDWIDTH to %g", bw); + if(ASI_SUCCESS != zwo_setfloat(bw, ASI_BANDWIDTHOVERLOAD)){ + DBG("Can't set"); + return FALSE; + } + return TRUE; +} + +static int camgetio(_U_ int *io){ // not supported + return FALSE; +} + +static int camfan(_U_ fan_speed spd){ // not supported + return TRUE; +} + +/* --------------- FOCUSER --------------- */ +static int focsetpos(_U_ int a, float n){ + if(n < 0. || n > focmaxpos) return FALSE; + focuserpos = n; + return TRUE; +} + +static int fochome(_U_ int a){ + focuserpos = 0.; + return TRUE; +} + +static int focgetnam(char *n, int l){ + strncpy(n, "Dummy focuser", l); + return TRUE; +} + +static int focpos(float *p){ + if(p) *p = focuserpos; + return TRUE; +} + +static int focMp(float *p){ + if(p) *p = focmaxpos; + return TRUE; +} + +static int focmp(float *p){ + if(p) *p = 0.; + return TRUE; +} + +/* --------------- WHEEL --------------- */ +static int whlsetpos(int n){ + if(n > filtermax || n < 0) return FALSE; + filterpos = n; + return TRUE; +} + +static int whlgetpos(int *n){ + if(n) *n = filterpos; + return TRUE; +} + +static int whlgmp(int *n){ + if(n) *n = filtermax; + return TRUE; +} + +static int whlgetnam(char *n, int l){ + strncpy(n, "Dummy filter wheel", l); + return TRUE; +} + +static int stub(){ + return FALSE; +} +static void vstub(){ + FNAME(); + return; +} +static int istub(_U_ int N){ + return TRUE; +} + +/* + * Global objects: camera, focuser and wheel + */ +__attribute__ ((visibility("default"))) Camera camera = { + .check = asi_checkcam, + .close = asi_closecam, + .pollcapture = campoll, + .capture = camcapt, + .cancel = camcancel, + .startexposition = startcapt, + // setters: + .setDevNo = setdevno, + .setbrightness = camsetbrig, + .setexp = camsetexp, + .setgain = camsetgain, + .setT = camsett, + .setbin = camsetbin, + .setnflushes = istub, + .shuttercmd = camshutter, + .confio = istub, + .setio = istub, + .setframetype = setframetype, + .setbitdepth = istub, + .setfastspeed = setfspd, + .setgeometry = camsetgeom, + .setfanspeed = camfan, + // getters: + .getbrightness = camgetbrig, + .getModelName = camgetnam, + .getgain = camgetgain, + .getmaxgain = camgmg, + .getgeomlimits = camggl, + .getTcold = camgett, + .getThot = gett, + .getTbody = gett, + .getbin = camgetbin, + .getio = camgetio, +}; + +__attribute__ ((visibility("default"))) Focuser focuser = { + .check = stub, + .close = vstub, + // setters: + .setDevNo = setdevno, + .setAbsPos = focsetpos, + .home = fochome, + // getters: + .getModelName = focgetnam, + .getTbody = gett, + .getPos = focpos, + .getMaxPos = focMp, + .getMinPos = focmp, +}; + +__attribute__ ((visibility("default"))) Wheel wheel = { + .check = stub, + .close = vstub, + // setters + .setDevNo = setdevno, + .setPos = whlsetpos, + // getters + .getModelName = whlgetnam, + .getTbody = gett, + .getPos = whlgetpos, + .getMaxPos = whlgmp, +}; diff --git a/ZWO_cameras/zwofunc.h b/ZWO_cameras/zwofunc.h deleted file mode 100644 index 9f99c23..0000000 --- a/ZWO_cameras/zwofunc.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * This file is part of the CCD_Capture project. - * Copyright 2022 Edward V. Emelianov . - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#pragma once -#ifndef ZWOFUNC_H__ -#define ZWOFUNC_H__ - -#include "ccdfunc.h" - -extern Camera ZWOcam; -extern Focuser ZWOfocus; -extern Wheel ZWOwheel; - -#endif // ZWOFUNC_H__ diff --git a/ccdfunc.c b/ccdfunc.c index 14602de..2aae835 100644 --- a/ccdfunc.c +++ b/ccdfunc.c @@ -16,20 +16,17 @@ * along with this program. If not, see . */ +#include // dlopen/close #include +#include #include +#include #include #include +#include #include "ccdfunc.h" #include "cmdlnopts.h" -#include "dummyfunc.h" -#ifdef USEFLI -#include "flifunc.h" -#endif -#ifdef USEZWO -#include "zwofunc.h" -#endif #ifdef IMAGEVIEW #include "imageview.h" #endif @@ -56,6 +53,52 @@ do{ int status = 0; \ #define TMBUFSIZ 40 +// find plugin +static void *open_plugin(const char *name){ + DBG("try to open lib %s", name); + void* dlh = dlopen(name, RTLD_NOLOAD); // library may be already opened + if(!dlh) dlh = dlopen(name, RTLD_NOW); + if(!dlh){ + WARNX(_("Can't find plugin %s: %s"), name, dlerror()); + return NULL; + } + return dlh; +} + +static void *init_focuser(const char *pluginname){ + FNAME(); + void* dlh = open_plugin(pluginname); + if(!dlh) return NULL; + focuser = (Focuser*) dlsym(dlh, "focuser"); + if(!focuser){ + WARNX(_("Can't find focuser in plugin %s: %s"), pluginname, dlerror()); + return NULL; + } + return dlh; +} +static void *init_camera(const char *pluginname){ + FNAME(); + void* dlh = open_plugin(pluginname); + if(!dlh) return NULL; + camera = (Camera*) dlsym(dlh, "camera"); + if(!camera){ + WARNX(_("Can't find camera in plugin %s: %s"), pluginname, dlerror()); + return NULL; + } + return dlh; +} +static void *init_wheel(const char *pluginname){ + FNAME(); + void* dlh = open_plugin(pluginname); + if(!dlh) return NULL; + wheel = (Wheel*) dlsym(dlh, "wheel"); + if(!wheel){ + WARNX(_("Can't find wheel in plugin %s: %s"), pluginname, dlerror()); + return NULL; + } + return dlh; +} + /* static size_t curtime(char *s_time){ // current date/time time_t tm = time(NULL); @@ -102,16 +145,20 @@ static void addrec(fitsfile *f, char *filename){ } void saveFITS(IMG *img, char *filename){ - char buff[PATH_MAX]; + if(!camera){ + WARNX(_("Camera device unknown")); + return; + } + char buff[PATH_MAX], fnam[PATH_MAX]; if(filename == NULL) return; fitserror = 0; - if(!check_filename(buff, filename, "fits") && !GP->rewrite){ + if(!check_filename(fnam, filename, "fits") && !GP->rewrite){ // WARNX(_("Can't save file")); }else{ if(GP->rewrite){ DBG("REW"); - snprintf(buff, PATH_MAX, "!%s.fits", filename); + snprintf(fnam, PATH_MAX, "!%s.fits", filename); } } int width = img->w, height = img->h; @@ -124,7 +171,7 @@ void saveFITS(IMG *img, char *filename){ char bufc[FLEN_CARD]; time_t savetime = time(NULL); fitsfile *fp; - TRYFITS(fits_create_file, &fp, buff); + TRYFITS(fits_create_file, &fp, fnam); if(fitserror) goto cloerr; TRYFITS(fits_create_img, fp, USHORT_IMG, 2, naxes); if(fitserror) goto cloerr; @@ -143,7 +190,7 @@ void saveFITS(IMG *img, char *filename){ WRITEKEY(fp, TSTRING, "INSTRUME", GP->instrument, "Instrument"); }else WRITEKEY(fp, TSTRING, "INSTRUME", "direct imaging", "Instrument"); - snprintf(bufc, FLEN_VALUE, "%.g x %.g", camera->pixX, camera->pixY); + snprintf(bufc, FLEN_VALUE, "%g x %g", camera->pixX, camera->pixY); // PXSIZE / pixel size WRITEKEY(fp, TSTRING, "PXSIZE", bufc, "Pixel size in m"); snprintf(bufc, FLEN_VALUE, "(%d, %d)(%d, %d)", camera->field.xoff, camera->field.yoff, @@ -156,7 +203,8 @@ void saveFITS(IMG *img, char *filename){ if(GP->X0 > -1) WRITEKEY(fp, TINT, "X0", &GP->X0, "Subframe left border"); if(GP->Y0 > -1) WRITEKEY(fp, TINT, "Y0", &GP->Y0, "Subframe upper border"); if(GP->objtype) strncpy(bufc, GP->objtype, FLEN_CARD-1); - else sprintf(bufc, "object"); + else if(GP->dark) sprintf(bufc, "dark"); + else sprintf(bufc, "light"); // IMAGETYP / object, flat, dark, bias, scan, eta, neon, push WRITEKEY(fp, TSTRING, "IMAGETYP", bufc, "Image type"); // DATAMAX, DATAMIN / Max, min pixel value @@ -203,6 +251,10 @@ void saveFITS(IMG *img, char *filename){ if(GP->hbin != 1 || GP->vbin != 1){ snprintf(bufc, 80, "%d x %d", GP->hbin, GP->vbin); WRITEKEY(fp, TSTRING, "BINNING", bufc, "Binning (hbin x vbin)"); + tmpi = GP->hbin; + WRITEKEY(fp, TINT, "XBINNING", &tmpi, "binning factor used on X axis"); + tmpi = GP->vbin; + WRITEKEY(fp, TINT, "YBINNING", &tmpi, "binning factor used on Y axis"); } // OBSERVER / Observers if(GP->observers){ @@ -249,7 +301,7 @@ void saveFITS(IMG *img, char *filename){ TRYFITS(fits_close_file, fp); cloerr: if(fitserror == 0){ - verbose(1, _("File saved as '%s'"), buff); + verbose(1, _("File saved as '%s'"), fnam); }else{ WARNX(_("Error saving file")); fitserror = 0; @@ -299,26 +351,26 @@ static void calculate_stat(IMG *image){ * Find focusers and work with each of them */ void focusers(){ - if(!GP->focuserdev){ - verbose(3, _("Focuser device not pointed, try to guess")); -#ifdef USEFLI - if(FLIfocus.check()) focuser = &FLIfocus; -#endif -#ifdef USEZWO - if(ZWOfocus.check()) focuser = &ZWOfocus; -#endif - }else{ - if(strcasecmp(GP->cameradev, "dummy") == 0) focuser = &DUMMYfocus; -#ifdef USEFLI - else if(strcasecmp(GP->focuserdev, "fli") == 0) focuser = &FLIfocus; -#endif -#ifdef USEZWO - else if(strcasecmp(GP->focuserdev, "zwo") == 0) focuser = &ZWOfocus; -#endif - } - if(!focuser){ - WARNX(_("Focuser not found")); + FNAME(); + void *dlh = NULL; + if(!GP->focuserdev && !GP->commondev){ + verbose(3, _("Focuser device not pointed")); return; + }else{ + char *plugin = GP->commondev ? GP->commondev : GP->focuserdev; + if(!(dlh = init_focuser(plugin))) return; + } + if(!focuser->check()){ + verbose(3, _("No focusers found")); + focuser = NULL; + return; + } + if(GP->listdevices){ + for(int i = 0; i < focuser->Ndevices; ++i){ + char modname[256]; + focuser->getModelName(modname, 255); + printf("Found focuser #%d: %s\n", i, modname); + } } int num = GP->focdevno; if(num > focuser->Ndevices - 1){ @@ -371,6 +423,7 @@ void focusers(){ } retn: focuser->close(); + dlclose(dlh); focuser = NULL; } @@ -378,26 +431,26 @@ retn: * Find wheels and work with each of them */ void wheels(){ - if(!GP->wheeldev){ - verbose(3, _("Wheel device not pointed, try to guess")); -#ifdef USEFLI - if(FLIwheel.check()) wheel = &FLIwheel; -#endif -#ifdef USEZWO - if(ZWOwheel.check()) wheel = &ZWOwheel; -#endif - }else{ - if(strcasecmp(GP->cameradev, "dummy") == 0) wheel = &DUMMYwheel; -#ifdef USEFLI - else if(strcasecmp(GP->wheeldev, "fli") == 0) wheel = &FLIwheel; -#endif -#ifdef USEZWO - else if(strcasecmp(GP->wheeldev, "zwo") == 0) wheel = &ZWOwheel; -#endif - } - if(!wheel){ - WARNX(_("Wheel not found")); + FNAME(); + void *dlh = NULL; + if(!GP->wheeldev && !GP->commondev){ + verbose(3, _("Wheel device not pointed")); return; + }else{ + char *plugin = GP->commondev ? GP->commondev : GP->wheeldev; + if(!(dlh = init_wheel(plugin))) return; + } + if(!wheel->check()){ + verbose(3, _("No wheels found")); + wheel = NULL; + return; + } + if(GP->listdevices){ + for(int i = 0; i < wheel->Ndevices; ++i){ + char modname[256]; + wheel->getModelName(modname, 255); + printf("Found wheel #%d: %s\n", i, modname); + } } int num = GP->whldevno; if(num > wheel->Ndevices - 1){ @@ -435,26 +488,29 @@ void wheels(){ WARNX(_("Can't set wheel position %d"), pos); retn: wheel->close(); + dlclose(dlh); wheel = NULL; } - +/* static void closeall(){ if(camera){camera->close(); camera = NULL;} if(focuser){focuser->close(); focuser = NULL;} if(wheel){wheel->close(); wheel = NULL;} -} +}*/ static capture_status capt(){ capture_status cs; float tleave, tmpf; while(camera->pollcapture(&cs, &tleave)){ if(cs != CAPTURE_PROCESS) break; - verbose(2, _("%.1f seconds till exposition ends"), tleave); - if(camera->getTcold(&tmpf)) verbose(1, "CCDTEMP=%.1f", tmpf); - if(camera->getTbody(&tmpf)) verbose(1, "BODYTEMP=%.1f", tmpf); + if(tleave > 0.1){ + verbose(2, _("%.1f seconds till exposition ends"), tleave); + if(camera->getTcold(&tmpf)) verbose(1, "CCDTEMP=%.1f", tmpf); + if(camera->getTbody(&tmpf)) verbose(1, "BODYTEMP=%.1f", tmpf); + } if(tleave > 6.) sleep(5); else if(tleave > 0.9) sleep((int)(tleave+0.99)); - else usleep((int)(1e6*tleave) + 1); + else usleep((int)(1e6*tleave) + 100000); if(!camera) return CAPTURE_ABORTED; } return cs; @@ -464,28 +520,27 @@ static capture_status capt(){ * Find CCDs and work with each of them */ void ccds(){ + FNAME(); float tmpf; int tmpi; - if(!GP->cameradev){ - verbose(3, _("Camera device not pointed, try to guess")); -#ifdef USEFLI - if(FLIcam.check()) camera = &FLIcam; -#endif -#ifdef USEZWO - if(ZWOcam.check()) camera = &ZWOcam; -#endif - }else{ - if(strcasecmp(GP->cameradev, "dummy") == 0) camera = &DUMMYcam; -#ifdef USEFLI - else if(strcasecmp(GP->cameradev, "fli") == 0) camera = &FLIcam; -#endif -#ifdef USEZWO - else if(strcasecmp(GP->cameradev, "zwo") == 0) camera = &ZWOcam; -#endif - } - if(!camera){ - WARNX(_("Camera not found")); + void *dlh = NULL; + if(!GP->cameradev && !GP->commondev){ + verbose(3, _("Camera device not pointed")); return; + }else{ + char *plugin = GP->commondev ? GP->commondev : GP->cameradev; + if(!(dlh = init_camera(plugin))) return; + } + if(!camera->check()){ + verbose(3, _("No cameras found")); + return; + } + if(GP->listdevices){ + for(int i = 0; i < camera->Ndevices; ++i){ + char modname[256]; + camera->getModelName(modname, 255); + printf("Found camera #%d: %s\n", i, modname); + } } int num = GP->camdevno; if(num > camera->Ndevices - 1){ @@ -551,12 +606,8 @@ void ccds(){ /*********************** expose control ***********************/ // cancel previous exp camera->cancel(); - int binh = 1, binv = 1; if(!camera->setbin(GP->hbin, GP->vbin)) WARNX(_("Can't set binning %dx%d"), GP->hbin, GP->vbin); - if(!camera->getbin(&binh, &binv)) - WARNX(_("Can't get current binning")); - verbose(2, "Binning: %d x %d", binh, binv); if(GP->fullframe){ DBG("FULLFRAME"); GP->X0 = x0; GP->Y0 = y0; GP->X1 = x1; GP->Y1 = y1; @@ -568,7 +619,7 @@ void ccds(){ if(GP->Y1 == -1) GP->Y1 = y1; else if(GP->Y1 > y1) GP->Y1 = y1; frameformat fmt = {.w = GP->X1 - GP->X0, .h = GP->Y1 - GP->Y0, .xoff = GP->X0, .yoff = GP->Y0}; - int raw_width = fmt.w / binh, raw_height = fmt.h / binv; + int raw_width = fmt.w / GP->hbin, raw_height = fmt.h / GP->vbin; if(!camera->setgeometry(&fmt)) WARNX(_("Can't set given geometry")); verbose(3, "Geometry: off=%d/%d, wh=%d/%d", fmt.xoff, fmt.yoff, fmt.w, fmt.h); @@ -583,11 +634,14 @@ void ccds(){ tmpi = (GP->_8bit) ? 0 : 1; if(!camera->setbitdepth(tmpi)) WARNX(_("Can't set bit depth")); - tmpi = (GP->fast) ? 1 : 0; - if(!camera->setfastspeed(tmpi)) + if(!camera->setfastspeed(GP->fast)) WARNX(_("Can't set readout speed")); else verbose(1, _("Readout mode: %s"), GP->fast ? "fast" : "normal"); if(!GP->outfile) verbose(1, _("Only show statistics")); + if(!camera->getbin(&GP->hbin, &GP->vbin)) // GET binning should be AFTER setgeometry! + WARNX(_("Can't get current binning")); + verbose(2, "Binning: %d x %d", GP->hbin, GP->vbin); + uint16_t *img = MALLOC(uint16_t, raw_width * raw_height); IMG ima = {.data = img, .w = raw_width, .h = raw_height}; @@ -606,13 +660,16 @@ void ccds(){ for(int j = 0; j < GP->nframes; ++j){ // %d\n verbose(1, _("Capture frame %d"), j); - if(!camera) return; + if(!camera->startexposition()){ + WARNX(_("Can't start exposition")); + break; + } if(capt() != CAPTURE_READY){ WARNX(_("Can't capture image")); break; } verbose(2, _("Read grabbed image")); - if(!camera) return; + //if(!camera) return; if(!camera->capture(&ima)){ WARNX(_("Can't grab image")); break; @@ -628,11 +685,11 @@ void ccds(){ if((mainwin->winevt & WINEVT_PAUSE) == 0) break; if(mainwin->winevt & WINEVT_GETIMAGE){ mainwin->winevt &= ~WINEVT_GETIMAGE; - if(!camera) return; + //if(!camera) return; if(capt() != CAPTURE_READY){ WARNX(_("Can't capture image")); }else{ - if(!camera) return; + //if(!camera) return; if(!camera->capture(&ima)){ WARNX(_("Can't grab image")); } @@ -644,7 +701,7 @@ void ccds(){ } usleep(10000); } - } + }else break; // stop capturing when window closed } #endif if(GP->pause_len && j != (GP->nframes - 1)){ @@ -662,18 +719,18 @@ void ccds(){ } #ifdef IMAGEVIEW if(GP->showimage){ - if(mainwin) mainwin->winevt |= WINEVT_PAUSE; + if((mainwin = getWin())) mainwin->winevt |= WINEVT_PAUSE; DBG("Waiting"); while((mainwin = getWin())){ - if(mainwin->killthread) break; + //if(mainwin->killthread) break; if(mainwin->winevt & WINEVT_GETIMAGE){ DBG("GRAB"); mainwin->winevt &= ~WINEVT_GETIMAGE; - if(!camera) return; + //if(!camera) return; if(capt() != CAPTURE_READY){ WARNX(_("Can't capture image")); }else{ - if(!camera) return; + //if(!camera) return; if(!camera->capture(&ima)){ WARNX(_("Can't grab image")); } @@ -688,9 +745,13 @@ void ccds(){ usleep(10000); } #endif + DBG("FREE img"); FREE(img); retn: + DBG("Close cam"); camera->close(); + DBG("close dlh"); + dlclose(dlh); camera = NULL; } @@ -698,5 +759,4 @@ void cancel(){ if(camera){ camera->cancel(); } - closeall(); } diff --git a/ccdfunc.h b/ccdfunc.h index b1745d3..f000ead 100644 --- a/ccdfunc.h +++ b/ccdfunc.h @@ -64,6 +64,7 @@ typedef struct{ int (*check)(); // check if the device is available, connect and init int Ndevices; // amount of devices found void (*close)(); // disconnect & close device + int (*startexposition)(); // start exposition int (*pollcapture)(capture_status *st, float *remain);// start or poll capture process, `remain` - time remain (s) int (*capture)(IMG *ima); // capture an image, struct `ima` should be prepared before void (*cancel)(); // cancel exposition diff --git a/cmdlnopts.c b/cmdlnopts.c index ac04171..50eca45 100644 --- a/cmdlnopts.c +++ b/cmdlnopts.c @@ -10,13 +10,10 @@ #include "cmdlnopts.h" static int help; -static glob_pars G; glob_pars *GP = NULL; - // DEFAULTS // default global parameters -glob_pars const Gdefault = { - .objtype = "object", +static glob_pars G = { .instrument = "direct imaging", .exptime = -1, .nframes = 1, @@ -37,9 +34,11 @@ glob_pars const Gdefault = { * name has_arg flag val type argptr help */ myoption cmdlnopts[] = { - {"cameradev", NEED_ARG, NULL, 'C', arg_string, APTR(&G.cameradev), N_("camera device type (fli/zwo/etc)")}, - {"focuserdev", NEED_ARG,NULL, 'F', arg_string, APTR(&G.focuserdev),N_("focuser device type (fli/zwo/etc)")}, - {"wheeldev", NEED_ARG, NULL, 'W', arg_string, APTR(&G.wheeldev), N_("wheel device type (fli/zwo/etc)")}, + {"plugin" ,NEED_ARG, NULL, 0, arg_string, APTR(&G.commondev), N_("common device plugin (e.g devfli.so)")}, + {"cameradev", NEED_ARG, NULL, 'C', arg_string, APTR(&G.cameradev), N_("camera device plugin (e.g. devfli.so)")}, + {"focuserdev", NEED_ARG,NULL, 'F', arg_string, APTR(&G.focuserdev),N_("focuser device plugin (e.g. devzwo.so)")}, + {"wheeldev", NEED_ARG, NULL, 'W', arg_string, APTR(&G.wheeldev), N_("wheel device plugin (e.g. devdummy.so)")}, + {"list", NO_ARGS, NULL, 'L', arg_int, APTR(&G.listdevices),N_("list connected devices")}, {"camdevno",NEED_ARG, NULL, 0, arg_int, APTR(&G.camdevno), N_("camera device number (if many: 0, 1, 2 etc)")}, {"wheeldevno",NEED_ARG, NULL, 0, arg_int, APTR(&G.whldevno), N_("filter wheel device number (if many: 0, 1, 2 etc)")}, {"focdevno",NEED_ARG, NULL, 0, arg_int, APTR(&G.focdevno), N_("focuser device number (if many: 0, 1, 2 etc)")}, @@ -48,7 +47,7 @@ myoption cmdlnopts[] = { {"verbose", NO_ARGS, NULL, 'V', arg_none, APTR(&G.verbose), N_("verbose level (each -v increase it)")}, {"dark", NO_ARGS, NULL, 'd', arg_int, APTR(&G.dark), N_("not open shutter, when exposing (\"dark frames\")")}, {"8bit", NO_ARGS, NULL, '8', arg_int, APTR(&G._8bit), N_("run in 8-bit mode")}, - {"fast", NO_ARGS, NULL, 'f', arg_int, APTR(&G.fast), N_("fast (8MHz) readout mode")}, + {"fast", NO_ARGS, NULL, 'f', arg_none, APTR(&G.fast), N_("fast (8MHz) readout mode")}, {"set-temp",NEED_ARG, NULL, 't', arg_double, APTR(&G.temperature),N_("set CCD temperature to given value (degr C)")}, {"set-fan", NEED_ARG, NULL, 0, arg_int, APTR(&G.fanspeed), N_("set fan speed (0 - off, 1 - low, 2 - high)")}, @@ -65,7 +64,7 @@ myoption cmdlnopts[] = { {"vbin", NEED_ARG, NULL, 'v', arg_int, APTR(&G.vbin), N_("vertical binning to N pixels")}, {"nframes", NEED_ARG, NULL, 'n', arg_int, APTR(&G.nframes), N_("make series of N frames")}, {"pause", NEED_ARG, NULL, 'p', arg_int, APTR(&G.pause_len), N_("make pause for N seconds between expositions")}, - {"exptime", NEED_ARG, NULL, 'x', arg_float, APTR(&G.exptime), N_("set exposure time to given value (ms)")}, + {"exptime", NEED_ARG, NULL, 'x', arg_double, APTR(&G.exptime), N_("set exposure time to given value (seconds!)")}, {"X0", NEED_ARG, NULL, 0, arg_int, APTR(&G.X0), N_("frame X0 coordinate (-1 - all with overscan)")}, {"Y0", NEED_ARG, NULL, 0, arg_int, APTR(&G.Y0), N_("frame Y0 coordinate (-1 - all with overscan)")}, {"X1", NEED_ARG, NULL, 0, arg_int, APTR(&G.X1), N_("frame X1 coordinate (-1 - all with overscan)")}, @@ -104,8 +103,6 @@ myoption cmdlnopts[] = { * @return allocated structure with global parameters */ glob_pars *parse_args(int argc, char **argv){ - void *ptr; - ptr = memcpy(&G, &Gdefault, sizeof(G)); assert(ptr); // format of help: "Usage: progname [args]\n" change_helpstring("Usage: %s [args] \n\n\tWhere args are:\n"); // parse arguments diff --git a/cmdlnopts.h b/cmdlnopts.h index cc11139..4eac6e7 100644 --- a/cmdlnopts.h +++ b/cmdlnopts.h @@ -27,7 +27,8 @@ * here are some typedef's for global data */ typedef struct{ - char *cameradev; // camera device ("fli", "zwo" etc) + char *commondev; // common (camera+focuser+wheel) plugin ("devfli.so", "devzwo.so" etc) + char *cameradev; // camera device plugin char *focuserdev; // focuser ... char *wheeldev; // wheel ... char *objname; // object's name @@ -37,6 +38,7 @@ typedef struct{ char *observers; // observers' names char *prog_id; // programm identificator char *author; // programm author + int listdevices; // list connected devices int fanspeed; // fan speed: 0-2 int noflush; // turn off bg flushing int camdevno; // camera number (0, 1, 2 etc) @@ -56,7 +58,7 @@ typedef struct{ int getio; // get value of ioport int setio; // set value of ioport int confio; // configure ioport - float exptime; // time of exposition in seconds + double exptime; // time of exposition in seconds double temperature; // temperature of CCD double gotopos; // move stepper motor of focuser to absolute position double addsteps; // move stepper motor of focuser to relative position diff --git a/locale/ru/messages.po b/locale/ru/messages.po index 1c20caa..cb72308 100644 --- a/locale/ru/messages.po +++ b/locale/ru/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2022-01-14 16:21+0300\n" +"POT-Creation-Date: 2022-03-01 20:35+0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,431 +17,468 @@ msgstr "" "Content-Type: text/plain; charset=koi8-r\n" "Content-Transfer-Encoding: 8bit\n" +#: cmdlnopts.c:37 +msgid "common device plugin (e.g devfli.so)" +msgstr "" + +#: cmdlnopts.c:38 +msgid "camera device plugin (e.g. devfli.so)" +msgstr "" + +#: cmdlnopts.c:39 +msgid "focuser device plugin (e.g. devzwo.so)" +msgstr "" + #: cmdlnopts.c:40 -msgid "camera device type (fli/zwo/etc)" +msgid "wheel device plugin (e.g. devdummy.so)" msgstr "" #: cmdlnopts.c:41 -msgid "focuser device type (fli/zwo/etc)" +msgid "list connected devices" msgstr "" #: cmdlnopts.c:42 -msgid "wheel device type (fli/zwo/etc)" -msgstr "" - -#: cmdlnopts.c:43 msgid "camera device number (if many: 0, 1, 2 etc)" msgstr "" -#: cmdlnopts.c:44 +#: cmdlnopts.c:43 msgid "filter wheel device number (if many: 0, 1, 2 etc)" msgstr "" -#: cmdlnopts.c:45 +#: cmdlnopts.c:44 msgid "focuser device number (if many: 0, 1, 2 etc)" msgstr "" -#: cmdlnopts.c:46 +#: cmdlnopts.c:45 msgid "show this help" msgstr "" -#: cmdlnopts.c:47 +#: cmdlnopts.c:46 msgid "rewrite output file if exists" msgstr "" -#: cmdlnopts.c:48 +#: cmdlnopts.c:47 msgid "verbose level (each -v increase it)" msgstr "" -#: cmdlnopts.c:49 +#: cmdlnopts.c:48 msgid "not open shutter, when exposing (\"dark frames\")" msgstr "" -#: cmdlnopts.c:50 +#: cmdlnopts.c:49 msgid "run in 8-bit mode" msgstr "" -#: cmdlnopts.c:51 +#: cmdlnopts.c:50 msgid "fast (8MHz) readout mode" msgstr "" -#: cmdlnopts.c:52 +#: cmdlnopts.c:51 msgid "set CCD temperature to given value (degr C)" msgstr "" -#: cmdlnopts.c:53 +#: cmdlnopts.c:52 msgid "set fan speed (0 - off, 1 - low, 2 - high)" msgstr "" -#: cmdlnopts.c:55 +#: cmdlnopts.c:54 msgid "program author" msgstr "" -#: cmdlnopts.c:56 +#: cmdlnopts.c:55 msgid "object type (neon, object, flat etc)" msgstr "" -#: cmdlnopts.c:57 +#: cmdlnopts.c:56 msgid "instrument name" msgstr "" -#: cmdlnopts.c:58 +#: cmdlnopts.c:57 msgid "object name" msgstr "" -#: cmdlnopts.c:59 +#: cmdlnopts.c:58 msgid "observers' names" msgstr "" -#: cmdlnopts.c:60 +#: cmdlnopts.c:59 msgid "observing program name" msgstr "" -#: cmdlnopts.c:61 +#: cmdlnopts.c:60 msgid "add records to header from given file[s]" msgstr "" -#: cmdlnopts.c:63 +#: cmdlnopts.c:62 msgid "N flushes before exposing (default: 1)" msgstr "" -#: cmdlnopts.c:64 +#: cmdlnopts.c:63 msgid "horizontal binning to N pixels" msgstr "" -#: cmdlnopts.c:65 +#: cmdlnopts.c:64 msgid "vertical binning to N pixels" msgstr "" -#: cmdlnopts.c:66 +#: cmdlnopts.c:65 msgid "make series of N frames" msgstr "" -#: cmdlnopts.c:67 +#: cmdlnopts.c:66 msgid "make pause for N seconds between expositions" msgstr "" -#: cmdlnopts.c:68 -msgid "set exposure time to given value (ms)" +#: cmdlnopts.c:67 +msgid "set exposure time to given value (seconds!)" msgstr "" -#: cmdlnopts.c:69 +#: cmdlnopts.c:68 msgid "frame X0 coordinate (-1 - all with overscan)" msgstr "" -#: cmdlnopts.c:70 +#: cmdlnopts.c:69 msgid "frame Y0 coordinate (-1 - all with overscan)" msgstr "" -#: cmdlnopts.c:71 +#: cmdlnopts.c:70 msgid "frame X1 coordinate (-1 - all with overscan)" msgstr "" -#: cmdlnopts.c:72 +#: cmdlnopts.c:71 msgid "frame Y1 coordinate (-1 - all with overscan)" msgstr "" -#: cmdlnopts.c:73 +#: cmdlnopts.c:72 msgid "grab full frame (with overscans)" msgstr "" -#: cmdlnopts.c:75 +#: cmdlnopts.c:74 msgid "open shutter" msgstr "" -#: cmdlnopts.c:76 +#: cmdlnopts.c:75 msgid "close shutter" msgstr "" -#: cmdlnopts.c:77 +#: cmdlnopts.c:76 msgid "run exposition on LOW @ pin5 I/O port" msgstr "" -#: cmdlnopts.c:78 +#: cmdlnopts.c:77 msgid "run exposition on HIGH @ pin5 I/O port" msgstr "" -#: cmdlnopts.c:79 +#: cmdlnopts.c:78 msgid "get value of I/O port pins" msgstr "" -#: cmdlnopts.c:80 +#: cmdlnopts.c:79 msgid "move stepper motor asynchronous" msgstr "" -#: cmdlnopts.c:82 +#: cmdlnopts.c:81 msgid "set I/O port pins to given value (decimal number, pin1 is LSB)" msgstr "" -#: cmdlnopts.c:83 +#: cmdlnopts.c:82 msgid "" "configure I/O port pins to given value (decimal number, pin1 is LSB, 1 == " "output, 0 == input)" msgstr "" -#: cmdlnopts.c:85 +#: cmdlnopts.c:84 msgid "move focuser to absolute position, mm" msgstr "" -#: cmdlnopts.c:86 +#: cmdlnopts.c:85 msgid "move focuser to relative position, mm" msgstr "" -#: cmdlnopts.c:88 +#: cmdlnopts.c:87 msgid "set wheel position" msgstr "" -#: cmdlnopts.c:91 +#: cmdlnopts.c:90 msgid "Display image in OpenGL window" msgstr "" +#: ccdfunc.c:62 +#, c-format +msgid "Can't find plugin %s: %s" +msgstr "" + +#: ccdfunc.c:74 +#, c-format +msgid "Can't find focuser in plugin %s: %s" +msgstr "" + +#: ccdfunc.c:85 +#, c-format +msgid "Can't find camera in plugin %s: %s" +msgstr "" + +#: ccdfunc.c:96 +#, c-format +msgid "Can't find wheel in plugin %s: %s" +msgstr "" + +#: ccdfunc.c:149 +msgid "Camera device unknown" +msgstr "" + #. Не могу сохранить файл -#: ccdfunc.c:110 +#: ccdfunc.c:157 msgid "Can't save file" msgstr "" -#: ccdfunc.c:252 +#: ccdfunc.c:304 #, c-format msgid "File saved as '%s'" msgstr "" -#: ccdfunc.c:254 +#: ccdfunc.c:306 msgid "Error saving file" msgstr "" -#: ccdfunc.c:292 +#: ccdfunc.c:344 #, c-format msgid "Image stat:\n" msgstr "" -#: ccdfunc.c:303 -msgid "Focuser device not pointed, try to guess" +#: ccdfunc.c:357 +msgid "Focuser device not pointed" msgstr "" -#: ccdfunc.c:320 -msgid "Focuser not found" +#: ccdfunc.c:364 +msgid "No focusers found" msgstr "" -#: ccdfunc.c:325 +#: ccdfunc.c:377 #, c-format msgid "Found %d focusers, you point number %d" msgstr "" -#: ccdfunc.c:329 +#: ccdfunc.c:381 msgid "Can't set active focuser number" msgstr "" -#: ccdfunc.c:343 +#: ccdfunc.c:395 msgid "Can't get focuser limit positions" msgstr "" -#: ccdfunc.c:350 +#: ccdfunc.c:402 msgid "Can't get current focuser position" msgstr "" -#: ccdfunc.c:364 +#: ccdfunc.c:416 #, c-format msgid "Can't set position %g: out of limits [%g, %g]" msgstr "" -#: ccdfunc.c:368 +#: ccdfunc.c:420 msgid "Can't home focuser" msgstr "" -#: ccdfunc.c:370 +#: ccdfunc.c:422 #, c-format msgid "Can't set position %g" msgstr "" -#: ccdfunc.c:382 -msgid "Wheel device not pointed, try to guess" +#: ccdfunc.c:437 +msgid "Wheel device not pointed" msgstr "" -#: ccdfunc.c:399 -msgid "Wheel not found" +#: ccdfunc.c:444 +msgid "No wheels found" msgstr "" -#: ccdfunc.c:404 +#: ccdfunc.c:457 #, c-format msgid "Found %d wheels, you point number %d" msgstr "" -#: ccdfunc.c:408 +#: ccdfunc.c:461 msgid "Can't set active wheel number" msgstr "" -#: ccdfunc.c:424 +#: ccdfunc.c:477 msgid "Can't get max wheel position" msgstr "" -#: ccdfunc.c:431 +#: ccdfunc.c:484 #, c-format msgid "Wheel position should be from 0 to %d" msgstr "" -#: ccdfunc.c:435 +#: ccdfunc.c:488 #, c-format msgid "Can't set wheel position %d" msgstr "" -#: ccdfunc.c:452 +#: ccdfunc.c:507 #, c-format msgid "%.1f seconds till exposition ends" msgstr "" -#: ccdfunc.c:470 -msgid "Camera device not pointed, try to guess" +#: ccdfunc.c:528 +msgid "Camera device not pointed" msgstr "" -#: ccdfunc.c:487 -msgid "Camera not found" +#: ccdfunc.c:535 +msgid "No cameras found" msgstr "" -#: ccdfunc.c:492 +#: ccdfunc.c:547 #, c-format msgid "Found %d cameras, you point number %d" msgstr "" -#: ccdfunc.c:496 +#: ccdfunc.c:551 msgid "Can't set active camera number" msgstr "" -#: ccdfunc.c:502 +#: ccdfunc.c:557 msgid "Can't set fan speed" msgstr "" -#: ccdfunc.c:503 +#: ccdfunc.c:558 #, c-format msgid "Set fan speed to %d" msgstr "" -#: ccdfunc.c:508 +#: ccdfunc.c:563 #, c-format msgid "Camera model: %s" msgstr "" -#: ccdfunc.c:509 +#: ccdfunc.c:564 #, c-format msgid "Pixel size: %g x %g" msgstr "" -#: ccdfunc.c:515 +#: ccdfunc.c:570 #, c-format msgid "Full array: %s" msgstr "" -#: ccdfunc.c:518 +#: ccdfunc.c:573 #, c-format msgid "Field of view: %s" msgstr "" -#: ccdfunc.c:521 +#: ccdfunc.c:576 #, c-format msgid "Can't set T to %g degC" msgstr "" -#: ccdfunc.c:528 +#: ccdfunc.c:583 #, c-format msgid "Shutter command: %s\n" msgstr "" -#: ccdfunc.c:530 +#: ccdfunc.c:585 #, c-format msgid "Can't run shutter command %s (unsupported?)" msgstr "" #. "Попытка сконфигурировать порт I/O как %d\n" -#: ccdfunc.c:534 +#: ccdfunc.c:589 #, c-format msgid "Try to configure I/O port as %d" msgstr "" -#: ccdfunc.c:536 +#: ccdfunc.c:591 msgid "Can't configure (unsupported?)" msgstr "" -#: ccdfunc.c:542 +#: ccdfunc.c:597 msgid "Can't get IOport state (unsupported?)" msgstr "" #. "Попытка записи %d в порт I/O\n" -#: ccdfunc.c:546 +#: ccdfunc.c:601 #, c-format msgid "Try to write %d to I/O port" msgstr "" -#: ccdfunc.c:548 +#: ccdfunc.c:603 msgid "Can't set IOport" msgstr "" -#: ccdfunc.c:556 +#: ccdfunc.c:610 #, c-format msgid "Can't set binning %dx%d" msgstr "" -#: ccdfunc.c:558 -msgid "Can't get current binning" -msgstr "" - -#: ccdfunc.c:573 +#: ccdfunc.c:624 msgid "Can't set given geometry" msgstr "" -#: ccdfunc.c:576 +#: ccdfunc.c:627 #, c-format msgid "Can't set %d flushes" msgstr "" -#: ccdfunc.c:579 +#: ccdfunc.c:630 #, c-format msgid "Can't set exposure time to %f seconds" msgstr "" -#: ccdfunc.c:582 +#: ccdfunc.c:633 msgid "Can't change frame type" msgstr "" -#: ccdfunc.c:585 +#: ccdfunc.c:636 msgid "Can't set bit depth" msgstr "" -#: ccdfunc.c:588 +#: ccdfunc.c:638 msgid "Can't set readout speed" msgstr "" -#: ccdfunc.c:589 +#: ccdfunc.c:639 #, c-format msgid "Readout mode: %s" msgstr "" -#: ccdfunc.c:590 +#: ccdfunc.c:640 msgid "Only show statistics" msgstr "" -#: ccdfunc.c:601 +#. GET binning should be AFTER setgeometry! +#: ccdfunc.c:642 +msgid "Can't get current binning" +msgstr "" + +#: ccdfunc.c:655 msgid "Can't open OpenGL window, image preview will be inaccessible" msgstr "" #. Захват кадра %d\n -#: ccdfunc.c:608 +#: ccdfunc.c:662 #, c-format msgid "Capture frame %d" msgstr "" -#: ccdfunc.c:611 ccdfunc.c:633 ccdfunc.c:674 +#: ccdfunc.c:664 +msgid "Can't start exposition" +msgstr "" + +#: ccdfunc.c:668 ccdfunc.c:690 ccdfunc.c:731 msgid "Can't capture image" msgstr "" -#: ccdfunc.c:614 +#: ccdfunc.c:671 msgid "Read grabbed image" msgstr "" -#: ccdfunc.c:617 ccdfunc.c:637 ccdfunc.c:678 +#: ccdfunc.c:674 ccdfunc.c:694 ccdfunc.c:735 msgid "Can't grab image" msgstr "" #. %d секунд до окончания паузы\n -#: ccdfunc.c:654 +#: ccdfunc.c:711 #, c-format msgid "%d seconds till pause ends\n" msgstr "" diff --git a/locale/ru/ru.po b/locale/ru/ru.po index 7dac529..7b24e53 100644 --- a/locale/ru/ru.po +++ b/locale/ru/ru.po @@ -7,7 +7,7 @@ msgid "" msgstr "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" - "POT-Creation-Date: 2022-01-14 16:21+0300\n" + "POT-Creation-Date: 2022-03-01 20:27+0300\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -16,13 +16,13 @@ msgstr "Project-Id-Version: PACKAGE VERSION\n" "Content-Type: text/plain; charset=koi8-r\n" "Content-Transfer-Encoding: 8bit\n" -#: ccdfunc.c:452 +#: ccdfunc.c:507 #, c-format msgid "%.1f seconds till exposition ends" msgstr "" #. %d секунд до окончания паузы\n -#: ccdfunc.c:654 +#: ccdfunc.c:711 #, c-format msgid "%d seconds till pause ends\n" msgstr "" @@ -31,56 +31,77 @@ msgstr "" msgid "Already initialized!" msgstr "" -#: ccdfunc.c:470 -msgid "Camera device not pointed, try to guess" +#: ccdfunc.c:528 +msgid "Camera device not pointed" msgstr "" -#: ccdfunc.c:508 +#: ccdfunc.c:149 +msgid "Camera device unknown" +msgstr "" + +#: ccdfunc.c:563 #, c-format msgid "Camera model: %s" msgstr "" -#: ccdfunc.c:487 -msgid "Camera not found" -msgstr "" - -#: ccdfunc.c:611 ccdfunc.c:633 ccdfunc.c:674 +#: ccdfunc.c:668 ccdfunc.c:690 ccdfunc.c:731 msgid "Can't capture image" msgstr "" -#: ccdfunc.c:582 +#: ccdfunc.c:633 msgid "Can't change frame type" msgstr "" -#: ccdfunc.c:536 +#: ccdfunc.c:591 msgid "Can't configure (unsupported?)" msgstr "" -#: ccdfunc.c:542 +#: ccdfunc.c:85 +#, c-format +msgid "Can't find camera in plugin %s: %s" +msgstr "" + +#: ccdfunc.c:74 +#, c-format +msgid "Can't find focuser in plugin %s: %s" +msgstr "" + +#: ccdfunc.c:62 +#, c-format +msgid "Can't find plugin %s: %s" +msgstr "" + +#: ccdfunc.c:96 +#, c-format +msgid "Can't find wheel in plugin %s: %s" +msgstr "" + +#: ccdfunc.c:597 msgid "Can't get IOport state (unsupported?)" msgstr "" -#: ccdfunc.c:558 +#. GET binning should be AFTER setgeometry! +#: ccdfunc.c:642 msgid "Can't get current binning" msgstr "" -#: ccdfunc.c:350 +#: ccdfunc.c:402 msgid "Can't get current focuser position" msgstr "" -#: ccdfunc.c:343 +#: ccdfunc.c:395 msgid "Can't get focuser limit positions" msgstr "" -#: ccdfunc.c:424 +#: ccdfunc.c:477 msgid "Can't get max wheel position" msgstr "" -#: ccdfunc.c:617 ccdfunc.c:637 ccdfunc.c:678 +#: ccdfunc.c:674 ccdfunc.c:694 ccdfunc.c:735 msgid "Can't grab image" msgstr "" -#: ccdfunc.c:368 +#: ccdfunc.c:420 msgid "Can't home focuser" msgstr "" @@ -88,94 +109,98 @@ msgstr "" msgid "Can't init mutex!" msgstr "" -#: ccdfunc.c:601 +#: ccdfunc.c:655 msgid "Can't open OpenGL window, image preview will be inaccessible" msgstr "" -#: ccdfunc.c:530 +#: ccdfunc.c:585 #, c-format msgid "Can't run shutter command %s (unsupported?)" msgstr "" #. Не могу сохранить файл -#: ccdfunc.c:110 +#: ccdfunc.c:157 msgid "Can't save file" msgstr "" -#: ccdfunc.c:576 +#: ccdfunc.c:627 #, c-format msgid "Can't set %d flushes" msgstr "" -#: ccdfunc.c:548 +#: ccdfunc.c:603 msgid "Can't set IOport" msgstr "" -#: ccdfunc.c:521 +#: ccdfunc.c:576 #, c-format msgid "Can't set T to %g degC" msgstr "" -#: ccdfunc.c:496 +#: ccdfunc.c:551 msgid "Can't set active camera number" msgstr "" -#: ccdfunc.c:329 +#: ccdfunc.c:381 msgid "Can't set active focuser number" msgstr "" -#: ccdfunc.c:408 +#: ccdfunc.c:461 msgid "Can't set active wheel number" msgstr "" -#: ccdfunc.c:556 +#: ccdfunc.c:610 #, c-format msgid "Can't set binning %dx%d" msgstr "" -#: ccdfunc.c:585 +#: ccdfunc.c:636 msgid "Can't set bit depth" msgstr "" -#: ccdfunc.c:579 +#: ccdfunc.c:630 #, c-format msgid "Can't set exposure time to %f seconds" msgstr "" -#: ccdfunc.c:502 +#: ccdfunc.c:557 msgid "Can't set fan speed" msgstr "" -#: ccdfunc.c:573 +#: ccdfunc.c:624 msgid "Can't set given geometry" msgstr "" -#: ccdfunc.c:370 +#: ccdfunc.c:422 #, c-format msgid "Can't set position %g" msgstr "" -#: ccdfunc.c:364 +#: ccdfunc.c:416 #, c-format msgid "Can't set position %g: out of limits [%g, %g]" msgstr "" -#: ccdfunc.c:588 +#: ccdfunc.c:638 msgid "Can't set readout speed" msgstr "" -#: ccdfunc.c:435 +#: ccdfunc.c:488 #, c-format msgid "Can't set wheel position %d" msgstr "" +#: ccdfunc.c:664 +msgid "Can't start exposition" +msgstr "" + #. Захват кадра %d\n -#: ccdfunc.c:608 +#: ccdfunc.c:662 #, c-format msgid "Capture frame %d" msgstr "" -#: cmdlnopts.c:91 +#: cmdlnopts.c:90 msgid "Display image in OpenGL window" msgstr "" @@ -184,44 +209,40 @@ msgstr "" msgid "Equalization of histogram: %s" msgstr "" -#: ccdfunc.c:254 +#: ccdfunc.c:306 msgid "Error saving file" msgstr "" -#: ccdfunc.c:518 +#: ccdfunc.c:573 #, c-format msgid "Field of view: %s" msgstr "" -#: ccdfunc.c:252 +#: ccdfunc.c:304 #, c-format msgid "File saved as '%s'" msgstr "" -#: ccdfunc.c:303 -msgid "Focuser device not pointed, try to guess" +#: ccdfunc.c:357 +msgid "Focuser device not pointed" msgstr "" -#: ccdfunc.c:320 -msgid "Focuser not found" -msgstr "" - -#: ccdfunc.c:492 +#: ccdfunc.c:547 #, c-format msgid "Found %d cameras, you point number %d" msgstr "" -#: ccdfunc.c:325 +#: ccdfunc.c:377 #, c-format msgid "Found %d focusers, you point number %d" msgstr "" -#: ccdfunc.c:404 +#: ccdfunc.c:457 #, c-format msgid "Found %d wheels, you point number %d" msgstr "" -#: ccdfunc.c:515 +#: ccdfunc.c:570 #, c-format msgid "Full array: %s" msgstr "" @@ -231,174 +252,190 @@ msgstr "" msgid "Histogram conversion: %s" msgstr "" -#: ccdfunc.c:292 +#: ccdfunc.c:344 #, c-format msgid "Image stat:\n" msgstr "" -#: cmdlnopts.c:63 +#: cmdlnopts.c:62 msgid "N flushes before exposing (default: 1)" msgstr "" -#: ccdfunc.c:590 +#: ccdfunc.c:535 +msgid "No cameras found" +msgstr "" + +#: ccdfunc.c:364 +msgid "No focusers found" +msgstr "" + +#: ccdfunc.c:444 +msgid "No wheels found" +msgstr "" + +#: ccdfunc.c:640 msgid "Only show statistics" msgstr "" -#: ccdfunc.c:509 +#: ccdfunc.c:564 #, c-format msgid "Pixel size: %g x %g" msgstr "" -#: ccdfunc.c:614 +#: ccdfunc.c:671 msgid "Read grabbed image" msgstr "" -#: ccdfunc.c:589 +#: ccdfunc.c:639 #, c-format msgid "Readout mode: %s" msgstr "" -#: ccdfunc.c:503 +#: ccdfunc.c:558 #, c-format msgid "Set fan speed to %d" msgstr "" -#: ccdfunc.c:528 +#: ccdfunc.c:583 #, c-format msgid "Shutter command: %s\n" msgstr "" #. "Попытка сконфигурировать порт I/O как %d\n" -#: ccdfunc.c:534 +#: ccdfunc.c:589 #, c-format msgid "Try to configure I/O port as %d" msgstr "" #. "Попытка записи %d в порт I/O\n" -#: ccdfunc.c:546 +#: ccdfunc.c:601 #, c-format msgid "Try to write %d to I/O port" msgstr "" -#: ccdfunc.c:382 -msgid "Wheel device not pointed, try to guess" +#: ccdfunc.c:437 +msgid "Wheel device not pointed" msgstr "" -#: ccdfunc.c:399 -msgid "Wheel not found" -msgstr "" - -#: ccdfunc.c:431 +#: ccdfunc.c:484 #, c-format msgid "Wheel position should be from 0 to %d" msgstr "" -#: cmdlnopts.c:61 +#: cmdlnopts.c:60 msgid "add records to header from given file[s]" msgstr "" -#: cmdlnopts.c:43 +#: cmdlnopts.c:42 msgid "camera device number (if many: 0, 1, 2 etc)" msgstr "" -#: cmdlnopts.c:40 -msgid "camera device type (fli/zwo/etc)" +#: cmdlnopts.c:38 +msgid "camera device plugin (e.g. devfli.so)" msgstr "" -#: cmdlnopts.c:76 +#: cmdlnopts.c:75 msgid "close shutter" msgstr "" -#: cmdlnopts.c:83 +#: cmdlnopts.c:37 +msgid "common device plugin (e.g devfli.so)" +msgstr "" + +#: cmdlnopts.c:82 msgid "configure I/O port pins to given value (decimal number, pin1 is LSB, " "1 == output, 0 == input)" msgstr "" -#: cmdlnopts.c:51 +#: cmdlnopts.c:50 msgid "fast (8MHz) readout mode" msgstr "" -#: cmdlnopts.c:44 +#: cmdlnopts.c:43 msgid "filter wheel device number (if many: 0, 1, 2 etc)" msgstr "" -#: cmdlnopts.c:45 +#: cmdlnopts.c:44 msgid "focuser device number (if many: 0, 1, 2 etc)" msgstr "" -#: cmdlnopts.c:41 -msgid "focuser device type (fli/zwo/etc)" +#: cmdlnopts.c:39 +msgid "focuser device plugin (e.g. devzwo.so)" msgstr "" -#: cmdlnopts.c:69 +#: cmdlnopts.c:68 msgid "frame X0 coordinate (-1 - all with overscan)" msgstr "" -#: cmdlnopts.c:71 +#: cmdlnopts.c:70 msgid "frame X1 coordinate (-1 - all with overscan)" msgstr "" -#: cmdlnopts.c:70 +#: cmdlnopts.c:69 msgid "frame Y0 coordinate (-1 - all with overscan)" msgstr "" -#: cmdlnopts.c:72 +#: cmdlnopts.c:71 msgid "frame Y1 coordinate (-1 - all with overscan)" msgstr "" -#: cmdlnopts.c:79 +#: cmdlnopts.c:78 msgid "get value of I/O port pins" msgstr "" -#: cmdlnopts.c:73 +#: cmdlnopts.c:72 msgid "grab full frame (with overscans)" msgstr "" -#: cmdlnopts.c:64 +#: cmdlnopts.c:63 msgid "horizontal binning to N pixels" msgstr "" -#: cmdlnopts.c:57 +#: cmdlnopts.c:56 msgid "instrument name" msgstr "" -#: cmdlnopts.c:67 -msgid "make pause for N seconds between expositions" +#: cmdlnopts.c:41 +msgid "list connected devices" msgstr "" #: cmdlnopts.c:66 +msgid "make pause for N seconds between expositions" +msgstr "" + +#: cmdlnopts.c:65 msgid "make series of N frames" msgstr "" -#: cmdlnopts.c:85 +#: cmdlnopts.c:84 msgid "move focuser to absolute position, mm" msgstr "" -#: cmdlnopts.c:86 +#: cmdlnopts.c:85 msgid "move focuser to relative position, mm" msgstr "" -#: cmdlnopts.c:80 +#: cmdlnopts.c:79 msgid "move stepper motor asynchronous" msgstr "" -#: cmdlnopts.c:49 +#: cmdlnopts.c:48 msgid "not open shutter, when exposing (\"dark frames\")" msgstr "" -#: cmdlnopts.c:58 +#: cmdlnopts.c:57 msgid "object name" msgstr "" -#: cmdlnopts.c:56 +#: cmdlnopts.c:55 msgid "object type (neon, object, flat etc)" msgstr "" -#: cmdlnopts.c:59 +#: cmdlnopts.c:58 msgid "observers' names" msgstr "" -#: cmdlnopts.c:60 +#: cmdlnopts.c:59 msgid "observing program name" msgstr "" @@ -410,62 +447,62 @@ msgstr "" msgid "on" msgstr "" -#: cmdlnopts.c:75 +#: cmdlnopts.c:74 msgid "open shutter" msgstr "" -#: cmdlnopts.c:55 +#: cmdlnopts.c:54 msgid "program author" msgstr "" -#: cmdlnopts.c:47 +#: cmdlnopts.c:46 msgid "rewrite output file if exists" msgstr "" -#: cmdlnopts.c:78 +#: cmdlnopts.c:77 msgid "run exposition on HIGH @ pin5 I/O port" msgstr "" -#: cmdlnopts.c:77 +#: cmdlnopts.c:76 msgid "run exposition on LOW @ pin5 I/O port" msgstr "" -#: cmdlnopts.c:50 +#: cmdlnopts.c:49 msgid "run in 8-bit mode" msgstr "" -#: cmdlnopts.c:52 +#: cmdlnopts.c:51 msgid "set CCD temperature to given value (degr C)" msgstr "" -#: cmdlnopts.c:82 +#: cmdlnopts.c:81 msgid "set I/O port pins to given value (decimal number, pin1 is LSB)" msgstr "" -#: cmdlnopts.c:68 -msgid "set exposure time to given value (ms)" +#: cmdlnopts.c:67 +msgid "set exposure time to given value (seconds!)" msgstr "" -#: cmdlnopts.c:53 +#: cmdlnopts.c:52 msgid "set fan speed (0 - off, 1 - low, 2 - high)" msgstr "" -#: cmdlnopts.c:88 +#: cmdlnopts.c:87 msgid "set wheel position" msgstr "" -#: cmdlnopts.c:46 +#: cmdlnopts.c:45 msgid "show this help" msgstr "" -#: cmdlnopts.c:48 +#: cmdlnopts.c:47 msgid "verbose level (each -v increase it)" msgstr "" -#: cmdlnopts.c:65 +#: cmdlnopts.c:64 msgid "vertical binning to N pixels" msgstr "" -#: cmdlnopts.c:42 -msgid "wheel device type (fli/zwo/etc)" +#: cmdlnopts.c:40 +msgid "wheel device plugin (e.g. devdummy.so)" msgstr ""