set_aelock() - for video modes only ? - General Discussion and Assistance - CHDK Forum

set_aelock() - for video modes only ?

  • 26 Replies
  • 14715 Views
set_aelock() - for video modes only ?
« on: 18 / June / 2014, 23:15:31 »
Advertisements
Late last year (2013) there was a flurry of excitment about Video Manual Control: ISO, APERTURE & SHUTTER SPEED CONTROL, PLEASE!!!! where a script that worked for most camera was developed.  The set_aelock( ) function was added to the scripting engines to allow locking out Canon automatic exposure control so that manual exposure overrides could be used (with requiring the code to call event_procs).

However,  AFAIK there was no testing to see if this new function worked for regular shooting rather than video.  So I put a little script together tonight to do some testing :

Code: [Select]
--[[
@title set_aelock
]]--
print("shot 1")
shoot()
print("set_aelock(1)")
set_aelock(1)
print("shot 2")
shoot()          -- script "hangs" here
print("set_aelock(0)")
set_aelock(0)
print("shot3")
shoot()
print("done")
and found that a shoot() command hangs immediately after shooting if a set_aelock(1) has been made prior to shooting.

Unless I'm missing something here,  the documentation for this function probably needs to indicate that it's only for video modes  ?
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: set_aelock() - for video modes only ?
« Reply #1 on: 19 / June / 2014, 00:01:15 »
Late last year (2013) there was a flurry of excitment about Video Manual Control: ISO, APERTURE & SHUTTER SPEED CONTROL, PLEASE!!!! where a script that worked for most camera was developed.  The set_aelock( ) function was added to the scripting engines to allow locking out Canon automatic exposure control so that manual exposure overrides could be used (with requiring the code to call event_procs).

However,  AFAIK there was no testing to see if this new function worked for regular shooting rather than video.  So I put a little script together tonight to do some testing :

Code: [Select]
--[[
@title set_aelock
]]--
print("shot 1")
shoot()
print("set_aelock(1)")
set_aelock(1)
print("shot 2")
shoot()          -- script "hangs" here
print("set_aelock(0)")
set_aelock(0)
print("shot3")
shoot()
print("done")
and found that a shoot() command hangs immediately after shooting if a set_aelock(1) has been made prior to shooting.

Unless I'm missing something here,  the documentation for this function probably needs to indicate that it's only for video modes  ?

Does it need a shutter half-press first (possibly with a delay) so the camera has calculated an exposure to lock?

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

Re: set_aelock() - for video modes only ?
« Reply #2 on: 19 / June / 2014, 07:33:17 »
Does it need a shutter half-press first (possibly with a delay) so the camera has calculated an exposure to lock?
That's why I had it shoot prior to set_aelock(1).  But I recoded as below just to check - still hangs when it gets to the shoot() function.

Code: [Select]
--[[
@title set_aelock
]]--
    if ( get_mode() == false ) then
        set_record(1)
        while ( get_mode() == false ) do sleep(100) end
    end
    print("half shoot")
    count = 1
    timeout = false
    press("shoot_half")                 
    repeat 
        sleep(50)
        count = count + 1
        if (count > 40 ) then
            timeout = true
            print("timeout")
        end       
    until (get_shooting() == true ) or (timeout == true)
    release("shoot_half")
    repeat sleep(50)  until get_shooting() == false   
    print("set_aelock(1)")
    set_aelock(1)
    print("shoot")
    shoot()
    print("set_aelock(0)")
    set_aelock(0)
    print("done")

Moving the set_aelock(1) to just before the shoot_half is released causes the script to hang when set_aelock() is called.
« Last Edit: 19 / June / 2014, 07:35:13 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: set_aelock() - for video modes only ?
« Reply #3 on: 19 / June / 2014, 07:53:18 »
I did some investigation on this, and I don't think there is a simple solution.

Calling set_aelock(1) causes shooting_in_progress() to always return 1, so the shoot() command never finishes.

You can cause the same behaviour by using the Canon UI to set AEL, then running a script that only includes a 'shoot' command.

So, to me, this means that the PROPCASE_SHOOTING value we have always assumed means that the camera is in the process of taking a picture, is actually telling us that the camera has calculated (and locked) the exposure for the shot.

Without AEL the exposure is automatically unlocked when the shot has been take.

Once you use AEL (Canon or CHDK), this property is set, and we now have no way to tell if the shot has completed.
Until we can find some other method of determining when the shot has finished, the set_aelock is probably not safe to use for still images.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

