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

Setting focus from scripts or menus

  • 601 Replies
  • 154188 Views
Re: Setting focus from scripts or menus
« Reply #350 on: 13 / March / 2014, 16:43:10 »
Advertisements
But testing my self using chdkptp -i, using the following script, I cannot set the focus:
...
Should the above work or am I missing something?
The use of set_aflock() will currently disabled the set_focus() function for the S110 in the latest release of  CHDK 1.3.0 .  That is because it was reported to cause set_focus() to crash during testing when using earlier versions of CHDK. 

At some point it should be re-enabled as it does not crash using the latest version of set_focus().

If you repeat your test without calling set_aflock() it should work.  It should also work if you call set_mf(1) instead of set_aflock().
« Last Edit: 13 / March / 2014, 16:49:47 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Setting focus from scripts or menus
« Reply #351 on: 13 / March / 2014, 20:41:56 »
Attached below is a little script that enables AFL and then shoots two shots close together with an optional set_focus() between them.  It also optionally lets you insert a two second delay between the shots and/or wait for get_shooting() to be true between the shots.

On my SX50,  if both the delay and get_shooting() wait are disabled and the set_focus() is enabled, the camera crashes with an ASSERT!! FocusLensController.c .  If either the delay or get_shooting() are enabled, or the set_focus is disabled, there is no crash.

I'd be interested to hear results from anyone else.

NOTE: my other cameras don't crash regardless of the parameter choices.

« Last Edit: 13 / March / 2014, 21:01:52 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

*

Offline nafraf

  • *****
  • 1308
Re: Setting focus from scripts or menus
« Reply #352 on: 13 / March / 2014, 22:01:41 »
On my SX50,  if both the delay and get_shooting() wait are disabled and the set_focus() is enabled, the camera crashes with an ASSERT!! FocusLensController.c .  If either the delay or get_shooting() are enabled, or the set_focus is disabled, there is no crash.
Same behavior on A810. ROMLOG attached.

Edit: On sx240, if get_shooting() disabled, camera crashes.
« Last Edit: 13 / March / 2014, 22:39:26 by nafraf »

Re: Setting focus from scripts or menus
« Reply #353 on: 13 / March / 2014, 22:55:52 »
Updated the script to allow selection of set_aflock(1) or set_mf(1) to SD override.

Same results as posted earlier with either method.
Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline reyalp

  • ******
  • 13673
Re: Setting focus from scripts or menus
« Reply #354 on: 14 / March / 2014, 00:19:57 »
Here's a silly idea:
The thing that triggers this assert is a specific function returning 0. We could do the same check in shooting_can_focus, or at least watch this check with debug code figure out when it will fail.

The check function compares r0 to a specific variable. Looking at the a810 disassembly, the value it compares to is also a fixed address for MoveFocusLensToDistance and related eventprocs.

On a810 100b, the check function is sub_FF953308, which checks if r0 == *(0x60EC + 4)

The checked r0 value is *(0xC66C + 0xC) (from sub_FFADA06C)

Since this only affects a limited number of cameras, we could have an ifdef that optionally calls a can focus check in platform code.

edit:
Tried last mf6.lua script on d10 and a540, default settings, no crash.
« Last Edit: 14 / March / 2014, 00:44:26 by reyalp »
Don't forget what the H stands for.

Re: Setting focus from scripts or menus
« Reply #355 on: 14 / March / 2014, 05:31:53 »
Hi Waterwingz, thanks for your reply.

At some point it should be re-enabled as it does not crash using the latest version of set_focus().

So set_aflock(...) could be made available by compiling a new firmware?

If you repeat your test without calling set_aflock() it should work.  It should also work if you call set_mf(1) instead of set_aflock().

Should I just omit the set_aflock() part or both the set_aflock() and the set_prop(...) part?

I either case I have made two connection tests using P-mode. In the first I am just using set_focus() with no luck. In the second test I still use the set_prop(...), but it seems like I cannot control the focus at all.

