switching into MF (for cameras with native MF) - Script Writing - CHDK Forum

switching into MF (for cameras with native MF)

  • 9 Replies
  • 5121 Views
*

Offline msl

  • *****
  • 1280
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
switching into MF (for cameras with native MF)
« on: 12 / October / 2011, 08:15:00 »
Advertisements
With the command
Code: [Select]
post_levent_to_ui("PressSw1AndMF")I can switch into MF direcly without any key sequence. But this is only true for older cameras, tested with A610, A720 or SX200.

Has anyone experience with newer cameras and this possibility? So far I find no way to switch the SX220 directly to manual focus. I can also prepress/unprepress the left button - no luck. Maybe I need some advanced commands or parameter.

msl
CHDK-DE:  CHDK-DE links

*

Offline msl

  • *****
  • 1280
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
Re: switching into MF (for cameras with native MF)
« Reply #1 on: 21 / October / 2011, 11:30:34 »
Because of forum server move we lost some postings...

Here is the solution by philmoz:
Code: [Select]
post_levent_for_npt("PressSw1AndMF")
This should work on all cameras. Thx philmoz.

msl
CHDK-DE:  CHDK-DE links

*

Offline c10ud

  • ***
  • 245
Re: switching into MF (for cameras with native MF)
« Reply #2 on: 05 / August / 2013, 05:53:26 »
I found another way, with event procs:

call_event_proc("SS.Create")
call_event_proc("SS.MFOn")

and then:
set_focus(yourvalue)

...

call_event_proc("SS.MFOff")

you need native calls enabled and I don't know in how many cameras this is doable (just grep strings for that eventproc) but at least in s110 and g15 this can be used

*

Offline reyalp

  • ******
  • 14079
Re: switching into MF (for cameras with native MF)
« Reply #3 on: 05 / August / 2013, 17:32:33 »
FWIW, I was unable to get
Code: [Select]
post_levent_for_npt("PressSw1AndMF")
to work on D10. It has native manual focus.

The levent does work on my a540.


RegisterShootSeqEvent http://chdk.wikia.com/wiki/User:ReyalP/EventProcNotes#RegisterShootSeqEvent is probably the equivalent to SS.Create on older cameras.

EnterToManualFocus
ExitFromManualFocus

seem likely candidates for the on / off functions. Untested.
Don't forget what the H stands for.


Re: switching into MF (for cameras with native MF)
« Reply #4 on: 06 / August / 2013, 20:58:14 »
I found another way, with event procs:

call_event_proc("SS.Create")
call_event_proc("SS.MFOn")

and then:
set_focus(yourvalue)

...

call_event_proc("SS.MFOff")

you need native calls enabled and I don't know in how many cameras this is doable (just grep strings for that eventproc) but at least in s110 and g15 this can be used
Doesn't work with the G10,  A1200 or SD940.   Darn.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 14079
Re: switching into MF (for cameras with native MF)
« Reply #5 on: 06 / August / 2013, 21:19:14 »
Doesn't work with the G10,  A1200 or SD940.   Darn.
Did you check the return values of the eventproc calls? If it's -1, they might just not exist under that name.
Don't forget what the H stands for.

Re: switching into MF (for cameras with native MF)
« Reply #6 on: 06 / August / 2013, 21:33:47 »
Doesn't work with the G10,  A1200 or SD940.   Darn.
Did you check the return values of the eventproc calls? If it's -1, they might just not exist under that name.
It's  -1  for all three.   I sort of assumed "SS.MFOn" might not exist. Do you think its worth "cave diving" into the strings.txt file for something closer?   Even if that exists for one of the cameras,  it still eludes the goal of a universal way to enable MF.

This works for my three (sx50 is off on a walkabout) - I don't expect that to be universal though :
Code: [Select]
function lock_focus()
   print("setting focus")   
   press("shoot_half")
   local tic=get_tick_count()+3000
   repeat
      sleep(100)
      dof=get_dofinfo()
   until ((dof.focus_valid == true) or (get_tick_count() > tic))
   click("left")
   sleep(500)
   release("shoot_half")
   sleep(100)
   post_levent_for_npt("PressSw1AndMF")
   set_focus(60000)   -- set focus at infinity
   sleep(3000)   
end
« Last Edit: 06 / August / 2013, 21:49:56 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 14079
Re: switching into MF (for cameras with native MF)
« Reply #7 on: 06 / August / 2013, 22:06:35 »
It's  -1  for all three.   I sort of assumed "SS.MFOn" might not exist. Do you think its worth "cave diving" into the strings.txt file for something closer?   Even if that exists for one of the cameras,  it still eludes the goal of a universal way to enable MF.
On D10, these function appear to be called PT_MFOn and PT_MFOff, registered by SS.Create. These seem to work as c10ud described. The MF indicator does not appear, but set_focus takes effect immediately and no AF scan is done on half shoot.

It would be interesting to know if this works on cameras that do not natively have MF. However, to test this with set_focus, you'd probably need to change the camera.h defines to be like camera that does have MF.

We may not have a universal method, but having options to try on different cameras is better than nothing.

These evenprocs probably only exist under a handful of names, and it would be fairly easy to find out which ones use which from the dumps.

edit:
On A540
EnterToManualFocus disables the canon AF scan, but set_focus doesn't seem to work, either immediately or on half press. However, if I force the FOCUS_MODE propcase to 1, it does work immediately.
« Last Edit: 06 / August / 2013, 22:25:03 by reyalp »
Don't forget what the H stands for.


Re: switching into MF (for cameras with native MF)
« Reply #8 on: 06 / August / 2013, 22:09:35 »
We may not have a universal method, but having options to try on different cameras is better than nothing.
Agreed!   I'm taking notes of everything I try or hear about for the eventual wikia page.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: switching into MF (for cameras with native MF)
« Reply #9 on: 06 / August / 2013, 23:26:48 »
Another thought has occurred to me a few times over that last week or two.   My SD940 will take a MF set from a script straight off a power up - no additional tricks to set MF mode first.  Then set_aflock() is all it takes to lock the MF setpoint in.  None of my other cameras - or the other ones I have seen reported here - will do that.

Is it possible that where hooks are planted in capt_seq.c determines how well you can put the camera into MF mode?  Or some other porting variation?


Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics