Setting focus from scripts or menus - page 30 - General Discussion and Assistance - CHDK Forum

Setting focus from scripts or menus

  • 601 Replies
  • 190857 Views
*

Offline reyalp

  • ******
  • 14080
Re: Setting focus from scripts or menus
« Reply #290 on: 02 / March / 2014, 19:24:25 »
Advertisements
I played with sd override and shortcuts a bit on elph140 with patch15. It seems to work as expected, if set_mf(1) has been called or aflock is active, overrides appear to work. No crashes.

mf3_test.lua ran, as expect set_focus only failed, af_lock and mf worked.

A note on af lock behavior: If you use the canon UI to set af lock, it appears to be cleared if you change the zoom. set_aflock() and set_mf do not appear to be cleared.
Don't forget what the H stands for.

Re: Setting focus from scripts or menus : patch 19
« Reply #291 on: 02 / March / 2014, 19:53:32 »
Last version for now.  :-X

Changes from previous are :
  • set_aelock() set_aflock() set_mf() are locked out in playback/review mode
  • set_focus()  returns status in both uBASIC and Lua indicating if the focus attempt should have worked
  • camera_can_focus() now returns false (0) is camera is in playback mode
  • reyalp's  set_now Lua change from earlier added to uBASIC as well

Compiles correctly on the entire trunk.  Tested on my A1200 and G10.  Short uBASIC test script attached for refernce.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 14080
Re: Setting focus from scripts or menus
« Reply #292 on: 02 / March / 2014, 20:45:42 »
Cosmetic fix for mf3_test.lua

Don't warn that continuous af or servo af are enabled when when the propcases aren't defined (propset 1)
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 14080
Re: Setting focus from scripts or menus
« Reply #293 on: 02 / March / 2014, 20:58:33 »
Something worth checking (NOT required for initial trunk patch) is whether set_mf() and/or set_aflock() implicitly disable continuous and servo AF.

If so, adjusting the shooting_can_focus checks accordingly might avoid a lot of "why doesn't sd override work" issues.

edit:
Checked v19 on my cameras with both scripts, seems OK.
« Last Edit: 02 / March / 2014, 21:39:39 by reyalp »
Don't forget what the H stands for.


Re: Setting focus from scripts or menus
« Reply #294 on: 02 / March / 2014, 21:41:19 »
Cosmetic fix for mf3_test.lua  Don't warn that continuous af or servo af are enabled when when the propcases aren't defined (propset 1)
Thanks for that.   When we get down to cosmetic changes it feels pretty good compared to the "mess" with which we started!

Something worth checking (NOT required for initial trunk patch) is whether set_mf() and/or set_aflock() implicitly disable continuous and servo AF.  If so, adjusting the shooting_can_focus checks accordingly might avoid a lot of "why doesn't sd override work" issues.
How would we test that - use  set_mf() and/or set_aflock() and check whether the propcases changes?  Or are you assuming they disable the functions but the propcases don't reflect that change?   I think there was an earlier discussion about not disabling set_focus() when they are active ... should we go back to that?

I did give some thought to having shooting_can_focus() actually return a negative status code based on why it "fails".  We could still do that I think?

Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 14080
Re: Setting focus from scripts or menus
« Reply #295 on: 02 / March / 2014, 22:03:05 »
How would we test that - use  set_mf() and/or set_aflock() and check whether the propcases changes?
On my D10, using set_aflock or set_mf does not clear the servo AF propcase. Using Canon MF does. Canon AF lock is not available when servo AF is active.
Quote
Or are you assuming they disable the functions but the propcases don't reflect that change?
That's my thought, if the camera thinks it's in MF mode or AF lock, then the continuous or servo may well be locked out, even though the propcase isn't updated.

A quick test on D10 appears to confirm this for servo, D10 doesn't have continuous.
Quote
  I think there was an earlier discussion about not disabling set_focus() when they are active ... should we go back to that?
If it works, that seems better to me. But again, we don't have to do this right now, just another possible improvement.

Quote
I did give some thought to having shooting_can_focus() actually return a negative status code based on why it "fails".  We could still do that I think?
I'm not sure this is worthwhile, it seems like it could add a lot of complexity to calling code that tried to use it.
If we want script to be able to figure out what needs to be done for SD override to work, I'd suggest exposing the CAN_SD_OVER_IN_* values somehow.
Don't forget what the H stands for.

Re: Setting focus from scripts or menus
« Reply #296 on: 02 / March / 2014, 22:30:42 »
I'm not sure this is worthwhile, it seems like it could add a lot of complexity to calling code that tried to use it.
If we want script to be able to figure out what needs to be done for SD override to work, I'd suggest exposing the CAN_SD_OVER_IN_* values somehow.
I've been (somewhat obviously) thinking about how this all plays out in scripts as we have worked through it.  Trying to allow any camera to set_focus() in my scripts has been a challenge and a source of frustration.

The way things are going now,  the  set_mf() command should work for over 95% of cameras.  If it fails and a script checks status, the script can try set_aflock(), which will get most of the rest.  And if the script just continues after trying set_mf() followed by set_aflock(), there are several cams that will set_focus() even if both those failed.  That just leaves a couple of really old camera that will not work.   I think I can live with that.

Philosophically,  set_aflock() is different than set_mf() .. at least I think it is.   But if it works in a script either way .. then I'm good with it.
 
« Last Edit: 02 / March / 2014, 22:32:41 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline srsa_4c

  • ******
  • 4451
Re: Setting focus from scripts or menus
« Reply #297 on: 03 / March / 2014, 15:50:00 »
v15 + its mf3_test.lua succeeds on the ixus870_sd880 without crashing it, the af lock test successfully adjusts the focus.


*

Offline AK

  • *
  • 10
  • Canon A2400 IS
Re: Setting focus from scripts or menus
« Reply #298 on: 04 / March / 2014, 00:41:25 »
Posting the test result for MF_test.lua v2.12 script on A2400

Re: Setting focus from scripts or menus
« Reply #299 on: 04 / March / 2014, 10:02:17 »
I have added #define CAM_SD_OVER_IN_AFL 1, thus my results.
Missed that - sorry.  It makes sense now.  Did you do that for a specific reason or just to test the changes?
Further to this - is you use set_focus() first and then set_aflock() to "hold" the value over subsequent shots, does it crash?
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics