mirror of
https://github.com/eddyem/boltwood.git
synced 2025-12-06 10:35:11 +03:00
add darks saving despite of time interval
This commit is contained in:
parent
c0c7b357ac
commit
695396383d
@ -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)
|
||||
|
||||
5052
allsky_logger/allsky_logger.c.tags
Normal file
5052
allsky_logger/allsky_logger.c.tags
Normal file
File diff suppressed because it is too large
Load Diff
@ -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
|
||||
|
||||
@ -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__
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user