Phase 2 Instructions Here -> Manual Focus Test Phase 2 Instructionsscript download link > MF_test.lualinks to results so far > Google Docs SpreadsheetI've been working for some time now on CHDK's ability to set the camera's focus. Different cameras seem to need different things. I've recorded some of my findings here :
CHDK Wiki PageWhat I think I have discovered is that there are three types of cameras when it comes to using the set_focus() script commmand.
- Cameras that will set_focus() with no setup or other scripting commands needed.
- Cameras that will set_focus() if they have a Canon native MF (manual focus) mode and that mode is enabled.
- Cameras that will set_focus() when the camera is in Canon's AFL (auto focus lock) mode .
Obviously, the first group of cameras (mostly older models) needs no further investigation. And I've learned that the second group of cameras can be placed in MF mode in a script by calling
post_levent_for_npt("PressSw1AndMF") (props to philmoz for discovering that and reporting it in the forum). But cameras in the third group have proven problematic.
Some cameras in the third group will focus if a
set_aflock(1) command is issued prior to a
set_focus() command but some will not. Those that will not need to be placed into Canon AFL mode from the camera keyboard prior to shooting. This is a problem as the only way to do that from a script is with
click() commands, which are carmera dependent.
But I've had a breakthrough! I've discovered that on my cameras,
set_aflock(1) does not set the AF lock property case value. However, if I set it from the script using
set_prop(props.AF_LOCK,1) when
set_aflock(1) is called then the camera LCD show the Canon AFL icon and I can use
set_focus() from within my script! No manual keyboard setting required.
[see the note below]This is quite exciting as it means we are very close to being able to use set_focus() in any script with no prior camera setup required.
Still, it would be good to know which cameras can use what modes and how the overlap. So I've attached a small test script in the hope that people will run it and post the resulting
mf_test.csv file here for analysis. I'll compile all submissions and sumarize here and on the wiki page I mentioned above.
So please test your camera and report back here with an attached mf_test.csv file. Simple instructions are in the title block of the script.TIA
WW
Note: (technical discussion)
It turns out that a big part of the problem was caused by somewhat arbitrary setup values used in camera.h and how they interact in CHDK's
shooting_can_focus() C function:
CAM_HAS_MANUAL_FOCUS
CAM_CAN_SD_OVERRIDE
CAM_CAN_SD_OVER_NOT_IN_MF
CAM_CAN_SD_OVER_IN_AF_LOCK
CAM_CAN_SD_OVER_IN_AF_LOCK_ONLY These control whether SD override is available on the CHDK menus and whether to prevent attempts to set focus if the camera is not in AFLock mode. Setting focus when not in AFLock mode causes some cameras to crash. The CHDK code looks at several property case values to determine whether to allow
set_focus() or not. One of those property case values is the AFL value, which what not being set by
set_aflock() so my camera would not accept the
set_focus() command. In IRC discussions with reyalp, we've agreed that these need to be reviewed and clarified and then some cameras may need their configuation modified.
An easy fix to the current code for
set_aflock() is to have it also set the AFLock property case value appropriately so that it does not need to be done in the script.
An outstanding issue is how the SD override functions in the CHDK menus can be fixed. Currently some cameras need to be placed in AFL mode manually before the menu SD overrides will work. And some apparently just crash.
I'm sure I've missed some other things here. IIRC, philmoz posted that on some cameras, the set_aflock() needs to be make while a "half-press" is active for example. Other comments and observations are welcome!
Note : - updated script to v2.1 to correctly handle missing propcases for propset3 cameras.
- updated script to v2.2 to allow individual tests to be enabled/disabled and added another MF enable method
- updated script to v2.3 for log file robustness, focus lock checking before shooting, ranges moved to not overlap or be too close for G1x, SS.MFOn enable by default
- updated scritp to v2.4 to expand focus test criterion to pass if actual is within 20% for actual (from 10%)
- updated script to v2.7 with multiple changes supporting provisional CHDK set_focus_interlock_bypass mode
- updated script to v2.8 to fix wrong report if cam can't focus and to forcibly disable CHDK menu override and SD overide modes
- updated script to v2.9 to add restore() function (from msl)
- updated script to v2.10 to cause script to halt immediately if Lua Native Calls are not enabled
- updated script to v2.11 to allow individual disable of event_proc tests
- updated script to v2.12 to check that CHDK 1.3.0 rev 3303 or later is loaded