add darks saving despite of time interval

This commit is contained in:
eddyem 2017-03-23 10:56:05 +03:00
parent c0c7b357ac
commit 695396383d
5 changed files with 5072 additions and 3 deletions

View File

@ -6,7 +6,7 @@ SRCS := $(wildcard *.c)
DEFINES := $(DEF) -D_GNU_SOURCE -D_XOPEN_SOURCE=1111
OBJDIR := mk
CFLAGS += -O2 -Wall -Wextra -Wno-trampolines -std=gnu99
DEFINES += -DEBUG
#DEFINES += -DEBUG
#CFLAGS += -Werror
OBJS := $(addprefix $(OBJDIR)/, $(SRCS:%.c=%.o))
DEPS := $(OBJS:.o=.d)

File diff suppressed because it is too large Load Diff

View File

@ -128,6 +128,22 @@ static void gotodir(char *relpath){ // create directory structure
if(-1 == chdir(relpath)) ERR("chdir()");
}
/**
* check if FITS file is `dark`
* @return 1 if it's dark
*/
int fits_is_dark(char *name){
mmapbuf *buf = My_mmap(name);
if(!buf) return 0;
char *key = memmem(buf->data, buf->len, "IMAGETYP", 8);
if(!key) return 0;
if(buf->len - (key - buf->data) < 30) return 0;
key += 9;
char *dark = memmem(key, 20, "'dark", 5);
if(dark) return 1;
return 0;
}
#define TRYFITS(f, ...) \
do{ int status = 0; \
f(__VA_ARGS__, &status); \
@ -146,7 +162,6 @@ do{ int status = 0; \
fits_write_record(ofptr, record, &status); \
}while(0)
/**
* Try to store given FITS file adding boltwood's header
* @param name (i) - full path to FITS file

View File

@ -28,5 +28,6 @@
int test_fits(char *name);
void store_fits(char *name, datarecord *data);
int fits_is_dark(char *name);
#endif // __IMFUNCTIONS_H__

View File

@ -262,7 +262,8 @@ static void client_(char *FITSpath, int infd, int sock){
DBG("lastT: %.2g, now: %.2g", lastTstorage, dtime());
lastTstorage = dtime();
store_fits(FITSpath, last_good_msrment);
}
}else if(fits_is_dark(FITSpath)) // save darks nevertheless time
store_fits(FITSpath, last_good_msrment);
}
}
}