Re: set_aelock() - for video modes only ?
« Reply #4 on: 19 / June / 2014, 08:22:14 »
find some other method of determining when the shot has finished, the set_aelock is probably not safe to use for still images.
I think that's okay as long as the documentation explains it that way.  I'll update the scripting reference on the wiki.

In the meantime,  a half-shoot followed by get_Xv96() calls can be used to store the exposure setting and then used via set_Xv96() calls prior to each subsequent  shot. 

I need to think a bit about how not to get tricked by the ND filter on cameras that do not have a user adjustable aperture.  The Canon firmware will insert that ND filter under bright light situations so any set_aelock replacement code needs to take that into account.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: set_aelock() - for video modes only ?
« Reply #5 on: 19 / June / 2014, 08:37:32 »
On the G12 (propset 4), property 303 appears to work as expected for PROPCASE_SHOOTING.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

Re: set_aelock() - for video modes only ?
« Reply #6 on: 19 / June / 2014, 13:19:35 »
On the G12 (propset 4), property 303 appears to work as expected for PROPCASE_SHOOTING.
So the question becomes whether it's worth trying to find the equivalent for the other five propsets and then testing that it works for at least several cameras in each set?   

Other than set_aelock(), would there be other advantages here ? 

IIRC, something that tells us the shot is complete including saving to the SD card has been a desire for awhile (for example).
Ported :   A1200    SD940   G10    Powershot N    G16

Re: set_aelock() - for video modes only ?
« Reply #7 on: 19 / June / 2014, 14:39:37 »
Update :  if you don't use shoot() then set_aelock() can still be handy if you use press("shoot_full") instead.

The following works properly with exposure locked between shots :

Code: [Select]
--[[
@title set_aelock
]]--
    if ( get_mode() == false ) then
        set_record(1)
        while ( get_mode() == false ) do sleep(100) end
    end
    print("half shoot")
    count = 1
    timeout = false
    press("shoot_half")                 
    repeat 
        sleep(50)
        count = count + 1
        if (count > 40 ) then
            timeout = true
            print("timeout")
        end       
    until (get_shooting() == true ) or (timeout == true)
    print("set_aelock(1)")
    set_aelock(1)
    release("shoot_half")
   print("shoot three")
   for i=1,3,1 do
       press("shoot_full")
       sleep(1000)
       release("shoot_full")
       sleep(2000)
   end
   print("set_aelock(0)")
   set_aelock(0)
   print("done")
One thing still confuses me a bit though.  I thought get_shooting() returned true when both exposure and focus were locked.  Need to experiment to see what happens to the focus in the script I just posted (assuming I don't add a set_aflock(1) as well).

Update :  press("shoot_full") /  sleep(1000) / release("shoot_full") will attempt to focus when ae_lock() is active.  I guess a script would want to check PROPCASE_FOCUS_STATE ( or get_focus_ok() ) in that case prior to going from shoot_half to shoot_full.  Or use set_aflock() as well  ;)
« Last Edit: 19 / June / 2014, 15:00:23 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: set_aelock() - for video modes only ?
« Reply #8 on: 19 / June / 2014, 15:55:38 »
On the G12 (propset 4), property 303 appears to work as expected for PROPCASE_SHOOTING.
So the question becomes whether it's worth trying to find the equivalent for the other five propsets and then testing that it works for at least several cameras in each set?   

It might take some time; but I think it's worth doing. Once I'm satisfied that it works for propset 4 on my cameras I'll check in the change (need to test in other modes, etc).

One thing still confuses me a bit though.  I thought get_shooting() returned true when both exposure and focus were locked.  Need to experiment to see what happens to the focus in the script I just posted (assuming I don't add a set_aflock(1) as well).

We are also using the incorrect property to determine if focusing is finished (shooting_get_focus_ok); so set_aelock might also cause problems for scripts that try and do focussing.

Both properties 210 (current PROPCASE_SHOOTING) and 303 stay at 0 until the camera has attempted to focus (on the G12). They go to 1 after focussing, even if good focus is not achieved.

There is another property on the G12 (352) which goes to 1 as soon as the shutter is half pressed, then goes to 2 once focussing is finished (returns to 0 when the shot is taken or shutter released).

Phil.
« Last Edit: 19 / June / 2014, 16:33:01 by philmoz »
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

Re: set_aelock() - for video modes only ?
« Reply #9 on: 19 / June / 2014, 16:53:02 »
It might take some time; but I think it's worth doing. Once I'm satisfied that it works for propset 4 on my cameras I'll check in the change (need to test in other modes, etc).
The challenge could then be deciding what to do if propset1 & propset2 don't have the same functionality.
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics


SimplePortal © 2008-2014, SimplePortal