PicoC scripting API

Started by a1ex, January 26, 2013, 01:24:01 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jplxpto


engardeknave

I've been waiting for some sort of update to the API. Has anything been added?

I'm especially interested in getting the location of the focus box in LV.

Would it be possible to make a function that "clicks" specific Canon menus?

sfmurph

So I'd like to script the programming of the Optix focus conformation chip I have. I bet folks with the Dandelion chip would also like to. The main things I'd need to do are to check that the camera is in the right mode (M or A, I believe), activate the DOF Preview button and adjust the aperture setting (for Optix) plus set exposure time to 11 seconds (or more) and release the shutter (for Dandelion).

From the API listing, I don't see a way to do the DOF Preview, which would be required for the Optix chips (which I have). There's no "key" for that. My camera doesn't have that key, so I'd need a direct api to activate the DPF preview. The rest do seem available.

Would this be possible?

Here are the Optix programming instructions.
And the Dandelion programming instructions.

Francis

There is work in progress to change the scripting language to TCC for a number of performance issues. It is unlikely that the PicoC API will be updated. Unsure if the DOF button press can be emulated but probably. Sticky DOF seems like it would work like that.

a1ex

You can emulate a DOF press with dofp_set, look in tweaks.c.

To add it to PicoC, look in library_ml.c. Half-shutter and AF_ON are implemented in a similar way.

arossbach

When will PicoC be available to use?

I'd like to get the value from a custom WB with get_kelvin(). Is there another way to do this without PicoC?

a1ex

Grab the ufraw source code and port the RGB_to_Temperature. Don't be afraid of matrix math.

arossbach

I'm not a programmer but can try it :)

I had a first look and imported the code from ufraw to ML. It compiled successfully.
The parameters from WBGain_* have to be converted, but I cannot see any porting issues at the moment.

I have some problems to link the binary on my system (cygwin), so I can't test it and measure the performance.

palark93

cant seem to get this to work right, every time i try it it just takes pics at 1/125
uuuggghhhh >:(

// Custom bracket sequence

console_hide();set_aperture(22);
set_iso(100);
set_shutter(1./2000);
takepic();
set_shutter(1./1000);
takepic();
set_shutter(1./500);
takepic();
set_shutter(1./250);
takepic();
set_shutter(1./125);
takepic();
etc.....

RenatoPhoto

Quote from: palark93 on May 25, 2013, 03:26:07 AM
cant seem to get this to work right, every time i try it it just takes pics at 1/125
uuuggghhhh >:(

// Custom bracket sequence

console_hide();set_aperture(22);
set_iso(100);
set_shutter(1./2000);
takepic();
set_shutter(1./1000);
takepic();
set_shutter(1./500);
takepic();
set_shutter(1./250);
takepic();
set_shutter(1./125);
takepic();
etc.....


Make sure you are not using a compile where the PicoC has been disabled.  All RAW video compiles do not have PicoC enable.  But.. I know nothing else about PicoC
http://www.pululahuahostal.com  |  EF 300 f/4, EF 100-400 L, EF 180 L, EF-S 10-22, Samyang 14mm, Sigma 28mm EX DG, Sigma 8mm 1:3.5 EX DG, EF 50mm 1:1.8 II, EF 1.4X II, Kenko C-AF 2X

sfmurph

So I tried adding PicoC functions so I could "press" the DOF preview on my T3 (that doesn't have a hardware DOF preview). This compiled fine previously, but I've been having other issues with my compiled binaries. I'm on a Mac with the yagarto compiler. It doesn't seem like it's my problem, but it makes it hard to figure out what's going on.

Here's my diff to

$ hg diff library_ml.c
diff -r 7fdfc08ac9ad picoc/library_ml.c
--- a/picoc/library_ml.c   Mon May 27 23:01:29 2013 +0300
+++ b/picoc/library_ml.c   Mon May 27 20:59:19 2013 -0700
@@ -6,6 +6,7 @@
#define UNPRESS -10000 // generic unpress code
#define NO_KEY -1
#define AF_ON 12345
+#define DOF_PREVIEW 23456  // making this up

static char camera_model[32];
static char firmware_version[32];
@@ -139,6 +140,13 @@
         case BGMT_PRESS_FULLSHUTTER:
             SW2(1,50);
             return;
+        case DOF_PREVIEW:
+        {
+            int x = 1;
+            prop_request_change(PROP_DOF_PREVIEW_MAYBE, &x, 2);
+            msleep(50);
+            return;
+        }
         default:
             if (btn >= 0) fake_simple_button(btn);
     }
@@ -200,6 +208,13 @@
             unpress = BGMT_UNPRESS_DOWN;
             break;
         #endif
+        case DOF_PREVIEW:
+        {
+            int x = 0;
+            prop_request_change(PROP_DOF_PREVIEW_MAYBE, &x, 2);
+            msleep(50);
+            return;
+        }
         
         default:
             // this button does not have an unpress code
@@ -1347,6 +1362,7 @@
     CONST0(UNPRESS)
     CONST0(NO_KEY)
     CONST0(AF_ON)
+    CONST0(DOF_PREVIEW)
     CONST0(HALFSHUTTER_PRESSED)

     /** Color codes */

trsaunders

Is there a way to set AF focus at infinity / nearest?

I'm trying to write a script that takes several photos at different AFMA values, to load into Reikan. Before it takes each photo I want to set focus to infinity.
50D, 5D3

marci

Quote from: photo360 on February 26, 2013, 02:55:36 PM
set_flash(0)/set_flash(1)  does not work en 5DMKII with canon speedlite 580 EX. the flash fire each time.
It seems that this function works only for canon with build-in flash.

Is there another solution for 5DMKII ?

Rotate the mode dial to no flash mode! :)

marci

Quote from: Alia5 on March 07, 2013, 02:39:55 PM
Would anyone mind extending beep() to beep(int msecs, int frequency)? ;)

I have added the beep_custom(int duration, int frequency, int wait) function! If wait is 1, it will wait until the beep has ended. If not, the script continues.
It will be in the jun10 nightly :)

pravdomil

A1ex could you please send your script, that generates this API from comments? I would like to make ML modules API.

nitrosito

I have a question... (Sorry for my english, i'm spanish)

¿Any guide or tutorial to write modules/script for ML?

¿How we test the script? Only in the camera?

Thanks and regards