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

Setting focus from scripts or menus

  • 601 Replies
  • 214337 Views
Re: Setting focus from scripts or menus
« Reply #280 on: 02 / March / 2014, 10:54:45 »
Advertisements
First results on the a3400, v9 + reyalp's aflock-2 patch + enabled CAM_SD_OVER_IN_AFL:
The new test script succeeds both with(!) and without AF lock. Regular SD override selected in the menu still crashes the camera when in AF lock (as expected).
Updated test script attached - an update to the version used to collect all the camera information.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Setting focus from scripts or menus
« Reply #281 on: 02 / March / 2014, 12:04:07 »
A few other items (most we discussed in IRC, putting here so the don't get lost)
- set_MF should fail if not in rec mode, without calling the underlying canon function.
Should this apply to set_aflock() too ?

And maybe this should also be a condition in shooting_can_focus()

Quote
- set_focus could (should?) return a status value that tells whether focus override is expected to work with the current settings.
We could just use the result of a call in luaCB_set_focus() (and the uBASIC equivalent) to shooting_can_focus() as the return value ?

Quote
- script set_focus still has some weird logic with shooting_get_common_focus_mode, mf, set_now and set later. In particular the current checks make it use set_now only if the camera has real Canon MF, cameras without Canon MF will use the non-MF codepath even if *MFOn eventprocs work. This doesn't need to be addressed for the first patch.
-  Related to the previous, and srsa's suggestion earlier in the thread, the attached patch makes set_focus use set_now if aflock is on. This works on all my cameras. The patch is intended to go on top of waterwingz last patch (it needs the propcase set to know aflock is on). This may address cameras that had no working method. It's also nice because you can see the effect of focus changes right away without shooting.

Patch file merged with mine and attached below. 

Fixed DoMFLock() UnlockMF() when using PressSw1AndMF to enable MF.   The call needs to use PostLogicalEventForNotPowerType rather than PostLogicalEventToUI.   Tested on my G10 - now toggles Canon OSD MF icons as expected.

Also includes the new mf3_test.lua script.

« Last Edit: 02 / March / 2014, 13:01:32 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Setting focus from scripts or menus
« Reply #282 on: 02 / March / 2014, 13:03:45 »
First results on the a3400, v9 + reyalp's aflock-2 patch + enabled CAM_SD_OVER_IN_AFL:
The new test script succeeds both with(!) and without AF lock. Regular SD override selected in the menu still crashes the camera when in AF lock (as expected).
Try the "improved" test script please?  According to the new platform_camera.h for the A3400,  the camera should only allow a set_focus() when AFL & MF modes are disabled.  I guess I need to look at whether the "Enhanced Photo Operations" SD override uses shooting_can_focus() ?  It seems to work for my A1200 - the camera will only SD override from the CHDK menus if AFL mode is selected.  It doesn't crash if AFL is not selected - it just doesn't focus. That's what the #defines in its platform_camera.h are set for.

@nafraf : on an unrelated note,  the changes to the various platform_camera.h files mean that new camera ports for 1.2.0 will need a different platform_camera.h when they get added to 1.3.0
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline srsa_4c

  • ******
  • 4451
Re: Setting focus from scripts or menus
« Reply #283 on: 02 / March / 2014, 13:11:06 »
Try the "improved" test script please?  According to the new platform_camera.h for the A3400,  the camera should only allow a set_focus() when AFL & MF modes are disabled.
First results on the a3400, v9 + reyalp's aflock-2 patch + enabled CAM_SD_OVER_IN_AFL:
The new test script succeeds both with(!) and without AF lock. Regular SD override selected in the menu still crashes the camera when in AF lock (as expected).
I have added #define CAM_SD_OVER_IN_AFL 1, thus my results.

Re: Setting focus from scripts or menus
« Reply #284 on: 02 / March / 2014, 13:44:44 »
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?
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 14125
Re: Setting focus from scripts or menus
« Reply #285 on: 02 / March / 2014, 16:13:43 »
A few other items (most we discussed in IRC, putting here so the don't get lost)
- set_MF should fail if not in rec mode, without calling the underlying canon function.
Should this apply to set_aflock() too ?

And maybe this should also be a condition in shooting_can_focus()
I'd say yes to both.  Calling the MFOn function while in play mode doesn't make MF actually on once you switch to rec, I assume the same is true for set_aflock. For shooting_can_focus, we should definitely not try to move the lens while in playback mode.

Quote
We could just use the result of a call in luaCB_set_focus() (and the uBASIC equivalent) to shooting_can_focus() as the return value ?
I think so.
Don't forget what the H stands for.

Re: Setting focus from scripts or menus : patch file 15
« Reply #286 on: 02 / March / 2014, 16:14:30 »
Updated version. 

Fixed some dumb things resulting from my edit scripts now at the end of their useful life.

Added set_mf as a uBASIC function and renamed the Lua function to set_mf(0/1)

Made sure the mf3_test.lua script actually made it into this patch file.

For some reason,  #define CAM_SD_OVER_IN_MF dropped out in the version update and CAM_SD_OVER_MF_MODE crept back in.  Fixed now.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline srsa_4c

  • ******
  • 4451
Re: Setting focus from scripts or menus
« Reply #287 on: 02 / March / 2014, 16:15:16 »
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?
I'd like to test what happens when SD override is not enforced in shooting_expo_param_override(). Without CAM_SD_OVER_IN_AFL, the set_focus commands were silently ignored in AF lock, as they were supposed to.

Some notes (v11).
- CAM_SD_OVER_IN_MF is missing from camera.h
- the new testing script is not included in the patch


edit:
The a3400 still doesn't like SD override in MF mode (PT_MFOn).
« Last Edit: 02 / March / 2014, 16:35:54 by srsa_4c »

Re: Setting focus from scripts or menus
« Reply #288 on: 02 / March / 2014, 17:46:33 »
The a3400 still doesn't like SD override in MF mode (PT_MFOn).
When you look at the complete list of cameras actually tested, there are a few odd balls  In some ways the SX50 is worse, but at least it has an MF mode.   

And it's also strange that the a3400 will not support PressSw1And MF although the 5 cameras released just before it and the two right after it  (by P-ID) do.  Hard to blame this on the sigfinder's choices but it does make me a little curious.

I assume the new #defines prevented a crash? 
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline srsa_4c

  • ******
  • 4451
Re: Setting focus from scripts or menus
« Reply #289 on: 02 / March / 2014, 18:30:10 »
I assume the new #defines prevented a crash?
No crash with the latest test script and the untouched v15 code base (i.e. without my changes).

 

Related Topics


SimplePortal © 2008-2014, SimplePortal