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

Zoom for MF etc (was Re: SX60HS Porting)

  • 23 Replies
  • 12235 Views
Zoom for MF etc (was Re: SX60HS Porting)
« on: 22 / November / 2017, 14:37:10 »
Advertisements
Quote
Neither have I achieved that the manual focus can be controlled with the zoom trigger, or with the upper wheel.
As far as I know, you must set the camera to manual focus mode, and then use the up and down arrows to focus the camera.  There has been discussion about implementing focus adjustment using the wheel located behind the shutter key, and I spent sometime attempting to implement it but I could not get it to work smoothly and reliably. Check further back in this thread maybe a year ago?
« Last Edit: 10 / December / 2017, 15:54:06 by reyalp »

Re: Re: SX60HS Porting
« Reply #1 on: 22 / November / 2017, 17:53:55 »
As far as I know, you must set the camera to manual focus mode, and then use the up and down arrows to focus the camera. 
That's just the normal Canon MF mode action for cameras that support MF.  Nothing to do with CHDK!

FWIW, looking at the code in kbd_common.c, the CHDK option that Yimiblu references does not appear do anything with manual focus either.  It simply remaps the zoom lever to the right & left buttons so that the Canon firmware thinks those buttons are being pressed when you push the zoom lever left or right.  Totally useless on an SX40/50/60, which expects MF to be adjusted with the up/down buttons rather than left/right button!

A quick grep of the source tree shows most cameras have this option disabled anyway.  I'd suggest adding
Code: [Select]
#undef  CAM_USE_ZOOM_FOR_MFto the SX40/50/60 platform_camera.h files.

Note that if KBD_ZOOM_FOR_MF_USE_MF_KEY is also defined, then CHDK will use the up & down buttons.  But it also requires you to hold down the MF key while doing so, which makes no sense for cams where MF is mapped to the function dial buttons.

This kind of code usually comes from way back in the early days of CHDK when functionality was added without a lot of thought to how different cameras are configured.  Years later someone notices that it actually does not work.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 14079
Re: Re: SX60HS Porting
« Reply #2 on: 10 / December / 2017, 15:51:29 »
FWIW, looking at the code in kbd_common.c, the CHDK option that Yimiblu references does not appear do anything with manual focus either.  It simply remaps the zoom lever to the right & left buttons so that the Canon firmware thinks those buttons are being pressed when you push the zoom lever left or right.  Totally useless on an SX40/50/60, which expects MF to be adjusted with the up/down buttons rather than left/right button!
Thanks for reminding me of this. Here's some previous discussion of this feature:
https://chdk.setepontos.com/index.php?topic=12245.msg121210#msg121210


Quote
A quick grep of the source tree shows most cameras have this option disabled anyway.  I'd suggest adding
Code: [Select]
#undef  CAM_USE_ZOOM_FOR_MFto the SX40/50/60 platform_camera.h files.
It would be fairly easy to add a define to control whether "CAM_USE_ZOOM_FOR_MF" use up/down or left/right. I don't know whether it's worth it...

I also didn't realize (or forgot) that CAM_USE_ZOOM_FOR_MF defaults on in camera.h  :blink:
Most modern cameras use up/down for focus adjustment.
Quote
Note that if KBD_ZOOM_FOR_MF_USE_MF_KEY is also defined, then CHDK will use the up & down buttons.  But it also requires you to hold down the MF key while doing so, which makes no sense for cams where MF is mapped to the function dial buttons.
Right, this was for cameras like the s5, which has a separate, easily reachable MF button. According the manual, normal MF on these cameras is done by holding down the MF key and using the rear controls, so it makes sense to follow the same behavior when re-mapping to the zoom lever, and the zoom lever is likely more ergonomic in some cases...
Quote
This kind of code usually comes from way back in the early days of CHDK when functionality was added without a lot of thought to how different cameras are configured.  Years later someone notices that it actually does not work.
Yup, and worse, we usually don't have the camera that it was originally made for.

« Last Edit: 10 / December / 2017, 16:14:11 by reyalp »
Don't forget what the H stands for.

*

Offline liero

  • *
  • 13
