Are there: PressSw1AndAF and set_focus_mode()? - General Discussion and Assistance - CHDK Forum

Are there: PressSw1AndAF and set_focus_mode()?

  • 7 Replies
  • 2466 Views
*

Offline dvip

  • ****
  • 451
Are there: PressSw1AndAF and set_focus_mode()?
« on: 29 / December / 2012, 23:24:25 »
Advertisements
Are there any PressSw1AndAF or set_focus_mode() for the SX40HS?

Using lua, this will get me into MF mode:

post_levent_for_npt("PressSw1AndMF")

But after that, I need to switch back to AF.

Is there a post_levent_for_npt("PressSw1AndAF")?
or a set_focus_mode()? I know there is a get_focus_mode().


*

Offline reyalp

  • ******
  • 14082
Re: Are there: PressSw1AndAF and set_focus_mode()?
« Reply #1 on: 30 / December / 2012, 00:22:41 »
PressSw1AndAF does appear to be a valid levent on D10
Code: [Select]
con> =return get_levent_def('PressSw1AndAF')
1:return:'PressSw1AndAF'
1:return:2393
1:return:3
I have no idea if it will do what you want. AFAIK there is no CHDK script function to set focus mode, outside of using key presses.
Don't forget what the H stands for.

*

Offline dvip

  • ****
  • 451
Re: Are there: PressSw1AndAF and set_focus_mode()?
« Reply #2 on: 30 / December / 2012, 00:54:25 »
With the SX40HS-100i in AF mode, I ran this:

print("Switch to MF")
post_levent_for_npt("PressSw1AndMF")
sleep(1000)
set_focus(-1) -- infinity
sleep(1000)
shoot()
sleep(1000)
print("Switch to AF")
post_levent_for_npt("PressSw1AndAF")

It goes into MF, takes the shot but then it stays in MF.
So it looks like there is no way out of MF other than key presses :(
 

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: Are there: PressSw1AndAF and set_focus_mode()?
« Reply #3 on: 30 / December / 2012, 01:08:02 »
With the SX40HS-100i in AF mode, I ran this:

print("Switch to MF")
post_levent_for_npt("PressSw1AndMF")
sleep(1000)
set_focus(-1) -- infinity
sleep(1000)
shoot()
sleep(1000)
print("Switch to AF")
post_levent_for_npt("PressSw1AndAF")

It goes into MF, takes the shot but then it stays in MF.
So it looks like there is no way out of MF other than key presses :(
 


Try calling 'post_levent_for_npt("PressSw1AndMF")' a second time to switch back (instead of 'post_levent_for_npt("PressSw1AndAF")').

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)


*

Offline dvip

  • ****
  • 451
Re: Are there: PressSw1AndAF and set_focus_mode()?
« Reply #4 on: 30 / December / 2012, 01:17:52 »
Did this:

print("Switch to MF")
post_levent_for_npt("PressSw1AndMF")
sleep(1000)
set_focus(-1) -- infinity
sleep(1000)
shoot()
sleep(1000)
print("Switch to AF")
sleep(1000)
post_levent_for_npt("PressSw1AndMF")


But still stuck in MF  :( I have seen this before in a lua script but it doesn't seem to work in the SX40HS.

*

Offline reyalp

  • ******
  • 14082
Re: Are there: PressSw1AndAF and set_focus_mode()?
« Reply #5 on: 30 / December / 2012, 01:24:04 »
Per previous discussions, turning the display off and on should clear MF. I'd guess you could do that with click('display') a few times
Don't forget what the H stands for.

*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: Are there: PressSw1AndAF and set_focus_mode()?
« Reply #6 on: 30 / December / 2012, 01:37:10 »
Did this:

print("Switch to MF")
post_levent_for_npt("PressSw1AndMF")
sleep(1000)
set_focus(-1) -- infinity
sleep(1000)
shoot()
sleep(1000)
print("Switch to AF")
sleep(1000)
post_levent_for_npt("PressSw1AndMF")


But still stuck in MF  :( I have seen this before in a lua script but it doesn't seem to work in the SX40HS.


It works on my SX40 - switches to MF, takes the shot then switches back to AF before the script ends.

Edit: - works on the G1X as well.

Phil.
« Last Edit: 30 / December / 2012, 01:40: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)

*

Offline dvip

  • ****
  • 451
Re: Are there: PressSw1AndAF and set_focus_mode()?
« Reply #7 on: 30 / December / 2012, 01:49:58 »
The problem was that the camera was in  image "Review: Hold".  ???
It needs to be in "Review: Off".
Using post_levent_for_npt("PressSw1AndMF")  twice in the script does work.
Thanks guys!

Now need to bypass "Review: Hold" in the lua script.

 
« Last Edit: 30 / December / 2012, 01:52:18 by dvip »


 

Related Topics