mirror of
https://github.com/eddyem/CCD_Capture.git
synced 2026-11-22 13:50:21 +03:00
Compare commits
3 Commits
4192fc7f02
...
fe594aef8c
| Author | SHA1 | Date | |
|---|---|---|---|
| fe594aef8c | |||
| 3d286547a3 | |||
| f6d2fd2e45 |
@@ -46,7 +46,7 @@ static double expt[2] = {0.}; // min/max exposition time
|
|||||||
static double exptime = 0.; // actual exposition time
|
static double exptime = 0.; // actual exposition time
|
||||||
static double tstart = 0.; // exposure start time
|
static double tstart = 0.; // exposure start time
|
||||||
static char whynot[BUFSIZ]; // temporary buffer for error messages
|
static char whynot[BUFSIZ]; // temporary buffer for error messages
|
||||||
static int imW = 0, imH = 0; // size of output image
|
static int imW = 0, imH = 0; // size of output image (BINNED!)
|
||||||
static int pid = -1, vid = -1;
|
static int pid = -1, vid = -1;
|
||||||
static int isexposuring = 0;
|
static int isexposuring = 0;
|
||||||
|
|
||||||
@@ -224,8 +224,8 @@ static int setgeometry(cc_frameformat *f){
|
|||||||
if(ApnGlueSetExpGeom(f->w, f->h, ow, 0, hbin, vbin,
|
if(ApnGlueSetExpGeom(f->w, f->h, ow, 0, hbin, vbin,
|
||||||
f->xoff, f->yoff, &imW, &imH, whynot)){
|
f->xoff, f->yoff, &imW, &imH, whynot)){
|
||||||
WARNX("Can't set geometry: %s", whynot);
|
WARNX("Can't set geometry: %s", whynot);
|
||||||
imW = f->w;
|
imW = f->w / hbin;
|
||||||
imH = f->h;
|
imH = f->h / vbin;
|
||||||
}else{
|
}else{
|
||||||
camera.geometry = *f;
|
camera.geometry = *f;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -345,7 +345,8 @@ static int pollcapt(cc_capture_status *st, float *remain){
|
|||||||
static int capture(cc_IMG *ima){
|
static int capture(cc_IMG *ima){
|
||||||
FNAME();
|
FNAME();
|
||||||
//double __t0 = dtime();
|
//double __t0 = dtime();
|
||||||
if(!ima || !ima->data || !imgBuf || !isopened || !cc_fiximage(bitdepth, camera.geometry.w, camera.geometry.h, ima)) return FALSE;
|
if(!ima || !ima->data || !imgBuf || !isopened ||
|
||||||
|
!cc_fiximage(bitdepth, camera.geometry.w / curhbin, camera.geometry.h / curvbin, ima)) return FALSE;
|
||||||
static int toohot = FALSE;
|
static int toohot = FALSE;
|
||||||
float_values f;
|
float_values f;
|
||||||
//TIMESTAMP("start capt");
|
//TIMESTAMP("start capt");
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ add_custom_command(
|
|||||||
DEPENDS ru_file_updated
|
DEPENDS ru_file_updated
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_target(
|
||||||
OUTPUT ru_file_updated
|
OUTPUT ru_file_updated
|
||||||
COMMAND [ -f ${RU_FILE} ] && ${GETTEXT_MSGMERGE_EXECUTABLE} -Uis ${RU_FILE} ${PO_FILE} || cp ${PO_FILE} ${RU_FILE}
|
COMMAND [ -f ${RU_FILE} ] && ${GETTEXT_MSGMERGE_EXECUTABLE} -Uis ${RU_FILE} ${PO_FILE} || cp ${PO_FILE} ${RU_FILE}
|
||||||
COMMAND ${CMAKE_COMMAND} -E touch ru_file_updated
|
COMMAND ${CMAKE_COMMAND} -E touch ru_file_updated
|
||||||
@@ -176,3 +176,5 @@ add_custom_command(
|
|||||||
)
|
)
|
||||||
|
|
||||||
add_custom_target(MO_FILE ALL DEPENDS ${MO_FILE})
|
add_custom_target(MO_FILE ALL DEPENDS ${MO_FILE})
|
||||||
|
add_dependencies(${PROJ} MO_FILE)
|
||||||
|
install(FILES ${MO_FILE} DESTINATION "${LOCALEDIR}/ru/LC_MESSAGES")
|
||||||
|
|||||||
@@ -71,7 +71,8 @@ static int startexp(){
|
|||||||
|
|
||||||
static int camcapt(cc_IMG *ima){
|
static int camcapt(cc_IMG *ima){
|
||||||
static int n = 0;
|
static int n = 0;
|
||||||
if(!ima || !ima->data || !cc_fiximage(bitpix, camera.geometry.w, camera.geometry.h, ima)) return FALSE;
|
if(!ima || !ima->data ||
|
||||||
|
!cc_fiximage(bitpix, camera.geometry.w / curhbin, camera.geometry.h / curvbin, ima)) return FALSE;
|
||||||
#ifdef EBUG
|
#ifdef EBUG
|
||||||
double t0 = sl_dtime();
|
double t0 = sl_dtime();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -462,7 +462,8 @@ retn:
|
|||||||
|
|
||||||
static int fli_capt(cc_IMG *ima){
|
static int fli_capt(cc_IMG *ima){
|
||||||
int bitpix = is16bit ? 16 : 8;
|
int bitpix = is16bit ? 16 : 8;
|
||||||
if(!ima || !ima->data || !cc_fiximage(bitpix, camera.geometry.w, camera.geometry.h, ima)) return FALSE;
|
if(!ima || !ima->data ||
|
||||||
|
!cc_fiximage(bitpix, camera.geometry.w / curhbin, camera.geometry.h / curvbin, ima)) return FALSE;
|
||||||
for(int row = 0; row < ima->h; row++){
|
for(int row = 0; row < ima->h; row++){
|
||||||
void *ptr = NULL;
|
void *ptr = NULL;
|
||||||
if(is16bit) ptr = (void*)(((uint16_t*)ima->data) + row * ima->w);
|
if(is16bit) ptr = (void*)(((uint16_t*)ima->data) + row * ima->w);
|
||||||
|
|||||||
@@ -313,17 +313,18 @@ static int startexp(){
|
|||||||
static int camcapt(cc_IMG *ima){
|
static int camcapt(cc_IMG *ima){
|
||||||
TCHECK();
|
TCHECK();
|
||||||
int bitpix = toupcam.bytepix * 8;
|
int bitpix = toupcam.bytepix * 8;
|
||||||
if(!ima || !ima->data || !toupcam.data || !cc_fiximage(bitpix, camera.geometry.w, camera.geometry.h, ima)) return FALSE;
|
int realw = camera.geometry.w / toupcam.curbin, realh = camera.geometry.h / toupcam.curbin;
|
||||||
|
if(!ima || !ima->data || !toupcam.data || !cc_fiximage(bitpix, realw, realh, ima)) return FALSE;
|
||||||
//DBG("LOCK");
|
//DBG("LOCK");
|
||||||
pthread_mutex_lock(&toupcam.mutex);
|
pthread_mutex_lock(&toupcam.mutex);
|
||||||
size_t fullsz = ima->w * ima->h * toupcam.bytepix;
|
size_t fullsz = ima->w * ima->h * toupcam.bytepix;
|
||||||
if(toupcam.imsz != fullsz){
|
if(toupcam.imsz != fullsz){
|
||||||
if(toupcam.imsz < fullsz) fullsz = toupcam.imsz;
|
if(toupcam.imsz < fullsz) fullsz = toupcam.imsz;
|
||||||
int realw = camera.geometry.w / toupcam.curbin;
|
|
||||||
if(ima->w != realw) ima->w = realw;
|
if(ima->w != realw) ima->w = realw;
|
||||||
ima->h = fullsz / realw / toupcam.bytepix;
|
ima->h = fullsz / realw / toupcam.bytepix;
|
||||||
WARNX("Asked image size (%zd) not equal real (%zd); set w=%d, h=%d!",
|
WARNX("Asked image size (%zd) not equal real (%zd); set w=%d, h=%d!",
|
||||||
ima->w * ima->h * toupcam.bytepix, toupcam.imsz, ima->w, ima->h);
|
ima->w * ima->h * toupcam.bytepix, toupcam.imsz, ima->w, ima->h);
|
||||||
|
ima->bytelen = fullsz;
|
||||||
}
|
}
|
||||||
memcpy(ima->data, toupcam.data, fullsz);
|
memcpy(ima->data, toupcam.data, fullsz);
|
||||||
toupcam.lastcapno = toupcam.imseqno;
|
toupcam.lastcapno = toupcam.imseqno;
|
||||||
|
|||||||
Binary file not shown.
@@ -235,7 +235,7 @@ msgstr "
|
|||||||
|
|
||||||
#: main.c:129
|
#: main.c:129
|
||||||
msgid "Can't run in client and server modes simultaneously"
|
msgid "Can't run in client and server modes simultaneously"
|
||||||
msgstr ""
|
msgstr "îÅ ÍÏÇÕ ÏÄÎÏ×ÒÅÍÅÎÎÏ ÚÁÐÕÓÔÉÔØ ËÌÉÅÎÔ É ÓÅÒ×ÅÒ"
|
||||||
|
|
||||||
#: ccdfunc.c:684
|
#: ccdfunc.c:684
|
||||||
#, c-format
|
#, c-format
|
||||||
@@ -499,12 +499,12 @@ msgstr "
|
|||||||
|
|
||||||
#: cmdlnopts.c:123
|
#: cmdlnopts.c:123
|
||||||
msgid "INET command socket port (omit if use on same host with server)"
|
msgid "INET command socket port (omit if use on same host with server)"
|
||||||
msgstr ""
|
msgstr "ÐÏÒÔ ËÏÍÁÎÄÎÏÇÏ ÓÅÔÅ×ÏÇÏ ÓÏËÅÔÁ"
|
||||||
|
|
||||||
#: cmdlnopts.c:124
|
#: cmdlnopts.c:124
|
||||||
#, fuzzy
|
#, fuzzy
|
||||||
msgid "INET image socket port (default: port+1)"
|
msgid "INET image socket port (default: port+1)"
|
||||||
msgstr "ÐÏÒÔ ÌÏËÁÌØÎÏÇÏ ÓÅÔÅ×ÏÇÏ ÓÏËÅÔÁ ÐÅÒÅÄÁÞÉ ÉÚÏÂÒÁÖÅÎÉÑ"
|
msgstr "ÐÏÒÔ ÓÅÔÅ×ÏÇÏ ÓÏËÅÔÁ ÐÅÒÅÄÁÞÉ ÉÚÏÂÒÁÖÅÎÉÑ"
|
||||||
|
|
||||||
#: ccdfunc.c:90
|
#: ccdfunc.c:90
|
||||||
msgid "Image not saved: neither filename nor filename prefix pointed"
|
msgid "Image not saved: neither filename nor filename prefix pointed"
|
||||||
|
|||||||
25
server.c
25
server.c
@@ -440,13 +440,19 @@ static cc_hresult binhandler(_U_ int fd, const char *key, const char *val){
|
|||||||
if(!camera->setbin(GP->hbin, GP->vbin)){
|
if(!camera->setbin(GP->hbin, GP->vbin)){
|
||||||
return CC_RESULT_BADVAL;
|
return CC_RESULT_BADVAL;
|
||||||
}
|
}
|
||||||
|
if(camera->setgeometry){
|
||||||
|
cc_frameformat fmt = camera->geometry; // fix for old ROI
|
||||||
|
if(!camera->setgeometry(&fmt))
|
||||||
|
return CC_RESULT_FAIL;
|
||||||
|
curformat = camera->geometry;
|
||||||
|
}
|
||||||
|
fixima();
|
||||||
}
|
}
|
||||||
if(!camera->getbin) return CC_RESULT_SILENCE;
|
if(!camera->getbin) return CC_RESULT_SILENCE;
|
||||||
int r = camera->getbin(&GP->hbin, &GP->vbin);
|
int r = camera->getbin(&GP->hbin, &GP->vbin);
|
||||||
if(r){
|
if(r){
|
||||||
if(0 == strcmp(key, CC_CMD_HBIN)) snprintf(buf, 63, "%s=%d", key, GP->hbin);
|
if(0 == strcmp(key, CC_CMD_HBIN)) snprintf(buf, 63, "%s=%d", key, GP->hbin);
|
||||||
else snprintf(buf, 63, "%s=%d", key, GP->vbin);
|
else snprintf(buf, 63, "%s=%d", key, GP->vbin);
|
||||||
//if(val) fixima();
|
|
||||||
if(!cc_sendstrmessage(fd, buf)) return CC_RESULT_DISCONNECTED;
|
if(!cc_sendstrmessage(fd, buf)) return CC_RESULT_DISCONNECTED;
|
||||||
return CC_RESULT_SILENCE;
|
return CC_RESULT_SILENCE;
|
||||||
}
|
}
|
||||||
@@ -587,27 +593,34 @@ static cc_hresult formathandler(int fd, const char *key, const char *val){
|
|||||||
char buf[64];
|
char buf[64];
|
||||||
cc_frameformat fmt;
|
cc_frameformat fmt;
|
||||||
DBG("key=%s, val=%s", key, val);
|
DBG("key=%s, val=%s", key, val);
|
||||||
|
int maxx = frmformatmax.xoff+frmformatmax.w - 1, maxy = frmformatmax.yoff+frmformatmax.h - 1;
|
||||||
if(val){
|
if(val){
|
||||||
if(!camera->setgeometry) return CC_RESULT_FAIL;
|
if(!camera->setgeometry) return CC_RESULT_FAIL;
|
||||||
if(0 == strcmp(key, CC_CMD_FRAMEMAX)){
|
if(0 == strcmp(key, CC_CMD_FRAMEMAX)){
|
||||||
DBG("CANT SET MAXFORMAT");
|
DBG("CANT SET MAXFORMAT");
|
||||||
return CC_RESULT_BADKEY; // can't set maxformat
|
return CC_RESULT_FAIL; // can't set maxformat
|
||||||
}
|
}
|
||||||
if(4 != sscanf(val, "%d,%d,%d,%d", &fmt.xoff, &fmt.yoff, &fmt.w, &fmt.h)){
|
if(4 != sscanf(val, "%d,%d,%d,%d", &fmt.xoff, &fmt.yoff, &fmt.w, &fmt.h)){
|
||||||
DBG("Wrong format %s", val);
|
DBG("Wrong format %s", val);
|
||||||
return CC_RESULT_BADVAL;
|
return CC_RESULT_BADVAL;
|
||||||
}
|
}
|
||||||
|
if(fmt.xoff < frmformatmax.xoff) fmt.xoff = frmformatmax.xoff;
|
||||||
|
else if(fmt.xoff >= maxx) fmt.xoff = maxx - 1;
|
||||||
|
if(fmt.yoff < frmformatmax.yoff) fmt.yoff = frmformatmax.yoff;
|
||||||
|
else if(fmt.yoff >= maxy) fmt.yoff = maxy - 1;
|
||||||
fmt.w -= fmt.xoff; fmt.h -= fmt.yoff;
|
fmt.w -= fmt.xoff; fmt.h -= fmt.yoff;
|
||||||
|
if(fmt.w < 1 || fmt.w > frmformatmax.w) fmt.w = maxx - fmt.xoff + 1;
|
||||||
|
if(fmt.h < 1 || fmt.h > frmformatmax.h) fmt.h = maxy - fmt.yoff + 1;
|
||||||
int r = camera->setgeometry(&fmt);
|
int r = camera->setgeometry(&fmt);
|
||||||
if(!r) return CC_RESULT_FAIL;
|
if(!r) return CC_RESULT_FAIL;
|
||||||
curformat = camera->geometry;
|
curformat = camera->geometry;
|
||||||
DBG("curformat: w=%d, h=%d", curformat.w, curformat.h);
|
DBG("curformat: w=%d, h=%d", curformat.w, curformat.h);
|
||||||
//fixima();
|
fixima();
|
||||||
}
|
}
|
||||||
if(0 == strcmp(key, CC_CMD_FRAMEMAX)) snprintf(buf, 63, CC_CMD_FRAMEMAX "=%d,%d,%d,%d",
|
if(0 == strcmp(key, CC_CMD_FRAMEMAX)) snprintf(buf, 63, CC_CMD_FRAMEMAX "=%d,%d,%d,%d",
|
||||||
frmformatmax.xoff, frmformatmax.yoff, frmformatmax.xoff+frmformatmax.w, frmformatmax.yoff+frmformatmax.h);
|
frmformatmax.xoff, frmformatmax.yoff, maxx, maxy);
|
||||||
else snprintf(buf, 63, CC_CMD_FRAMEFORMAT "=%d,%d,%d,%d",
|
else snprintf(buf, 63, CC_CMD_FRAMEFORMAT "=%d,%d,%d,%d",
|
||||||
camera->geometry.xoff, camera->geometry.yoff, camera->geometry.xoff+camera->geometry.w, camera->geometry.yoff+camera->geometry.h);
|
camera->geometry.xoff, camera->geometry.yoff, camera->geometry.xoff+camera->geometry.w-1, camera->geometry.yoff+camera->geometry.h-1);
|
||||||
if(!cc_sendstrmessage(fd, buf)) return CC_RESULT_DISCONNECTED;
|
if(!cc_sendstrmessage(fd, buf)) return CC_RESULT_DISCONNECTED;
|
||||||
return CC_RESULT_SILENCE;
|
return CC_RESULT_SILENCE;
|
||||||
}
|
}
|
||||||
@@ -673,7 +686,7 @@ static cc_hresult _8bithandler(int fd, _U_ const char *key, const char *val){
|
|||||||
int s = atoi(val);
|
int s = atoi(val);
|
||||||
if(s != 0 && s != 1) return CC_RESULT_BADVAL;
|
if(s != 0 && s != 1) return CC_RESULT_BADVAL;
|
||||||
if(!camera->setbitdepth(!s)) return CC_RESULT_FAIL;
|
if(!camera->setbitdepth(!s)) return CC_RESULT_FAIL;
|
||||||
//fixima();
|
fixima();
|
||||||
GP->_8bit = s;
|
GP->_8bit = s;
|
||||||
}
|
}
|
||||||
snprintf(buf, 63, CC_CMD_8BIT "=%d", GP->_8bit);
|
snprintf(buf, 63, CC_CMD_8BIT "=%d", GP->_8bit);
|
||||||
|
|||||||
Reference in New Issue
Block a user