First test:
Code: [Select]
___> connect(0)
connected: Canon PowerShot S110, max packet size 512
con> =set_record(1)
con 1> =return get_focus()
2:return:155
con 2> =set_focus(1000)
con 3> =return get_focus()
4:return:155
con 4> =press 'shoot_half'
con 5> =return get_focus()
6:return:155
con 6> =set_focus(1000)
con 7> =return get_focus()
8:return:155
con 8> =press 'shoot_full'
con 9> =return get_focus()
10:return:207
con 10>

Second test:
Code: [Select]
___> connect(0)
connected: Canon PowerShot S110, max packet size 512
con> =set_record(1)
con 1> =return get_focus()
2:return:320
con 2> =set_prop(require('propcase').AF_LOCK, 1)
con 3> =return get_focus()
4:return:320
con 4> =set_focus(1000)
con 5> =return get_focus()
6:return:320
con 6> =press 'shoot_half'
con 7> =return get_focus()
8:return:320
con 8> =set_focus(1000)
con 9> =return get_focus()
10:return:320
con 10>

Re: Setting focus from scripts or menus
« Reply #356 on: 14 / March / 2014, 07:58:56 »
So set_aflock(...) could be made available by compiling a new firmware?
Yes.  You can also simply install the current release of the development version of CHDK (1.3.0) which has the changes.  (also, technically CHDK s not firmware as it always installs and runs in RAM)

Quote
Should I just omit the set_aflock() part or both the set_aflock() and the set_prop(...) part?
You need to eliminate both.

At this point,  I'd suggest using the most current  release 1.3.0 which should have a workng verions of set_aflock() and then new set_mf() command.
« Last Edit: 14 / March / 2014, 08:08:24 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Setting focus from scripts or menus
« Reply #357 on: 14 / March / 2014, 08:27:21 »
Quote
Should I just omit the set_aflock() part or both the set_aflock() and the set_prop(...) part?
You need to eliminate both.
Understood!

At this point,  I'd suggest using the most current  release 1.3.0 which should have a workng verions of set_aflock() and then new set_mf() command.

For my testing referred to in my previous posts, I have used CHDK 1.3.0 rev. 3378, which is the same as the one I can download from http://mighty-hoernsche.de/trunk/.

So is that not the newest revision, am I doing something completely wrong, or is something not working in that release for the S110?


Re: Setting focus from scripts or menus
« Reply #358 on: 14 / March / 2014, 08:51:15 »
For my testing referred to in my previous posts, I have used CHDK 1.3.0 rev. 3378, which is the same as the one I can download from http://mighty-hoernsche.de/trunk/.

So is that not the newest revision, am I doing something completely wrong, or is something not working in that release for the S110?
You have the right version.  I should have looked at this post before responding :

http://chdk.setepontos.com/index.php?topic=11078.msg110934#msg110934

For the S110,  CHDK manual focus (SD override) via the set_focus() command when the camera is in AFL mode is currently disabled.  If you can run the test requested there and the camera passes,  we can have it re-enabled.  (If the test crashes with shoot() enabled, please disable it from the script parameter menu and rerun the test?)

Also,  with the version of CHDK you are running now, you can use the set_mf(1) command in the place of set_aflock(1) to enable manual focus.  (Do not set the propcase in your code.)
« Last Edit: 14 / March / 2014, 09:04:50 by waterwingz »
Ported :   A1200    SD940   G10    Powershot N    G16

Re: Setting focus from scripts or menus
« Reply #359 on: 14 / March / 2014, 09:06:35 »
Here's a silly idea:
The thing that triggers this assert is a specific function returning 0. We could do the same check in shooting_can_focus, or at least watch this check with debug code figure out when it will fail.

The check function compares r0 to a specific variable. Looking at the a810 disassembly, the value it compares to is also a fixed address for MoveFocusLensToDistance and related eventprocs.
Would the call to shooting_can_focus() fail the set_focus() function immediately or would it wait (with a timeout) for a bit to allow the previous shot to finish ?  (realizing that if it's saving CHDK RAW that could be several seconds).
Ported :   A1200    SD940   G10    Powershot N    G16

 

Related Topics