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

Setting focus from scripts or menus

  • 556 Replies
  • 131503 Views
Re: Setting focus from scripts or menus : please run this script and report back
« Reply #270 on: 23 / February / 2014, 18:37:13 »
Advertisements
No. It would work fine if you put it below the platform_camera.h include in camera.h
Thanks - that explains why I could not get it to work in my quick test - missed the #include "platform_camera.h" down at the bottom of the file.

I'm still going to nuke CAM_CAN_SD_OVERRIDE completely though - its not needed.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline mngc

  • ***
  • 113
  • a590is fw 1.0.1b & sx110is fw 1.0b
Re: Setting focus from scripts or menus
« Reply #271 on: 25 / February / 2014, 16:02:47 »
Hi,

Script test log file for SX110is, no crash.

Re: Setting focus from scripts or menus
« Reply #272 on: 25 / February / 2014, 21:01:41 »
Script test log file for SX110is, no crash.
Thanks - that takes us to 75% tested.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Setting focus from scripts or menus
« Reply #273 on: 25 / February / 2014, 22:39:21 »
Reposting Ixus230/elph310hs from post #264 since it didn't seem to make it into the spreadsheet.  Probably lost amongst the discussion posts.


Re: Setting focus from scripts or menus
« Reply #274 on: 25 / February / 2014, 23:04:28 »
Reposting Ixus230/elph310hs from post #264 since it didn't seem to make it into the spreadsheet.  Probably lost amongst the discussion posts.
Thanks for the repost.  I checked the google doc history to make sure I had not accidentally recorded the results against another camera but that does not appear to be the case.  Hopefully this is the only one I've missed.
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Setting focus from scripts or menus
« Reply #275 on: 01 / March / 2014, 10:38:35 »
Update :  I now have a set of bash/sed edit scripts that make the following changes to the 1.3.0 trunk :

  • Modify set_aflock() to also set PROPCASE_AF_LOCK
  • Removes all the old #defines related to SD override  (and references to those #defines)
  • Adds a new set of #defines for SD override (as discussed previously)
  • Changes shooting_can_focus() to use the new #defines
  • Adds entries to stub_entry.S for either _MFOn / _MFOff  or  _PT_MFOn / _PT_MFOff or  _SS_MFOn / _SS_MFOff  (thanks to philmoz for this part)
  • Adds functions  int DoMFLock(void)  int UnlockMF(void) to each camera's platform/camera/wrappers.c.

Notes:
  • The DoMFLock() function will invoke Canon MF mode if possible for that camera, and return an integer indicating the method used or 0 if MF lock cannot be enabled.
  • My edit script uses PostLogicalEventToUI(levent_id_for_name("PressSW1andMF"),0); only if there is no defined "event proc" method (i.e _MFOn / _MFOff  or  _PT_MFOn / _PT_MFOff  or  _SS_MFOn / _SS_MFOff) and testing indicated that method as working.
  • With these changes,  set_focus() can now be made to work properly.  A new Lua function ( set_MF(0/1) ) has been added for testing purpose - I'm not committed to that being the final function name & format. 
  • I've temporarily added a new script - mf_test.lua - to the CHDK/SCRIPTS/TEST directory. In testing, I've noticed that setting SD override in the CHDK menus wins out over set_focus() in the script?
  • It should also now be possible to clean up the SD override shortcuts and the SD override menu items in a separate patch. I guess that's the next project.
  • I added a comment in the wrappers.c changes to indicate how DoMFLock() is to be created for new cameras but not where the return parameter comes from.  Need to document that too somewhere.

So far I've only tested this on my A1200 but the patch builds properly for all camera.   I'll continue testing but would appreciate any feedback on the implementation.

Update 1 : updated patch file that removes any SD override #defines that evaluate to 0  ( so #ifdef can be used) and made some other format improvements.

Update 2 : v7 of patch added for latest 1.3.0 trunk update (philmoz committed the MF changes from the sigfinder)
« Last Edit: 01 / March / 2014, 17:20:55 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Setting focus from scripts or menus
« Reply #276 on: 01 / March / 2014, 20:49:05 »
Update :
  • fixed case used for PressSw1AndMF
  • changed Lua set_MF() function to use lua_pushnumber(L, val); return 1;
  • return from DoMFLock() is now simply 0=fail 1=success
  • mf_test.lua is now in the CHDK/SCRIPT/TEST directory (I hope)

props to reyalp for pointing those things out ...
Ported :   A1200    SD940   G10    Powershot N    G16

*

Online reyalp

  • ******
  • 13362
Re: Setting focus from scripts or menus
« Reply #277 on: 01 / March / 2014, 23:05:02 »
I tested this a bit on my d10, a540 and elph130. set_MF and subsequent set_focus seems to work on all of them. The script ran and the focus changed between shots. I haven't done anything with the shortcuts or sd override yet.

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.
- set_focus could (should?) return a status value that tells whether focus override is expected to work with the current settings.
- 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.

Thanks again to waterwingz for pushing this forward.  :D

edit:
replaced patch, first one missed camera_info.h
« Last Edit: 01 / March / 2014, 23:22:02 by reyalp »
Don't forget what the H stands for.


Re: Setting focus from scripts or menus
« Reply #278 on: 01 / March / 2014, 23:49:50 »
A few other items (most we discussed in IRC, putting here so the don't get lost)
-
One final one we mentioned - some sort of notification for ports that have not been tested "encouraging" users to run a test script of some sort and report results in exchange for getting the nag notice removed.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline srsa_4c

  • ******
  • 4426
Re: Setting focus from scripts or menus
« Reply #279 on: 02 / March / 2014, 09:27:18 »
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).

 

Related Topics