mirror of
https://github.com/eddyem/CCD_Capture.git
synced 2025-12-06 10:45:13 +03:00
add DUMMY model
This commit is contained in:
parent
838c9567c3
commit
a9ddbc39b8
@ -39,6 +39,11 @@ if(DEFINED IMAGEVIEW AND IMAGEVIEW STREQUAL "yes")
|
||||
add_definitions(-DIMAGEVIEW)
|
||||
endif()
|
||||
|
||||
add_subdirectory(Dummy_cameras)
|
||||
list(APPEND ${PROJ}_INCLUDE_DIRS Dummy_cameras)
|
||||
list(APPEND ${PROJ}_LIBRARIES ${DUMMYLIB})
|
||||
include_directories(Dummy_cameras)
|
||||
|
||||
# additional modules with CCD/CMOS support
|
||||
if(DEFINED ZWO AND ZWO STREQUAL "yes")
|
||||
add_subdirectory(ZWO_cameras)
|
||||
|
||||
23
Dummy_cameras/CMakeLists.txt
Normal file
23
Dummy_cameras/CMakeLists.txt
Normal file
@ -0,0 +1,23 @@
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
set(CCDLIB dummy_module)
|
||||
set(DUMMYLIB ${CCDLIB} PARENT_SCOPE)
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(${CCDLIB} REQUIRED usefull_macros)
|
||||
|
||||
set(CFLAGS -O3 -Wextra -Wall -W -std=gnu99)
|
||||
set(CMAKE_COLOR_MAKEFILE ON)
|
||||
|
||||
if(DEFINED DEBUG AND DEBUG STREQUAL "yes")
|
||||
set(CFLAGS ${CFLAGS} -Werror)
|
||||
add_definitions(-DEBUG)
|
||||
set(CMAKE_VERBOSE_MAKEFILE "ON")
|
||||
endif()
|
||||
|
||||
add_definitions(${CFLAGS})
|
||||
|
||||
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})
|
||||
285
Dummy_cameras/dummyfunc.c
Normal file
285
Dummy_cameras/dummyfunc.c
Normal file
@ -0,0 +1,285 @@
|
||||
/*
|
||||
* This file is part of the CCD_Capture project.
|
||||
* Copyright 2022 Edward V. Emelianov <edward.emelianoff@gmail.com>.
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <usefull_macros.h>
|
||||
|
||||
#include "dummyfunc.h"
|
||||
|
||||
static const int filtermax = 5;
|
||||
static const float focmaxpos = 10.;
|
||||
static int curhbin = 1, curvbin = 1;
|
||||
static int filterpos = 0;
|
||||
static float focuserpos = 1., brightness = 1., gain = 0.;
|
||||
static float camtemp = -30.;
|
||||
static capture_status capstat = CAPTURE_NO;
|
||||
|
||||
static int campoll(capture_status *st, float *remain){
|
||||
if(capstat == CAPTURE_NO){
|
||||
if(st) *st = capstat = CAPTURE_PROCESS;
|
||||
if(remain) *remain = 0.5;
|
||||
}else{
|
||||
capstat = CAPTURE_NO;
|
||||
if(st) *st = CAPTURE_READY;
|
||||
if(remain) *remain = 0.;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int camcapt(IMG *ima){
|
||||
if(!ima || !ima->data) return FALSE;
|
||||
uint16_t *d = ima->data;
|
||||
for(int y = 0; y < ima->h; ++y)
|
||||
for(int x = 0; x < ima->w; ++x) // sinusoide 100x200
|
||||
*d++ = (uint16_t)(sin(x * 50/M_PI)*sin(y * 100/M_PI)*65535.);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void camcancel(){
|
||||
capstat = CAPTURE_NO;
|
||||
}
|
||||
|
||||
static int setdevno(int n){
|
||||
if(n) return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int camsetbrig(float b){
|
||||
brightness = b;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int camgetbrig(float *b){
|
||||
if(!b) return FALSE;
|
||||
*b = brightness;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int camsetexp(_U_ float t){
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int camsetgain(float g){
|
||||
gain = g;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int camgetgain(float *g){
|
||||
if(g) *g = gain;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int camsett(float t){
|
||||
camtemp = t;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int camgett(float *t){
|
||||
if(t) *t = camtemp;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int gett(float *t){
|
||||
if(t) *t = M_PI;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int camsetbin(int h, int v){
|
||||
curhbin = h; curvbin = v;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int camshutter(_U_ shutter_op s){
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int camsetgeom(frameformat *f){
|
||||
if(!f) return FALSE;
|
||||
DUMMYcam.geometry = *f;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int camgetnam(char *n, int l){
|
||||
strncpy(n, "Dummy camera", l);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int camgmg(float *mg){
|
||||
if(mg) *mg = 10.;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int camggl(frameformat *max, frameformat *step){
|
||||
if(max) *max = DUMMYcam.array;
|
||||
if(step) *step = (frameformat){1,1,1,1};
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int camgetbin(int *binh, int *binv){
|
||||
if(binh) *binh = curhbin;
|
||||
if(binv) *binv = curvbin;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int camgetio(int *io){
|
||||
if(io) *io = 0xDEADBEEF;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static int camfan(_U_ fan_speed spd){return TRUE;}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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 TRUE;
|
||||
}
|
||||
|
||||
static void vstub(){
|
||||
return;
|
||||
}
|
||||
static int istub(_U_ int N){return TRUE;}
|
||||
|
||||
/*
|
||||
* Global objects: camera, focuser and wheel
|
||||
*/
|
||||
Camera DUMMYcam = {
|
||||
.check = stub,
|
||||
.Ndevices = 1,
|
||||
.close = vstub,
|
||||
.pollcapture = campoll,
|
||||
.capture = camcapt,
|
||||
.cancel = camcancel,
|
||||
// setters:
|
||||
.setDevNo = setdevno,
|
||||
.setbrightness = camsetbrig,
|
||||
.setexp = camsetexp,
|
||||
.setgain = camsetgain,
|
||||
.setT = camsett,
|
||||
.setbin = camsetbin,
|
||||
.setnflushes = istub,
|
||||
.shuttercmd = camshutter,
|
||||
.confio = istub,
|
||||
.setio = istub,
|
||||
.setframetype = istub,
|
||||
.setbitdepth = istub,
|
||||
.setfastspeed = istub,
|
||||
.setgeometry = camsetgeom,
|
||||
.setfanspeed = camfan,
|
||||
// getters:
|
||||
.getbrightness = camgetbrig,
|
||||
.getModelName = camgetnam,
|
||||
.getgain = camgetgain,
|
||||
.getmaxgain = camgmg,
|
||||
.getgeomlimits = camggl,
|
||||
.getTcold = camgett,
|
||||
.getThot = camgett,
|
||||
.getTbody = gett,
|
||||
.getbin = camgetbin,
|
||||
.getio = camgetio,
|
||||
.pixX = 10.,
|
||||
.pixY = 10.,
|
||||
.field = (frameformat){.h = 1024, .w = 1024, .xoff = 10, .yoff = 10},
|
||||
.array = (frameformat){.h = 1050, .w = 1050, .xoff = 0, .yoff = 0},
|
||||
.geometry = {0},
|
||||
};
|
||||
|
||||
Focuser DUMMYfocus = {
|
||||
.check = stub,
|
||||
.Ndevices = 1,
|
||||
.close = vstub,
|
||||
// setters:
|
||||
.setDevNo = setdevno,
|
||||
.setAbsPos = focsetpos,
|
||||
.home = fochome,
|
||||
// getters:
|
||||
.getModelName = focgetnam,
|
||||
.getTbody = gett,
|
||||
.getPos = focpos,
|
||||
.getMaxPos = focMp,
|
||||
.getMinPos = focmp,
|
||||
};
|
||||
|
||||
Wheel DUMMYwheel = {
|
||||
.check = stub,
|
||||
.Ndevices = 1,
|
||||
.close = vstub,
|
||||
// setters
|
||||
.setDevNo = setdevno,
|
||||
.setPos = whlsetpos,
|
||||
// getters
|
||||
.getModelName = whlgetnam,
|
||||
.getTbody = gett,
|
||||
.getPos = whlgetpos,
|
||||
.getMaxPos = whlgmp,
|
||||
};
|
||||
29
Dummy_cameras/dummyfunc.h
Normal file
29
Dummy_cameras/dummyfunc.h
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
* This file is part of the CCD_Capture project.
|
||||
* Copyright 2022 Edward V. Emelianov <edward.emelianoff@gmail.com>.
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef DUMMYFUNC_H__
|
||||
#define DUMMYFUNC_H__
|
||||
|
||||
#include "ccdfunc.h"
|
||||
|
||||
extern Camera DUMMYcam;
|
||||
extern Focuser DUMMYfocus;
|
||||
extern Wheel DUMMYwheel;
|
||||
|
||||
#endif // DUMMYFUNC_H__
|
||||
@ -10,7 +10,6 @@ set(CMAKE_COLOR_MAKEFILE ON)
|
||||
|
||||
if(DEFINED DEBUG AND DEBUG STREQUAL "yes")
|
||||
set(CFLAGS ${CFLAGS} -Werror)
|
||||
message ("DBG = ${DEBUG}, CFLAGS=${CFLAGS}")
|
||||
add_definitions(-DEBUG)
|
||||
set(CMAKE_VERBOSE_MAKEFILE "ON")
|
||||
endif()
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the FLI_control project.
|
||||
* Copyright 2020 Edward V. Emelianov <edward.emelianoff@gmail.com>.
|
||||
* This file is part of the CCD_Capture project.
|
||||
* Copyright 2022 Edward V. Emelianov <edward.emelianoff@gmail.com>.
|
||||
*
|
||||
* 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
|
||||
@ -16,19 +16,9 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <fitsio.h>
|
||||
#include <libfli.h>
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#include <pthread.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <usefull_macros.h>
|
||||
|
||||
#include "flifunc.h"
|
||||
@ -59,19 +49,6 @@ do{ if((fli_err = f(__VA_ARGS__))) \
|
||||
WARNX(#f "() failed"); \
|
||||
}while(0)
|
||||
|
||||
#define TRYFITS(f, ...) \
|
||||
do{ int status = 0; \
|
||||
f(__VA_ARGS__, &status); \
|
||||
if (status){ \
|
||||
fits_report_error(stderr, status); \
|
||||
return -1;} \
|
||||
}while(0)
|
||||
#define WRITEKEY(...) \
|
||||
do{ int status = 0; \
|
||||
fits_write_key(__VA_ARGS__, &status); \
|
||||
if(status) fits_report_error(stderr, status);\
|
||||
}while(0)
|
||||
|
||||
typedef struct{
|
||||
flidomain_t domain;
|
||||
char *dname;
|
||||
@ -687,7 +664,9 @@ Camera FLIcam = {
|
||||
.setbrightness = fli_ffalse,
|
||||
.setgain = fli_ffalse,
|
||||
.getmaxgain = fli_fpfalse,
|
||||
.geometry = {0},
|
||||
};
|
||||
|
||||
Focuser FLIfocus = {
|
||||
.check = fli_findFocuser,
|
||||
.setDevNo = fli_setActiceFocuser,
|
||||
@ -700,6 +679,7 @@ Focuser FLIfocus = {
|
||||
.home = fli_fhome,
|
||||
.setAbsPos = fli_fgoto,
|
||||
};
|
||||
|
||||
Wheel FLIwheel = {
|
||||
.check = fli_findWheel,
|
||||
.setDevNo = fli_setActiceWheel,
|
||||
|
||||
52
ccdfunc.c
52
ccdfunc.c
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the FLI_control project.
|
||||
* Copyright 2020 Edward V. Emelianov <edward.emelianoff@gmail.com>.
|
||||
* This file is part of the CCD_Capture project.
|
||||
* Copyright 2022 Edward V. Emelianov <edward.emelianoff@gmail.com>.
|
||||
*
|
||||
* 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
|
||||
@ -16,20 +16,14 @@
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <fitsio.h>
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "ccdfunc.h"
|
||||
#include "cmdlnopts.h"
|
||||
#include "dummyfunc.h"
|
||||
#ifdef USEFLI
|
||||
#include "flifunc.h"
|
||||
#endif
|
||||
@ -261,7 +255,7 @@ cloerr:
|
||||
}
|
||||
}
|
||||
|
||||
static void print_stat(IMG *image){
|
||||
static void calculate_stat(IMG *image){
|
||||
long i, Noverld = 0L, size = image->h*image->w;
|
||||
float pv, sum=0., sum2=0., sz = (float)size;
|
||||
uint16_t *ptr = image->data, val;
|
||||
@ -275,13 +269,14 @@ static void print_stat(IMG *image){
|
||||
if(min > val) min = val;
|
||||
if(val >= 65530) Noverld++;
|
||||
}
|
||||
// óÔÁÔÉÓÔÉËÁ ÐÏ ÉÚÏÂÒÁÖÅÎÉÀ:\n
|
||||
if(GP->verbose){
|
||||
printf(_("Image stat:\n"));
|
||||
float avr = sum/sz;
|
||||
printf("avr = %.1f, std = %.1f, Noverload = %ld\n", image->avr = avr,
|
||||
image->std = sqrt(fabs(sum2/sz - avr*avr)), Noverld);
|
||||
printf("max = %u, min = %u, size = %ld\n", max, min, size);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Find focusers and work with each of them
|
||||
@ -296,11 +291,12 @@ void focusers(){
|
||||
if(ZWOfocus.check()) focuser = &ZWOfocus;
|
||||
#endif
|
||||
}else{
|
||||
if(strcasecmp(GP->cameradev, "dummy") == 0) focuser = &DUMMYfocus;
|
||||
#ifdef USEFLI
|
||||
if(strcasecmp(GP->focuserdev, "fli") == 0) focuser = &FLIfocus;
|
||||
else if(strcasecmp(GP->focuserdev, "fli") == 0) focuser = &FLIfocus;
|
||||
#endif
|
||||
#ifdef USEZWO
|
||||
if(strcasecmp(GP->focuserdev, "zwo") == 0) focuser = &ZWOfocus;
|
||||
else if(strcasecmp(GP->focuserdev, "zwo") == 0) focuser = &ZWOfocus;
|
||||
#endif
|
||||
}
|
||||
if(!focuser){
|
||||
@ -374,11 +370,12 @@ void wheels(){
|
||||
if(ZWOwheel.check()) wheel = &ZWOwheel;
|
||||
#endif
|
||||
}else{
|
||||
if(strcasecmp(GP->cameradev, "dummy") == 0) wheel = &DUMMYwheel;
|
||||
#ifdef USEFLI
|
||||
if(strcasecmp(GP->wheeldev, "fli") == 0) wheel = &FLIwheel;
|
||||
else if(strcasecmp(GP->wheeldev, "fli") == 0) wheel = &FLIwheel;
|
||||
#endif
|
||||
#ifdef USEZWO
|
||||
if(strcasecmp(GP->wheeldev, "zwo") == 0) wheel = &ZWOwheel;
|
||||
else if(strcasecmp(GP->wheeldev, "zwo") == 0) wheel = &ZWOwheel;
|
||||
#endif
|
||||
}
|
||||
if(!wheel){
|
||||
@ -394,6 +391,10 @@ void wheels(){
|
||||
WARNX(_("Can't set active wheel number"));
|
||||
goto retn;
|
||||
}
|
||||
char buf[BUFSIZ];
|
||||
if(wheel->getModelName(buf, BUFSIZ)){
|
||||
verbose(2, "Wheel model: %s", buf);
|
||||
}
|
||||
float t;
|
||||
if(wheel->getTbody(&t)){
|
||||
verbose(1, "WHEELTEMP=%.1f", t);
|
||||
@ -441,16 +442,17 @@ void ccds(){
|
||||
if(ZWOcam.check()) camera = &ZWOcam;
|
||||
#endif
|
||||
}else{
|
||||
if(strcasecmp(GP->cameradev, "dummy") == 0) camera = &DUMMYcam;
|
||||
#ifdef USEFLI
|
||||
if(strcasecmp(GP->cameradev, "fli") == 0) camera = &FLIcam;
|
||||
else if(strcasecmp(GP->cameradev, "fli") == 0) camera = &FLIcam;
|
||||
#endif
|
||||
#ifdef USEZWO
|
||||
if(strcasecmp(GP->cameradev, "zwo") == 0) camera = &ZWOcam;
|
||||
else if(strcasecmp(GP->cameradev, "zwo") == 0) camera = &ZWOcam;
|
||||
#endif
|
||||
}
|
||||
if(!camera){
|
||||
WARNX(_("Camera device not found"));
|
||||
goto retn;
|
||||
WARNX(_("Camera not found"));
|
||||
return;
|
||||
}
|
||||
int num = GP->camdevno;
|
||||
if(num > camera->Ndevices - 1){
|
||||
@ -465,6 +467,7 @@ void ccds(){
|
||||
if(GP->fanspeed > FAN_HIGH) GP->fanspeed = FAN_HIGH;
|
||||
if(!camera->setfanspeed((fan_speed)GP->fanspeed))
|
||||
WARNX(_("Can't set fan speed"));
|
||||
else verbose(0, _("Set fan speed to %d"), GP->fanspeed);
|
||||
}
|
||||
int x0,x1, y0,y1;
|
||||
char buf[BUFSIZ];
|
||||
@ -495,13 +498,13 @@ void ccds(){
|
||||
}
|
||||
if(GP->confio > -1){
|
||||
// "ðÏÐÙÔËÁ ÓËÏÎÆÉÇÕÒÉÒÏ×ÁÔØ ÐÏÒÔ I/O ËÁË %d\n"
|
||||
verbose(1, _("Try to convfigure I/O port as %d"), GP->confio);
|
||||
verbose(1, _("Try to configure I/O port as %d"), GP->confio);
|
||||
if(!camera->confio(GP->confio))
|
||||
WARNX(_("Can't configure (unsupported?)"));
|
||||
}
|
||||
if(GP->getio){
|
||||
if(camera->getio(&tmpi))
|
||||
verbose(1, "CCDIOPORT=9x%02x\n", tmpi);
|
||||
verbose(0, "CCDIOPORT=0x%02X\n", tmpi);
|
||||
else
|
||||
WARNX(_("Can't get IOport state (unsupported?)"));
|
||||
}
|
||||
@ -554,15 +557,14 @@ void ccds(){
|
||||
tmpi = (GP->fast) ? 1 : 0;
|
||||
if(!camera->setfastspeed(tmpi))
|
||||
WARNX(_("Can't set readout speed"));
|
||||
else if(GP->fast) verbose(1, _("Fast readout mode"));
|
||||
else verbose(1, _("Readout mode: %s"), GP->fast ? "fast" : "normal");
|
||||
if(!GP->outfile) verbose(1, _("Only show statistics"));
|
||||
|
||||
uint16_t *img = MALLOC(uint16_t, raw_width * raw_height);
|
||||
IMG ima = {.data = img, .w = raw_width, .h = raw_height};
|
||||
for(int j = 0; j < GP->nframes; ++j){
|
||||
verbose(1, "\n\n");
|
||||
// úÁÈ×ÁÔ ËÁÄÒÁ %d\n
|
||||
verbose(1, _("Capture frame %d\n"), j);
|
||||
verbose(1, _("Capture frame %d"), j);
|
||||
capture_status cs;
|
||||
float tleave = 1.;
|
||||
while(camera->pollcapture(&cs, &tleave)){
|
||||
@ -583,7 +585,7 @@ void ccds(){
|
||||
WARNX(_("Can't grab image"));
|
||||
break;
|
||||
}
|
||||
print_stat(&ima);
|
||||
calculate_stat(&ima);
|
||||
saveFITS(&ima, GP->outfile);
|
||||
#ifdef IMAGEVIEW
|
||||
if(GP->showimage){ // display image
|
||||
|
||||
@ -54,6 +54,7 @@ typedef enum{
|
||||
typedef enum{
|
||||
FAN_OFF,
|
||||
FAN_LOW,
|
||||
FAN_MID,
|
||||
FAN_HIGH,
|
||||
} fan_speed;
|
||||
|
||||
@ -84,7 +85,9 @@ typedef struct{
|
||||
int (*setgeometry)(frameformat *fmt); // set geometry in UNBINNED coordinates
|
||||
int (*setfanspeed)(fan_speed spd); // set fan speed
|
||||
// getters:
|
||||
int (*getbrightness)(float *b);// get brightnes level
|
||||
int (*getModelName)(char *n, int l);// string with model name (l - length of n in bytes)
|
||||
int (*getgain)(float *g); // get gain value
|
||||
int (*getmaxgain)(float *g);// get max available gain value
|
||||
// get limits of geometry: maximal values and steps
|
||||
int (*getgeomlimits)(frameformat *max, frameformat *step);
|
||||
|
||||
38
cmdlnopts.c
38
cmdlnopts.c
@ -1,42 +1,14 @@
|
||||
/*
|
||||
* cmdlnopts.c - the only function that parse cmdln args and returns glob parameters
|
||||
*
|
||||
* Copyright 2013 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* 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 2 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, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h> // NAN
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <math.h>
|
||||
#include <limits.h>
|
||||
#include <libfli.h>
|
||||
#include <usefull_macros.h>
|
||||
|
||||
#include "cmdlnopts.h"
|
||||
#include "usefull_macros.h"
|
||||
|
||||
#define RAD 57.2957795130823
|
||||
#define D2R(x) ((x) / RAD)
|
||||
#define R2D(x) ((x) * RAD)
|
||||
|
||||
/*
|
||||
* here are global parameters initialisation
|
||||
*/
|
||||
static int help;
|
||||
static glob_pars G;
|
||||
glob_pars *GP = NULL;
|
||||
@ -159,7 +131,7 @@ glob_pars *parse_args(int argc, char **argv){
|
||||
void verbose(int levl, const char *fmt, ...){
|
||||
va_list ar;
|
||||
if(levl > G.verbose) return;
|
||||
printf("%s: ", __progname);
|
||||
//printf("%s: ", __progname);
|
||||
va_start(ar, fmt);
|
||||
vprintf(fmt, ar);
|
||||
va_end(ar);
|
||||
|
||||
19
cmdlnopts.h
19
cmdlnopts.h
@ -1,11 +1,10 @@
|
||||
/*
|
||||
* cmdlnopts.h - comand line options for parceargs
|
||||
* This file is part of the CCD_Capture project.
|
||||
* Copyright 2022 Edward V. Emelianov <edward.emelianoff@gmail.com>.
|
||||
*
|
||||
* Copyright 2013 Edward V. Emelianoff <eddy@sao.ru>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* 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 2 of the License, or
|
||||
* 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,
|
||||
@ -14,14 +13,12 @@
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __CMDLNOPTS_H__
|
||||
#define __CMDLNOPTS_H__
|
||||
#ifndef CMDLNOPTS_H__
|
||||
#define CMDLNOPTS_H__
|
||||
|
||||
#include "ccdfunc.h"
|
||||
#include <usefull_macros.h>
|
||||
@ -78,4 +75,4 @@ extern glob_pars *GP;
|
||||
|
||||
glob_pars *parse_args(int argc, char **argv);
|
||||
void verbose(int levl, const char *fmt, ...);
|
||||
#endif // __CMDLNOPTS_H__
|
||||
#endif // CMDLNOPTS_H__
|
||||
|
||||
13
events.c
13
events.c
@ -1,11 +1,10 @@
|
||||
/*
|
||||
* events.c
|
||||
* This file is part of the CCD_Capture project.
|
||||
* Copyright 2022 Edward V. Emelianov <edward.emelianoff@gmail.com>.
|
||||
*
|
||||
* Copyright 2015 Edward V. Emelianov <eddy@sao.ru, edward.emelianoff@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* 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 2 of the License, or
|
||||
* 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,
|
||||
@ -14,9 +13,7 @@
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <usefull_macros.h>
|
||||
|
||||
19
events.h
19
events.h
@ -1,11 +1,10 @@
|
||||
/*
|
||||
* events.h
|
||||
* This file is part of the CCD_Capture project.
|
||||
* Copyright 2022 Edward V. Emelianov <edward.emelianoff@gmail.com>.
|
||||
*
|
||||
* Copyright 2015 Edward V. Emelianov <eddy@sao.ru, edward.emelianoff@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* 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 2 of the License, or
|
||||
* 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,
|
||||
@ -14,14 +13,12 @@
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __EVENTS_H__
|
||||
#define __EVENTS_H__
|
||||
#ifndef EVENTS_H__
|
||||
#define EVENTS_H__
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
@ -39,4 +36,4 @@ void createMenu();
|
||||
void menuEvents(int opt);
|
||||
//void mouseWheel(int button, int dir, int x, int y);
|
||||
|
||||
#endif // __EVENTS_H__
|
||||
#endif // EVENTS_H__
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the FLI_control project.
|
||||
* Copyright 2020 Edward V. Emelianov <edward.emelianoff@gmail.com>.
|
||||
* This file is part of the CCD_Capture project.
|
||||
* Copyright 2022 Edward V. Emelianov <edward.emelianoff@gmail.com>.
|
||||
*
|
||||
* 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
|
||||
|
||||
21
imageview.h
21
imageview.h
@ -1,11 +1,10 @@
|
||||
/*
|
||||
* imageview.h
|
||||
* This file is part of the CCD_Capture project.
|
||||
* Copyright 2022 Edward V. Emelianov <edward.emelianoff@gmail.com>.
|
||||
*
|
||||
* Copyright 2015 Edward V. Emelianov <eddy@sao.ru, edward.emelianoff@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* 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 2 of the License, or
|
||||
* 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,
|
||||
@ -14,13 +13,12 @@
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#ifndef __BMPVIEW_H__
|
||||
#define __BMPVIEW_H__
|
||||
#ifndef IMAGEVIEW_H__
|
||||
#define IMAGEVIEW_H__
|
||||
|
||||
#include <math.h>
|
||||
#include <pthread.h>
|
||||
@ -88,4 +86,5 @@ void conv_image_to_mouse_coords(float X, float Y, int *x, int *y, windowData *wi
|
||||
|
||||
void* image_thread(void *data);
|
||||
void change_displayed_image(windowData *win, IMG *img);
|
||||
#endif // __BMPVIEW_H__
|
||||
|
||||
#endif // IMAGEVIEW_H__
|
||||
|
||||
15
main.c
15
main.c
@ -1,12 +1,10 @@
|
||||
/*
|
||||
* geany_encoding=koi8-r
|
||||
* main.c
|
||||
* This file is part of the CCD_Capture project.
|
||||
* Copyright 2022 Edward V. Emelianov <edward.emelianoff@gmail.com>.
|
||||
*
|
||||
* Copyright 2017 Edward V. Emelianov <eddy@sao.ru, edward.emelianoff@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* 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 2 of the License, or
|
||||
* 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,
|
||||
@ -15,10 +13,7 @@
|
||||
* 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, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user