Re: Zoom for MF etc (was Re: SX60HS Porting)
« Reply #3 on: 23 / December / 2017, 15:43:37 »
I was making some noise on this topic in other thread a year ago... in fact I wanted to focus using the zoom, not the  jog dial, and managed to get close to it with a basic lua script and set_focus(); as you keep the zoom pressed it would focus further or closer, the real problem was that it could crash the camera or block the zoom, didn't want to break anything so stopped playing with that

point is, even a working script would be useful and better in many cases than the up/down buttons of this camera, maybe someone could give it a look?

https://www.dropbox.com/s/pg8pyw6zij9a4hx/zoom_focus.lua?dl=0

thanks anyway


Re: Zoom for MF etc (was Re: SX60HS Porting)
« Reply #4 on: 27 / December / 2017, 12:00:50 »
I was making some noise on this topic in other thread a year ago... in fact I wanted to focus using the zoom, not the  jog dial, and managed to get close to it with a basic lua script and set_focus();
If your only goal is to be able to adjust focus using the zoom lever, the fix in the works discussed should let cameras like your SX60 adjust focus via the zoom lever without a needing a script (i.e. you can use it during "normal" shooting.) 

This assumes that the resolution of the focus distance "steps" you get pressing the up/down button on the back of your camera is acceptable?   

Until the fix wanders its way into the autobuild, it would be pretty easy to modify your script to do that same thing if you are interested  (i.e. click the up/down arrows rather than call set_focus( ) in response to zoom lever movements.)

Quote
as you keep the zoom pressed it would focus further or closer, the real problem was that it could crash the camera or block the zoom,
Looking quickly at your script, it seems that adding a few strategic "sleep" statements and a half press after each focus adjustment might stabilize things?  Seems to work well on my old A1200 that way.  YMMV. Updated script attached.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline liero

  • *
  • 13
Re: Zoom for MF etc (was Re: SX60HS Porting)
« Reply #5 on: 27 / December / 2017, 14:34:41 »
Hi, thanks for the reply.
That eventual patch should keep the usual focus interface -the bar and the x4 zoom- so that's great as you can have that with a script. The focus distance step is tricky, it has some acceleration now when you keep button pressed, which seems nice at first but makes it a bit unstable, as you can go too far too easily. Hope it feels better with the wheel.
Tried your modified script a bit, I keep loosing control of the zoom after using it, but don't worry.

Re: Zoom for MF etc (was Re: SX60HS Porting)
« Reply #6 on: 27 / December / 2017, 15:55:34 »
Tried your modified script a bit, I keep loosing control of the zoom after using it, but don't worry.
Can you expand on what you mean by "losing control of the zoom after using it" means? 
Does it mean that you can no longer zoom the lens normally after you run the script and then fully press the shutter key to exit the script?
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline liero

  • *
  • 13
Re: Zoom for MF etc (was Re: SX60HS Porting)
« Reply #7 on: 27 / December / 2017, 16:49:13 »
yes, that's right... lens barely moves, need to turn off the camera
not very good at english btw


Re: Zoom for MF etc (was Re: SX60HS Porting)
« Reply #8 on: 27 / December / 2017, 16:55:57 »
yes, that's right... lens barely moves, need to turn off the camera
Hmmmm .. I don't see that on my A1200.   I have a couple of SX50's buried away somewhere - I'll try that if I get a few quiet moments to create an SD card for one of them.

Quote
not very good at english btw
Your english is a lot better than my ability to speak anything other than english!
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 14079
Re: Zoom for MF etc (was Re: SX60HS Porting)
« Reply #9 on: 27 / December / 2017, 17:04:29 »
While working on this, I noticed that kbd_is_key_pressed doesn't work right where a multi-stage zoom is all defined as as KEY_ZOOM_IN/KEY_ZOOM_OUT as on sx60 and many of the other big zoom cameras.

It does a search and returns on the first match, so will only match whichever stage appears first in the keymap.

At one point KEY_ZOOM_IN1, KEY_ZOOM_IN2 were defined for the different stages but these don't seem to be used in the current code.

As usual, this feature comes with several complimentary cans of worms :-[
Don't forget what the H stands for.

 

Related Topics