Canon A560 - click "shoot_full" doesn't always work? - Script Writing - CHDK Forum

Canon A560 - click "shoot_full" doesn't always work?

  • 7 Replies
  • 5414 Views
Canon A560 - click "shoot_full" doesn't always work?
« on: 08 / June / 2013, 04:23:02 »
Advertisements
Hi,

I've tested and retested my script, for some reason it seems to work sometimes but not others and I can't seem to track down whats changing to make it not work?

I'm wondering whether there are any known issues/bugs/gotchas with the click "shoot_full" command that I don't know about? The print output in my script suggests that the code is cycling through the subroutine ok (the 'shoottimelapse' sub in the code below), but for some reason it seems to be skipping the "shoot_full" part and not actually taking a photo?

I've included the code below (apologies for the length), it's a simple time-lapse script that alternates between shooting video (once I get the photos working) and taking photographs at set intervals.

I've been going round in circles on this for a while, any help would be much appreciated!

Thanks,

Adam

Code: [Select]
rem Author: e3SpaceProgram
rem Revised: 07 Jun 2013
rem License: GPL
rem Twitter: @e3SpaceProgram
rem Web: [url=http://www.e3spaceprogram.com]www.e3spaceprogram.com[/url]
rem Version: 0.03

rem Description: Alternates between time-lapse photos and video

@title e3_UpCameraScript

@param b Photos first? (boolean)
@default b 1

@param i Target photo interval (sec)
@default i 15

@param v Video Length (mins)
@default v 90

@param p Timelapse length (mins)
@default p 90

@param f Focus (mm)
@default f 65535

@param z Zoom (value)
@default z 0

@param s Shutter speed (APEX)
@default s 640

@param x Minimum Sv96
@default x 371

@param y Maximum Sv96
@default y 795

rem Main Script   
    print "Starting script..."

    rem Set up the camera for action

    click "shoot_half"
    gosub "setconstants"   
    gosub "iso"
    gosub "zoom"
    gosub "focus"
    gosub "shutter"
    gosub "turnflashoff"
    gosub "whitebalance"

    while b = 1
        gosub "shoottimelapse"
        gosub "recordvideo"
    wend

    while b = 0
        gosub "recordvideo"
        gosub "shoottimelapse"
    wend

:setconstants
    print "Setting constants..."
   
    C=1   
    if b<0 then b=0
    if b>1 then b=1
    if i<0 then i=0
    if v<0 then v=0
    if z<0 then z=0
    if z>8 then z=8
    if f<0 then f=0
    if f>65535 then f=65535
    print "Constants set."
    return
 
:shoottimelapse 

    T = get_tick_count

    while (get_tick_count - T)<(p*60*1000)
        c = get_tick_count
        if get_jpg_count < 1 then goto "full"
        print "Time-lapse shot", C
        gosub "shootbracketedshot"
        sleep (i *1000) - (get_tick_count - c)
        C=C+1
    wend

    return

:shootbracketedshot
    click "shoot_full"
    print "shot taken"
    return

:recordvideo
    print "Starting video recording..."
    T = get_tick_count
    while (get_tick_count - T)<(v*60*1000)
        sleep 10000
        print "video sleep"
    wend
    return

:iso
    print "Set iso to auto"
    set_iso 0
    print "Iso set"
    return

:zoom
    print "Set zoom to user value", z
    set_zoom z
    sleep 2000
    print "Zoom set"
    return

:shutter
    print "Set shutter speed", s
    set_tv96_direct s
    print "Shutter set"
    return

:focus
    print "Set focus", f
    set_focus f
    set_aflock 1
    sleep 2000
    print "Focus set"
    return

:turnflashoff
    print "Flash deactivated"
    F = get_flash_mode
    set_prop 16 2
    print "Flash off"
    return

:whitebalance
    print "Whitebalance fixed"
    return

:full
    cls
    print "Memory card Full"
    end


Re: Canon A560 - click "shoot_full" doesn't always work?
« Reply #1 on: 08 / June / 2013, 09:49:35 »
Looking briefly at your script,  a couple of things come to mind.   Using  click "shoot_full" the way you are is exactly equivalent to pointing your camera at something and very quickly fully pressing and releasing the shutter button.  If you try that you will find that it sometimes does not give the camera time to focus and set exposure, so no shot is taken.

To fix this when shooting normally,  you need to "half press" the shutter button,  wait for the camera to beep (or otherwise indicate) that it is ready, and only then do you "full press" the shutter button.

Therefore,  you need to do the same thing in your code.  The  shoot function will do this for you.  Or you can use something like this  :

Code: [Select]
  press "shoot_half"
  do
    sleep 50
  until get_shooting = 1
  click "shoot_full"
  sleep 500
  release "shoot_half"

or maybe even (not recommended)
Code: [Select]
  press "shoot_full"
  sleep 2000
  release "shoot_full"

Ported :   A1200    SD940   G10    Powershot N    G16

Re: Canon A560 - click "shoot_full" doesn't always work?
« Reply #2 on: 08 / June / 2013, 13:39:03 »
Thanks a lot for the reply!

The idea of the script is that it pre-sets the zoom, focus, shutter speed, iso etc to preset levels, and uses the 'click_full' approach so that all the camera does is take the photo, rather than trying to focus first etc (in which case as you say, I could use the 'shoot' function').

Have I misunderstood the 'click_full' approach? Will it not take the shot if the camera isn't in a 'certain state' (e.g. if the camera isn't focused)

Thanks again,

Adam

Re: Canon A560 - click "shoot_full" doesn't always work?
« Reply #3 on: 08 / June / 2013, 14:36:03 »
Yes, as waterwingz pointed sometimes it doesn't. All that this function do is to emulate very short press and immediately release of the shutter button. You can try to do this a few times with camera manually. Sometimes it'll not shoot.

This is simply a result of the way the Canon firmware works.

If you want to be sure you'll shoot, then use shoot() function instead:)

Remember - all you do with press/click/release commands is exactly the same as pressing them physically.
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick

Re: Canon A560 - click "shoot_full" doesn't always work?
« Reply #4 on: 08 / June / 2013, 14:54:14 »
The idea of the script is that it pre-sets the zoom, focus, shutter speed, iso etc to preset levels, and uses the 'click_full' approach so that all the camera does is take the photo, rather than trying to focus first etc (in which case as you say, I could use the 'shoot' function').
For the functions you are trying to lock in your script,  the shoot command will work and do what you want.
If you also want to lock exposure,  take a look at the small hdr.bas script included with CHDK to see how to do that.

Quote
Have I misunderstood the 'click_full' approach?
I think that's the problem.  The "click" command is intended for simple button pushes on the back of the camera - not to activate the shutter.  Of course, it will also activate the shutter - just not reliably.

Quote
Will it not take the shot if the camera isn't in a 'certain state' (e.g. if the camera isn't focused)
It all comes down to timing. If you want to do the script your way,  change the click "shoot_full" to the second method I posted above (  press / sleep / release ).

Ported :   A1200    SD940   G10    Powershot N    G16

Re: Canon A560 - click "shoot_full" doesn't always work?
« Reply #5 on: 08 / June / 2013, 14:58:59 »
Thanks for the replies guys, I'll revisit my script using what you've given me and come back if I still can't get it going.

Thanks again!

Adam

*

Offline reyalp

  • ******
  • 14126
Re: Canon A560 - click "shoot_full" doesn't always work?
« Reply #6 on: 08 / June / 2013, 15:38:26 »
The idea of the script is that it pre-sets the zoom, focus, shutter speed, iso etc to preset levels, and uses the 'click_full' approach so that all the camera does is take the photo, rather than trying to focus first etc (in which case as you say, I could use the 'shoot' function').
Note that this approach cannot work with shoot_full, because shoot_full implicitly presses and releases shoot_half. That means only your first shot will be done with the "set up" settings, and the others will be done as if you just mashed the shutter button really fast without allowing time for the camera to do it's normal half shoot stuff.

To click shoot_full and return to half press, you should use shoot_full_only.

The issues described by waterwingz and outslider may also apply...
Don't forget what the H stands for.

Re: Canon A560 - click "shoot_full" doesn't always work?
« Reply #7 on: 08 / June / 2013, 15:48:43 »
To click shoot_full and return to half press, you should use shoot_full_only.
This will then also require changing the code to use   press "shoot_half"    rather than   click "shoot_half" at the start of the script.
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics


SimplePortal © 2008-2014, SimplePortal