Unfortunately, It's Complicated, so this is gonna be a long post
Camera variationsCanon has had (at least) 3 general styles of doing MF. The current CAM_USE_ZOOM_FOR_MF only works for cameras with native MF, so I'm ignoring AF-only cameras here.
Type 1
Old cameras (some 2007 and earlier) without a dedicated MF button (e.g. A540)
* The focus mode key is DOWN on the d-pad.
* MF is enabled clicking focus mode until it cycles to MF, which opens and selects the MF UI
* When the MF UI is selected, LEFT/RIGHT adjust focus distance.
* +/- cycles between the MF UI and other available controls, e.g. Tv/Av
* MF is canceled by clicking focus mode button again
This is the style the current basic CAM_USE_ZOOM_FOR_MF is designed for.
Type 2
Old cameras with a dedicated MF button (e.g. S2)
* I don't have one these, so I'm guessing from the manuals and previous posts
* Holding the MF key and UP/DOWN is used to adjust focus
* Clicking the MF key without adjusting focus cancels MF(?)
KBD_ZOOM_FOR_MF_USE_MF_KEY is intended for these cameras. Currently enabled for S2, S3, S5, and S80. No other ports are defined to have KEY_MF.
Type 3
Later cameras. From G9 (later 2007ish) to current
* The focus mode button is changed to LEFT.
* After clicking focus mode, LEFT/RIGHT or jogdial cycle between focus modes
* When MF is selected, adjustment is done with UP/DOWN or jogdial
* Clicking SET leaves MF adjustment, at which point UP/DOWN resume their normal functions
* +/- no longer toggles to MF control. Instead, clicking the focus mode button allows you to reactivate the MF UI, or switch to a different focus mode.
Current CAM_USE_ZOOM_FOR_MF code does not work at all for these cameras, because it uses the wrong keys
Type 4
added 12/28, thanks srsa_4cOnly jogdial can adjust MF. (sx100) Current CAM_USE_ZOOM_FOR_MF code cannot support these cameras, since it only generates key presses
Current CAM_USE_ZOOM_FOR_MF implementationThe CAM_USE_ZOOM_FOR_MF define defaults to on, but is turned off in most cameras. If it's on for any type 3 cameras, it's a mistake.
It has a menu option in CHDK settings, which appears if the define is enabled. This is not described in the CHDK user manual.
On type 1 cameras, the zoom lever sends UP/DOWN whenever focus mode is set to MF. This means you can't adjust zoom without turning off MF (leaving the controller with +/- isn't sufficient) or turning of the CHDK option.
If you select something else (e.g. Tv) with MF enabled, the zoom will change that.
On type 2 cameras, zoom control is only enabled while holding MF, so zooming is possible without changing settings, and zoom will generally not send key presses to other controls
QuestionsQ: Should we attempt to keep this feature at all?
* In the years since Canon MF style changed, hardly anyone has asked about it. OTOH, liero did, and others might find it useful if it were documented.
* Being able to adjust focus without using the D pad / jogdial makes sense ergonomically.
Q: Which cameras should support it?
* It makes little sense on cameras that already use buttons to zoom
* The current implementation only works with MF. There is a separate UI for SD override on AF only cameras
* The behavior on type 2 cameras seems very reasonable.
* The behavior on others is a lot more hacky and seems only marginally useful to me in it's current form
* Since it's has a menu option that defaults off, it would theoretically make sense to have the define enabled for most cameras with native MF.
* If it's only going to be enabled on a few cameras, as currently, the #define should default to off.
Changes and implementation issuesI started trying to add support for type 3 cameras by adding a new define CAM_MF_KEYS_UP_DOWN which generates UP/DOWN instead of LEFT/RIGHT. Patch attached.
This basically works, but there are some issues
* It doesn't seem to work on cameras with multi-stage zoom levers (sx710). I'm not sure why, but the zoom moves a tiny bit for each click and focus doesn't change much. I suspect it has to do with the firmware seeing the partial zoom press, and ignoring the UP/DOWN that happens at the same time. Addressing this properly requires significant changes to the keyboard code, but it it would be useful in other cases too (e.g. script detecting / sending the different zoom stages)
* Because it only detects if the camera is in MF mode, the zoom lever invokes other functions (and doesn't zoom) as soon as you leave the MF interface. This is true on the old type 1 cameras as well, but other meanings of the keys may have made it slightly less annoying.
* Needing to cancel MF or disable the CHDK option to change the zoom is pretty annoying. It would be much more useful if we could detect when the MF control is active, rather than just MF mode.
Additional notes:
* I added a #error if CAM_USE_ZOOM_FOR_MF is defined without CAM_HAS_MANUAL_FOCUS. I have not yet done a full build to see it gets hit. This define also might not be set for every camera with MF, so this might be a bad idea.
* CAM_MF_KEYS_UP_DOWN should probably default on, since the vast majority of cameras use that style.
* I defined CAM_MF_KEYS_UP_DOWN as a camera.h define (rather than platform_kbd.h) because knowing that could potentially be useful elsewhere. I initially though of having CAM_USE_ZOOM_FOR_MF use 1 for left/right, 2 for up/down.
* The logic for playback mode in kbd_use_zoom_as_mf seems suspect. It should probably just return 0 at the start if not in rec.
If I figure out a way to deal with the multistage zoom issue, I'll post a test build for
@liero