aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Bogart <bbogart@users.sourceforge.net>2009-03-30 17:50:52 +0000
committerB. Bogart <bbogart@users.sourceforge.net>2009-03-30 17:50:52 +0000
commitfc8d6a53df91b9b8439a2808b5f089335d6d6a4c (patch)
treedbc8b5ded1dcb0216b270198d756543c69f9a68e
parentac294f862525f3d573b9de6a98ae249454e8b716 (diff)
Added captureimages selector which allows the long-term reexecution of
image capture and file-transfer commands. Tested over 6,000 iterations with a 2 second sleep time. svn path=/trunk/externals/bbogart/; revision=10928
-rw-r--r--gphoto/README.txt4
-rw-r--r--gphoto/gphoto-help.pd98
-rw-r--r--gphoto/gphoto.c14
3 files changed, 64 insertions, 52 deletions
diff --git a/gphoto/README.txt b/gphoto/README.txt
index f3628d3..2b95771 100644
--- a/gphoto/README.txt
+++ b/gphoto/README.txt
@@ -26,6 +26,6 @@ USAGE:
Put the binary in your extra folder.
Put the helpfile in your 5.reference folder.
-TODO:
-* Add a getConfigDetail function to get the range, step, etc info on each config name.
+TODO:
+* Add a function to wrap gp_error results, and set busy to 0.
* Add getFile and getFiles functions for PTP file transfer functionality.
diff --git a/gphoto/gphoto-help.pd b/gphoto/gphoto-help.pd
index 5772ff6..17a5588 100644
--- a/gphoto/gphoto-help.pd
+++ b/gphoto/gphoto-help.pd
@@ -1,47 +1,55 @@
#N canvas 577 0 638 746 10;
-#X msg 83 48 getconfig model;
-#X msg 142 83 getconfig capture;
-#X msg 167 116 getconfig zoom;
-#X obj 79 221 print;
-#X msg 59 21 listconfig;
-#X msg 209 183 setconfig capture 1;
-#X msg 205 218 setconfig capture 2;
-#X text 336 182 cap on?;
-#X text 334 217 cap off?;
-#X msg 196 254 setconfig zoom 129;
-#X msg 177 277 setconfig zoom 0;
-#X obj 133 231 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
+#X obj 66 606 print;
+#X msg 66 132 listconfig;
+#X msg 127 350 setconfig capture 1;
+#X msg 109 276 setconfig zoom 129;
+#X obj 107 606 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
-#X msg 266 33 capture test2.jpg;
-#X msg 174 327 configdetail iso;
-#X msg 150 354 configdetail zoom;
-#X msg 150 384 configdetail capture;
-#X obj 86 191 gphoto;
-#X msg 280 113 getconfig iso;
-#X msg 18 158 reset;
-#X msg 208 154 setconfig iso \$1;
-#X symbolatom 320 153 10 0 0 0 - - -;
-#X msg 135 473 captureimages stop;
-#X msg 45 508 captureimages /store/stills/image-%d;
-#X msg 135 453 captureimages /store/stills/image-%05d.jpg 2;
-#X connect 0 0 16 0;
-#X connect 1 0 16 0;
-#X connect 2 0 16 0;
-#X connect 4 0 16 0;
-#X connect 5 0 16 0;
-#X connect 6 0 16 0;
-#X connect 9 0 16 0;
-#X connect 10 0 16 0;
-#X connect 12 0 16 0;
-#X connect 13 0 16 0;
-#X connect 14 0 16 0;
-#X connect 15 0 16 0;
-#X connect 16 0 3 0;
-#X connect 16 1 11 0;
-#X connect 17 0 16 0;
-#X connect 18 0 16 0;
-#X connect 19 0 16 0;
-#X connect 20 0 19 0;
-#X connect 21 0 16 0;
-#X connect 22 0 16 0;
-#X connect 23 0 16 0;
+#X obj 66 583 gphoto;
+#X msg 139 536 reset;
+#X msg 156 440 captureimages stop;
+#X text 20 18 This object interfaces with gphoto2 supported PTP cameras.
+;
+#X text 20 38 This object is intended for remote capture control. For
+a list of supported cameras see: http://www.gphoto.org/doc/remote;
+#X text 129 606 Finished command.;
+#X msg 163 475 captureimages image.jpg 2;
+#X msg 141 384 captureimage image.jpg;
+#X text 64 107 Camera Properties;
+#X msg 80 197 configdetail \$1;
+#X symbolatom 80 179 10 0 0 0 - - -;
+#X text 185 244 Get value of a particular camera property \, ie "model"
+;
+#X msg 96 244 getconfig \$1;
+#X symbolatom 96 226 10 0 0 0 - - -;
+#X text 239 276 Set value of a particular camera property \, ie "zoom"
+;
+#X text 127 329 Remote Capture;
+#X text 258 350 On Canon Cameras capture must be set first.;
+#X text 288 384 Capture a single image.;
+#X msg 156 420 captureimages image-%05d.jpg 2;
+#X text 354 420 Capture image every 2 seconds;
+#X text 284 440 Stop capturing images.;
+#X text 328 475 Overwrite single file every 2 seconds.;
+#X text 189 536 reset internal state (only use if you know what your
+doing \, ie camera battery dies or is dissconnected and the internal
+state no longer matches the camera state.);
+#X text 184 196 Get detailed info on a particular camera property.
+It must be in the list returned by listconfig \, ie "zoom".;
+#X text 142 125 List camera properties (arguments to get/set config).
+"capture" property must be set to list capture properties \, ie zoom.
+;
+#X connect 1 0 5 0;
+#X connect 2 0 5 0;
+#X connect 3 0 5 0;
+#X connect 5 0 0 0;
+#X connect 5 1 4 0;
+#X connect 6 0 5 0;
+#X connect 7 0 5 0;
+#X connect 11 0 5 0;
+#X connect 12 0 5 0;
+#X connect 14 0 5 0;
+#X connect 15 0 14 0;
+#X connect 17 0 5 0;
+#X connect 18 0 17 0;
+#X connect 23 0 5 0;
diff --git a/gphoto/gphoto.c b/gphoto/gphoto.c
index 407c761..6b7404d 100644
--- a/gphoto/gphoto.c
+++ b/gphoto/gphoto.c
@@ -644,9 +644,15 @@ void *captureImages(void *threadArgs) {
sys_lock();
format = atom_getsymbol( ((gphoto_gimme_struct *)threadArgs)->argv ); // destination filename
sleepTime = atom_getint ( ((gphoto_gimme_struct *)threadArgs)->argv+1 ); // loop sleep delay
- post("format: %s", format->s_name);
- post("sleeptime: %d", sleepTime);
- sys_unlock();
+ sys_unlock();
+
+ // we don't want a delay of 0! (1 ok?)
+ if (sleepTime <=0) {
+ sleepTime = 1;
+ sys_lock();
+ error("gphoto: ERROR: The minimum sleep value is 1 second. Sleep set to 1 second.")
+ sys_unlock();
+ }
gp_ret = gp_camera_new (&camera);
if (gp_ret != 0) {sys_lock(); error("gphoto: ERROR: %s\n", gp_result_as_string(gp_ret)); sys_unlock(); gp_camera_unref(camera); return(NULL);}
@@ -713,7 +719,6 @@ static void wrapCaptureImages(gphoto_struct *gphoto, t_symbol *s, int argc, t_at
gphoto->capturing = 0; // Stop Capturing.
gphoto->busy = 0; // No longer busy
- post("cap stop");
} else if (!gphoto->busy) {
@@ -721,7 +726,6 @@ static void wrapCaptureImages(gphoto_struct *gphoto, t_symbol *s, int argc, t_at
error("gphoto: ERROR: usage: captureimages [filename-format] [sleeptime (seconds)]");
} else {
- post("cap start");
gphoto->capturing = 1; // Now capturing.
// instance of structure