mirror of
https://github.com/eddyem/CCD_Capture.git
synced 2026-03-20 08:40:56 +03:00
add custom plugin commands; start developing 'artifical star' plugin to generate 'vagrant stars'
This commit is contained in:
@@ -43,6 +43,7 @@ static double texpstart = 0.;
|
||||
static uint8_t bitpix = 16; // bit depth: 8 or 16
|
||||
// sinusoide periods
|
||||
static double sinPx = 100., sinPy = 200.;
|
||||
static const double sinmin = 1.;
|
||||
|
||||
static int campoll(cc_capture_status *st, float *remain){
|
||||
if(capstat != CAPTURE_PROCESS){
|
||||
@@ -256,35 +257,27 @@ static int whlgetnam(char *n, int l){
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static const char* const helpmsg =
|
||||
"Dummy camera custom plugin commands:\n"
|
||||
"\tpx - set/get sin period over X axis (pix)\n"
|
||||
"\tpy - -//- over Y axis\n"
|
||||
;
|
||||
static const char* const pmust = "Period must be not less than 1";
|
||||
static const char *plugincmd(const char *str){
|
||||
static char ans[BUFSIZ+1];
|
||||
snprintf(ans, BUFSIZ, "%s", str);
|
||||
char *val = cc_get_keyval(ans);
|
||||
if(val){ // setters
|
||||
if(0 == strcmp("px", ans)){
|
||||
double f = atof(val);
|
||||
if(f < 1.) return pmust;
|
||||
sinPx = f;
|
||||
}else if(0 == strcmp("py", ans)){
|
||||
double f = atof(val);
|
||||
if(f < 1.) return pmust;
|
||||
sinPy = f;
|
||||
}
|
||||
} // getters/return
|
||||
if(0 == strcmp("px", ans)){
|
||||
snprintf(ans, BUFSIZ, "px=%g", sinPx);
|
||||
return (const char*) ans;
|
||||
}else if(0 == strcmp("py", ans)){
|
||||
snprintf(ans, BUFSIZ, "yx=%g", sinPy);
|
||||
return (const char*) ans;
|
||||
}
|
||||
return helpmsg;
|
||||
/*
|
||||
static int checker(const char *str, cc_charbuff *ans){
|
||||
char *eq = strchr(str, '=');
|
||||
if(eq){
|
||||
float x = (float)atof(eq+1);
|
||||
if(x < 1.){if(ans) cc_charbufaddline(ans, "Value must be >= 1.");}
|
||||
else return TRUE;
|
||||
}else return TRUE; // getter
|
||||
return FALSE;
|
||||
}*/
|
||||
|
||||
|
||||
// cmd, help, handler, ptr, type
|
||||
static cc_parhandler_t handlers[] = {
|
||||
{"px", "set/get sin period over X axis (pix)", NULL, (void*)&sinPx, (void*)&sinmin, NULL, CC_PAR_DOUBLE},
|
||||
{"py", "set/get sin period over Y axis (pix)", NULL, (void*)&sinPy, (void*)&sinmin, NULL, CC_PAR_DOUBLE},
|
||||
CC_PARHANDLER_END
|
||||
};
|
||||
|
||||
static cc_hresult plugincmd(const char *str, cc_charbuff *buf){
|
||||
return cc_plugin_customcmd(str, handlers, buf);
|
||||
}
|
||||
|
||||
static int stub(){
|
||||
|
||||
Reference in New Issue
Block a user