Zoom for MF etc (was Re: SX60HS Porting) - page 2 - General Discussion and Assistance - CHDK Forum

Zoom for MF etc (was Re: SX60HS Porting)

  • 23 Replies
  • 4110 Views
Re: Zoom for MF etc (was Re: SX60HS Porting)
« Reply #10 on: 27 / December / 2017, 17:14:49 »
Advertisements
As usual, this feature comes with several complimentary cans of worms :-[
So if the script strips off one of the two zoom key bits, the other will stay set but normally it's not possible for it to be set by itself and this confuses the Canon code?  Something like that?
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 11920
Re: Zoom for MF etc (was Re: SX60HS Porting)
« Reply #11 on: 27 / December / 2017, 17:29:47 »
As usual, this feature comes with several complimentary cans of worms :-[
So if the script strips off one of the two zoom key bits, the other will stay set but normally it's not possible for it to be set by itself and this confuses the Canon code?  Something like that?
I'm not sure this affecting script, I just noticed while trying to get ZOOM_FOR_MF to work on sx710 and figured it might be. Looking at the script it doesn't seem like it obviously should.

For a script, the key mask should prevent the other bits being seen by the canon firmware. Generated presses will only trigger the first match (full speed in most ports), and release will do the same.

On a slight tangent:
If we were aware of the multistage zoom and could translate that to focus speed, that would make zoom for MF significantly better. One thought for how to do this would be to generate jogdial clicks, faster or slower depending on which zoom stage was active.

Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 11920
Re: Zoom for MF etc (was Re: SX60HS Porting)
« Reply #12 on: 27 / December / 2017, 21:47:02 »
Unfortunately, It's Complicated, so this is gonna be a long post :(

Camera variations
Canon 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_4c
Only 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 implementation
The 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

Questions
Q: 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 issues
I 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
« Last Edit: 28 / December / 2017, 15:49:03 by reyalp »
Don't forget what the H stands for.

Re: Zoom for MF etc (was Re: SX60HS Porting)
« Reply #13 on: 27 / December / 2017, 23:20:13 »
If I figure out a way to deal with the multistage zoom issue, I'll post a test build for @liero
Presumably other cameras (i.e. SX50hs) could also benefit from this?
Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline reyalp

  • ******
  • 11920
Re: Zoom for MF etc (was Re: SX60HS Porting)
« Reply #14 on: 28 / December / 2017, 00:06:14 »
If I figure out a way to deal with the multistage zoom issue, I'll post a test build for @liero
Presumably other cameras (i.e. SX50hs) could also benefit from this?
Yes, it's a general problem multi-stage zoom controls, so presumably a workaround would be applicable to all.

When I started this, I planned to just throw together a quick a test build using UP/DOWN instead of LEFT/RIGHT for liero since they requested the feature.

Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 11920
Re: Zoom for MF etc (was Re: SX60HS Porting)
« Reply #15 on: 28 / December / 2017, 00:38:19 »
Here's an updated patch with a workaround for the key issue. This just makes kbd_is_key_pressed return true if any matching key is pressed, instead of stopping on the first one. It's not clear if/how this should be extended to other functions.

Also attached a test build of sx60hs-100f for @liero. I think it's still not very usable because you have to turn off MF to change zoom
Don't forget what the H stands for.

*

Offline liero

  • *
  • 13
Re: Zoom for MF etc (was Re: SX60HS Porting)
« Reply #16 on: 28 / December / 2017, 08:39:40 »
Thanks reyalp, been playing with it and really love the feature, feels way more natural than default keys.
But then yes, you need to leave Manual focus to be able to use up/down keys and zoom again, that's a bit of a problem. Maybe be a single shortcut to toggle MF -right now you need to do LEFT LEFT SET- that would be also useful to lock zoom when recording video, as it tends to move a lot. But I hope you can get a better idea.
Thanks again, you guys are great.

*

Offline srsa_4c

  • ******
  • 3919
Re: Zoom for MF etc (was Re: SX60HS Porting)
« Reply #17 on: 28 / December / 2017, 15:26:24 »
Camera variations
I have notes about two cams I have.
S80: MF button is keypad down that switches MF on/off. When the Canon MF UI is active, the jogdial (and only that) can be used to adjust focus. Since it's pretty usable, the CHDK workaround is likely not needed.
SX100: MF can be activated using the keypad left button (and then selecting MF from the icons). When the MF UI is active, the jogdial can be used to adjust focus (like on the S80, adjusting with buttons is not supported). Since this is also usable, no CHDK workaround is needed.


*

Offline reyalp

  • ******
  • 11920
Re: Zoom for MF etc (was Re: SX60HS Porting)
« Reply #18 on: 28 / December / 2017, 15:32:34 »
One thought I had about making this easier to use would add an option for it work in alt mode.

AFAIK zoomin/zooming don't currently do anything in plain alt mode (when not running a script, in a menu, etc)

Then you'd use alt to toggle between zooming and focusing.

This would still be somewhat weird because zoom in / out in alt mode would send up / down to the normal firmware when the focus UI wasn't open. Depending on the cameras available alt buttons, toggling in/out could also be inconvenient.

Detecting when the focus UI is active would be better. I expect this is possible with some reverse engineering, but unless it can be done reliably in the sig finders it would be a lot of work to do it on all cameras.
Don't forget what the H stands for.

*

Offline reyalp

  • ******
  • 11920
Re: Zoom for MF etc (was Re: SX60HS Porting)
« Reply #19 on: 28 / December / 2017, 15:46:15 »
Camera variations
I have notes about two cams I have.
S80: MF button is keypad down that switches MF on/off. When the Canon MF UI is active, the jogdial (and only that) can be used to adjust focus. Since it's pretty usable, the CHDK workaround is likely not needed.
Thanks. I'm confused now because I thought S80 had a standalone MF button like S2 etc. It has KBD_ZOOM_FOR_MF_USE_MF_KEY which IMHO only makes sense for the those cams.

(previous discussion https://chdk.setepontos.com/index.php?topic=12245.msg121210#msg121210)

If it really can only adjust by jogdail, then none of the current CAM_USE_ZOOM_FOR_MF options should work at all.
Quote
SX100: MF can be activated using the keypad left button (and then selecting MF from the icons). When the MF UI is active, the jogdial can be used to adjust focus (like on the S80, adjusting with buttons is not supported).
Thanks. I was wondering about that, I looked at the manual and saw it only mentioned jogdial but wasn't sure if UP/DOWN worked too.
Quote
Since this is also usable, no CHDK workaround is needed.
No workaround needed = no need to support CAM_USE_ZOOM_FOR_MF ?

It should be possible to issue jogdial clicks, but it would need to be handled somewhat differently because it's not just a simple start/stop.

Most modern cams (type 3) support both keys and jogdial, if they have a jogdial.
Don't forget what the H stands for.

 

Related Topics