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

Setting focus from scripts or menus

  • 556 Replies
  • 89646 Views
Advertisements
This difference is associated with the IS system.
If the "IS system"  is off then is Servo_AF: 31
If the "IS system"  is on then is Servo_AF: 30
Mine is 30 whether IS is enabled (shoot-only) or disabled.
The CHDK code that looks at that propcase wants to see a 0 before it will attempt set_focus().  But depending on the #defines in platform_camera.h,  it may never actually run that test.
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline zeno

  • *****
  • 885
WW - here's the s100 test with native lua calls and the fourth test enabled.

Dave
A570, S100, Ixus 127
Author of ASSIST, STICK, WASP, ACID, SDMInst, LICKS, WICKS, MacBoot, UBDB, CFGEdit

Hi,

here is a new test with native lua calls and the Use SS.MFOn set to on for SX230HS 1.00c.

By

Re: Setting focus from scripts or menus :
« Reply #53 on: 01 / January / 2014, 13:07:37 »
Thanks to everyone who tested and posted results here.    I'll update the wiki page and post the master spreadsheet here today.

What I think we've learned so far is that every port but one has some method of setting focus that works.  Props to the various porters over the years for that! 8)

However, none of the methods are common to all cameras. And we don't really know why the test cases that failed did not work. Was it the Canon f/w not acting when called?  Or was it the tangled nest of CHDK #defines in shooting_can_focus() simply ignoring the request? Worse still - we have not looked at manual focus in video modes or the SD override menu items in the CHDK menus.

Where to next then?   Here's a couple of ideas in search of comments :

  • We could create a special build where shooting_can_focus() always returns true.  If people will rerun the test script (with srsa_4c's timing tweaks and maybe an additional G12 set_aflock tweak test) we can actually find out which methods work and which were being randomly defeated by the #defines.  (We could post the special build on a google drive like lapser did : lapser version of CHDK ).
  • We can try to puzzle out the best definition for the existing #defines and make changes to shooting_can_focus() and camera.h settings in the 1.3.0 version that makes sense
  • We can create a new set of #defines that make sense (example listed below) and do a mass change of all the platform_camera.h files and release in 1.3.0 for testing.  We should probably also add a port specific function called something like set_mf_lock() that uses the new CAM_SD_OVER_MODE and that can be called from the menu code or a script.  It would be painful at first but might be the cleanest in the end.
  • Leave the #defines alone and publish a scripting guide telling which method works for each camera.  Using simple brute force,  we could even do a Lua lib that has all cameras listed and returns the approprate method. That would not help uBASIC scripting so maybe a new scripting function for both languages is needed that does the same thing.
  • Do nothing - the current default case -  and let the script writers sort it using methods like the kap_uav.lua script uses.

None of the above suggestions are perfect.  And any change that affects all cameras is likely to break for a few.  Do we just live with that and clean it up in the unstable version as we go?  Maybe when 1.3.0 becomes stable,  any camera not reported as working reverts to SD override disabled (until someone reports in)?

Over the last few days we tested less than 25% of the ported CHDK cameras.   Further testing might have a lower response rate.


Appendix : Suggested #defines for comment if we start from scratch (verbose on purpose - better wording needed)

Code: [Select]
#define CAM_CAN_SD_OVERRIDE                                   // the master define for shooting mode - disables all SD override code if not defined
#define CAM_CAN_SD_OVER_ONLY_IN_AFLOCK_MODE  // only set_focus() when AFL is active (propcase?)
#define CAM_CAN_SD_OVER_ONLY_IN_MF_MODE         //  only set_focus() when MF is active (propcase?)
#define CAM_SD_OVER_MODE     // defines which locking method to use - 0=none, 1=aflock, 2=PressSw1AndMF, 3=SS.MFOn, 4=

#define CAM_CAN_VIDEO_SD_OVERRIDE  // the master define for video mode - disables all SD override code if not defined
#define CAM_CAN_VIDEO_SD_OVER_ONLY_IN_AFLOCK_MODE
#define CAM_CAN_VIDEO_SD_OVER_ONLY_IN_MF_MODE
#define CAM_VIDEO_SD_OVER_MODE     // defines which locking method to use - 0=none, 1=aflock, 2=PressSw1AndMF, 3=SS.MFOn, 4=

todo : what about ContinuousAF and ServoAF modes - should shooting_can_focus() return more descriptive failure codes?
« Last Edit: 01 / January / 2014, 13:10:28 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline philmoz

  • *****
  • 3123
    • Photos
Did some more testing on my cameras.

Remove '#undef  CAM_CAN_SD_OVER_NOT_IN_MF' from G12 and G1X - all tests now pass.
(G1X reports fail on 'set_focus_only'; but it's because the min focus distance is 200, and the script tries to set 100).

Adding '#define CAM_CAN_SD_OVER_IN_AF_LOCK 1' to SX40 - camera now passes 'set_aflock' in addition to the previous pass on 'PressSw1AndMF'.
Removing CAM_CAN_SD_OVER_NOT_IN_MF from the SX40 causes the camera to crash on tests 1 & 4.

Updated files attached.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)

SX150IS Partial setup info:

Enable Lua Native Calls in CHDK's Miscellaneous menu for each camera => done

Canon menu settings:

AF-Point Zoom => Off
Servo AF => Off
Continuous AF => Off
AF-assist Beam => Off
MF-Point Zoom => Off
Safety MF => Off

File attached

Excuses?
never previously set any Canon menus or ran any script on the cam...so hope is that I ran it correctly.


Edit:

please see correct file attached at Reply #58 below
« Last Edit: 02 / January / 2014, 13:13:49 by andrew.stephens.754365 »

*

Offline msl

  • *****
  • 1263
  • A720 IS, SX220 HS 1.01a
    • CHDK-DE links
For the results table:

SS.MFOn
A720 passed
SX220 failed

I have started a test request in the German forum: http://forum.chdk-treff.de/viewtopic.php?f=7&t=3246

SX20 => http://forum.chdk-treff.de/download/file.php?id=2602
Ixus960 => http://forum.chdk-treff.de/download/file.php?id=2604
CHDK-DE:  CHDK-DE links

SX150IS Partial setup info:

Enable Lua Native Calls in CHDK's Miscellaneous menu for each camera => done

File attached
The attached file is the original script.  Can you please attach the mf_test.csv file that results from the test.

TIA
Ported :   A1200    SD940   G10    Powershot N    G16


The attached file is the original script.  Can you please attach the mf_test.csv file that results from the test.

TIA

oops  ::) - correct attachment here.

I have started a test request in the German forum: http://forum.chdk-treff.de/viewtopic.php?f=7&t=3246
Thanks for doing that.   The Ixus960 results are interesting - it seems to only be able to set focus if AFL or MF are not enabled.
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics