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

Setting focus from scripts or menus

  • 601 Replies
  • 219677 Views
Re: Setting focus from scripts or menus : status report
« Reply #240 on: 11 / February / 2014, 13:44:34 »
Advertisements
I'm using S100 and want to make interval shots with fixed focus. Does it mean set_aflock should work for me?
The results in that table use a special hack added temporarily to CHDK for testing purposes.  The hack bypasses some internal checks used by the set_focus() command.  So the results listed do not necessarily apply to the CHDK stable release (for example).

That being said,  I believe the S100 will allow you to set focus from a script using just the set_focus(distance) command before each shot.

Ported :   A1200    SD940   G10    Powershot N    G16

Re: Setting focus from scripts or menus : status report
« Reply #241 on: 11 / February / 2014, 19:33:40 »
That being said,  I believe the S100 will allow you to set focus from a script using just the set_focus(distance) command before each shot.

Thanks, I'll try that. The last time I tried my interval script, I set my S100 to MF mode and run the script. It always re-focus on each shot. I tried with different variations shoot_half/full etc. without success.

I just found something in the wiki. Maybe I've to do that with set_focus too:
"Example: In Manual Focus in the S-series cameras the MF button needs to be held down while the focus commands are being issued.:


Re: Setting focus from scripts or menus : status report
« Reply #242 on: 11 / February / 2014, 21:15:31 »
That being said,  I believe the S100 will allow you to set focus from a script using just the set_focus(distance) command before each shot.

Thanks, I'll try that. The last time I tried my interval script, I set my S100 to MF mode and run the script. It always re-focus on each shot. I tried with different variations shoot_half/full etc. without success.

I just found something in the wiki. Maybe I've to do that with set_focus too:
"Example: In Manual Focus in the S-series cameras the MF button needs to be held down while the focus commands are being issued.:
This is interesting.  Behavior of various Canon models seems to vary quite a bit. 

I think it would be good to issue a  set_aflock(1)  command at the start of your script as you originally suggested.  Do some testing to make sure you can issue set_focus() commands from your script after that.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline reyalp

  • ******
  • 14128
Re: Setting focus from scripts or menus : please run this script and report back
« Reply #243 on: 15 / February / 2014, 23:12:07 »
a495 results from "ItsMeLenny" in IRC
Don't forget what the H stands for.

*

Offline msl

  • *****
  • 1280
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links

Re: Setting focus from scripts or menus : please run this script and report back
« Reply #245 on: 16 / February / 2014, 05:34:30 »
a495 results from "ItsMeLenny" in IRC
Matches the other test file submitted.  Good.

A550 test from ferdy: http://forum.chdk-treff.de/download/file.php?id=2674
Added - thanks.

Ported :   A1200    SD940   G10    Powershot N    G16

Re: Setting focus from scripts or menus : status report
« Reply #246 on: 21 / February / 2014, 22:33:14 »
That being said,  I believe the S100 will allow you to set focus from a script using just the set_focus(distance) command before each shot.
Looks like I got it (fixed focus interval shots) working. I use set_focus() and then aflock() for all following shots. Thank you for your help.
Initially, I tried to set the camera to MF mode manually and the script locks the focus. For some reason, aflock() doesn't have effect in MF mode. The focus changes on each shot.

One more question, how do I set_focus(infinity)? Can I simply use a very large number?

Re: Setting focus from scripts or menus : status report
« Reply #247 on: 21 / February / 2014, 23:21:45 »
One more question, how do I set_focus(infinity)? Can I simply use a very large number?
Yes.  Anything 30000 or greater will do. Use 30000.
« Last Edit: 21 / February / 2014, 23:24:34 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Setting focus from scripts or menus : next steps
« Reply #248 on: 22 / February / 2014, 12:29:17 »
Show time.

I think we have reached the point of diminishing returns with testing although I will continue to seek and accept new test results and will still maintain the spreadsheets for future reference.

Next step : break the problem into manageable chunks that can be discussed separately as follows:

1) shooting.c :  shooting_can_focus()    shooting_get_common_focus_mode()
  • redefine the various CAM_CAN_SD_*** #defines and update shooting_can_focus() and shooting_get_common_focus_mode() appropriately

2) Script functions :  set_aflock()   set_focus()   & <new> focus_lock()
  • modify set_aflock() to manage PROPCASE_AF_LOCK
  • add  a return status to set_focus()
  • add a new set_focus_lock(mode) function that uses a #defined per camera method of setting/resetting MF or AFL (mode: 0=auto, n=manual choice of method, returns true/false)

3) Enhanced Photo Operations :  Override Subj. Dist.
  • decide if enabling/disabling this should also set/reset either AFL or MF using the same code as the new script  set_focus_lock() function

4) Short cut keys : manual focus.
  • decide using these using these calls the same code as the new script set_focus_lock() function

To make this discussion manageable,  I think we can take the list one item at a time. 

If there is no objection I'll post a starting discussion for item 1 (shooting.c) next.
« Last Edit: 22 / February / 2014, 12:34:48 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Setting focus from scripts or menus : changes to shooting.c
« Reply #249 on: 22 / February / 2014, 14:26:33 »
shooting.c :  To be candid,  I don't know the best way to fix this.  I've attached the relevant code with comments added.

I think the goal is to check whether camera is in a mode where the underlying function _MoveFocusLensToDistance() will actually move the lens.  However, a simpler goal might be to only allow that call when the camera will not crash as a result, regardless of whether the lens moves or not.

Unfortunately, the test results tell us a lot, but not everything. For example, when a crash occurs, is it because of the method being used to enable SD override crashes or because _MoveFocusLensToDistance() crashes?

The current #defines involved are :
Code: [Select]
CAM_CAN_SD_OVERRIDE                // Camera allows subject distance override
CAM_CAN_SD_OVER_IN_AF_LOCK         // Camera allows subject distance override when in AF Lock mode
CAM_CAN_SD_OVER_IN_AF_LOCK_ONLY    // Camera allows subject distance override only when in AF Lock mode OR in movie mode
CAM_HAS_MANUAL_FOCUS               // Camera allows manual focus in Canon menus
CAM_CAN_SD_OVER_NOT_IN_MF          // Camera allows subject distance override when not in manual focus mode
I'm starting with the assumption that these need to be scrapped and new #defines created.  What those need to be and then how to add to 1.3.0 is the question?

So, the following questions come to mind :
  • Should shooting_can_focus() return true only if the camera can actually move the lens?
  • Should shooting_can_focus() return true if calling _MoveFocusLensToDistance() will not crash the camera, regardless of whether it focuses or not?
  • What is needed for video modes?
  • Does the code need to check for CONTINUOUS_FOCUS or SERVO_AF enabled?

I believe that this all hangs on the following conditions :

  • Camera can call _MoveFocusLensToDistance() without AFL or MF enabled
  • Camera needs AFL enabled before calling _MoveFocusLensToDistance()
  • Camera needs MF enabled before calling _MoveFocusLensToDistance()

where AFL is PROPCASE_AF_LOCK==1 and MF is PROPCASE_FOCUS_MODE==1

This seems simple enough, but only if you assume that reported crashes during testing when AFL or MF are enabled ( e.g. A3400 or sx50hs) are due to setting AFL or MF and not from calling _MoveFocusLensToDistance().

I find myself going in circles here so I'm going to stop and hope someone else has a more clear vision about what to do with this.
« Last Edit: 22 / February / 2014, 14:41:38 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics


SimplePortal © 2008-2014, SimplePortal