InitializeAdjustmentSystem and exposure control on M3 (was Help!) - page 3 - General Help and Assistance on using CHDK stable releases - CHDK Forum

InitializeAdjustmentSystem and exposure control on M3 (was Help!)

  • 27 Replies
  • 2466 Views
*

Offline reyalp

  • ******
  • 14079
Re: InitializeAdjustmentSystem and exposure control on M3 (was Help!)
« Reply #20 on: 15 / August / 2022, 02:08:03 »
Advertisements
@reyalp

Following up on the above, here is a list of M Cam Series Lua functionality that I hope you can enable:

"EFLensCom.MoveFocus"
"EFLensCom.FocusSearchNear"
"EFLensCom.FocusSearchFar"
"GetEFLensFocusPositionWithLensCom"

Plus anyothers that access Lens functionality ;-)
If you want to use these with call_func_ptr in the interim, as of trunk 6126, you can get the addresses from the platform funcs_by_*.csv files.

Note that for EFLensCom.MoveFocus you should use the "EFLensCom_MoveFocus" address, which is NOT the same as EFLensCom.MoveFocus_FW, and you must pass two additional parameters, which should be 0, like (for M3 120f)
Code: [Select]
call_func_ptr(0xfc2f3315, target, speed, 0, 0)
For the others, the _FW and non _FW addresses are the same.

I didn't see anything obvious, but it's possible that some of these require initialization done by InitializeAdjustmentSystem, so if you try them, please let me know if they work.
Don't forget what the H stands for.

Re: InitializeAdjustmentSystem and exposure control on M3 (was Help!)
« Reply #21 on: 15 / August / 2022, 02:30:51 »
@reyalp

Thanks for the info.

I’ve looked at those files but I’ve note used the func_ptr approach before.

Initially I guess the best approach is to replace the following call_event_proc('FA.Create'), call_event_proc('InitializeAdjustmentSystem'), and
far_count = call_event_proc('GetEFLensFocusPositionWithLensCom')+1

And see what happens ;-)


*

Offline reyalp

  • ******
  • 14079
Re: InitializeAdjustmentSystem and exposure control on M3 (was Help!)
« Reply #22 on: 15 / August / 2022, 03:11:56 »
I’ve looked at those files but I’ve note used the func_ptr approach before.
It's similar to call_event_proc except that instead of the name, you need to use the camera + firmware specific address, and if you get the address wrong, the camera will crash.

Since you need different addresses for every camera / firmware, I'd suggest making Lua wrappers like
Code: [Select]
if bi.platform == "m3" and bi.bi.platsub=="120f" then
 function MoveFocus(target, speed)
  call_func_ptr(0xfc2f3315, target, speed, 0, 0)
 end
elseif bi.platform == "m3" and bi.bi.platsub=="121a" then
...


Quote
Initially I guess the best approach is to replace the following call_event_proc('FA.Create'), call_event_proc('InitializeAdjustmentSystem'), and
far_count = call_event_proc('GetEFLensFocusPositionWithLensCom')+1
Good to start simple, but to actually get rid of InitializeAdjustmentSystem you'll need to replace all the call_event_proc calls involving functions that InitializeAdjustmentSystem registers.

Note that some eventprocs you use are like not registered by InitializeAdjustmentSystem, but instead either registered by default or by a different event proc. Those don't need to be replaced. IIRC from previous discussion the EFLensCom (or maybe it was just EFLens?) ones were registered by default.

When you call an unregistered eventproc, call_event_proc returns -1, so it's a good idea to check in code.
Don't forget what the H stands for.

Re: InitializeAdjustmentSystem and exposure control on M3 (was Help!)
« Reply #23 on: 15 / August / 2022, 08:48:30 »
@reyalp

Had a quick test, ie using your suggestions, and it looks as if using the call_func_ptr aproach, and dropping FA.create and InitializeAdjustmentSystem, has fixed things :-)

Haven't made the code 'pretty' yet, nor covered non 120f M3s. Will do that next when I get time.

Once again thanks for your prompt help.

Cheers

Garry


Re: InitializeAdjustmentSystem and exposure control on M3 (was Help!)
« Reply #24 on: 15 / August / 2022, 11:40:32 »
@reyalp

Further testing and I'm seeing a 'problem'.

On the M3 things seem to work as expected and, critically, after I take an image things remain as expected.

On the M10, the same script, but with the correct addresses (obviously), doesn't behave as expected, in that after the image is taken the lens position seems to 'reset' itself to a new value :-(

I've repeated the test multple times.

So, it looks like the M10 is 'different' to the M3 :-(

BTW here is how I handle things:

Code: [Select]
if (bi.platform=="m3") and (bi.platsub=="101a") then
    FocusSearchFar_FW = 0xfc43dfd9
    FocusSearchNear_FW = 0xfc43dfff
    FocusPositionWithLensCom = 0xfc5a85c7
    shutter_trigger = "print"
  elseif (bi.platform=="m3") and (bi.platsub=="120f") then
    FocusSearchFar_FW = 0xfc43e349
    FocusSearchNear_FW = 0xfc43e36f
    FocusPositionWithLensCom = 0xfc5a8adf
    shutter_trigger = "print"
  elseif (bi.platform=="m3") and (bi.platsub=="121a") then
    FocusSearchFar_FW = 0xfc43e379
    FocusSearchNear_FW = 0xfc43e39f
    FocusPositionWithLensCom = 0xfc5a8b0f
    shutter_trigger = "print"
  elseif (bi.platform=="m10") and (bi.platsub=="111a") then -- same address in 110d, 110f, 110g
    FocusSearchFar_FW = 0xfc42f83b
    FocusSearchNear_FW = 0xfc42f861
    FocusPositionWithLensCom = 0xfc5be647
    shutter_trigger = "set"
  else
    print("Something is not right")
    sleep(3000)
    return
end

*

Offline reyalp

  • ******
  • 14079
Re: InitializeAdjustmentSystem and exposure control on M3 (was Help!)
« Reply #25 on: 15 / August / 2022, 18:04:10 »
On the M3 things seem to work as expected and, critically, after I take an image things remain as expected.

On the M10, the same script, but with the correct addresses (obviously), doesn't behave as expected, in that after the image is taken the lens position seems to 'reset' itself to a new value :-(

I've repeated the test multple times.

So, it looks like the M10 is 'different' to the M3 :-(
Is it the same model of lens? Are focus and lens related settings identical on the cameras? I would be somewhat this was just a Canon firmware behavior difference.

Also note that contra the comment, the addresses for these functions are NOT the same for the various M10 subs, except f and g which use the same port. They do appear to be correct for 111a though, so that shouldn't be the cause of the problem.

Code: [Select]
110d
0xfc42f7d7,EFLensCom_FocusSearchFar
0xfc42f7fd,EFLensCom_FocusSearchNear
0xfc5be5e3,GetEFLensFocusPositionWithLensCom

110f/110g
0xfc42f80b,EFLensCom_FocusSearchFar
0xfc42f831,EFLensCom_FocusSearchNear
0xfc5be617,GetEFLensFocusPositionWithLensCom

111a
0xfc42f83b,EFLensCom_FocusSearchFar
0xfc42f861,EFLensCom_FocusSearchNear
0xfc5be647,GetEFLensFocusPositionWithLensCom
Don't forget what the H stands for.

Re: InitializeAdjustmentSystem and exposure control on M3 (was Help!)
« Reply #26 on: 15 / August / 2022, 21:25:42 »
On the M3 things seem to work as expected and, critically, after I take an image things remain as expected.

On the M10, the same script, but with the correct addresses (obviously), doesn't behave as expected, in that after the image is taken the lens position seems to 'reset' itself to a new value :-(

I've repeated the test multple times.

So, it looks like the M10 is 'different' to the M3 :-(
Is it the same model of lens? Are focus and lens related settings identical on the cameras? I would be somewhat this was just a Canon firmware behavior difference.

Also note that contra the comment, the addresses for these functions are NOT the same for the various M10 subs, except f and g which use the same port. They do appear to be correct for 111a though, so that shouldn't be the cause of the problem.

Code: [Select]
110d
0xfc42f7d7,EFLensCom_FocusSearchFar
0xfc42f7fd,EFLensCom_FocusSearchNear
0xfc5be5e3,GetEFLensFocusPositionWithLensCom

110f/110g
0xfc42f80b,EFLensCom_FocusSearchFar
0xfc42f831,EFLensCom_FocusSearchNear
0xfc5be617,GetEFLensFocusPositionWithLensCom

111a
0xfc42f83b,EFLensCom_FocusSearchFar
0xfc42f861,EFLensCom_FocusSearchNear
0xfc5be647,GetEFLensFocusPositionWithLensCom

Same lens used for each test, ie 11-22mm. Manual settings etc throughout.

Script works as expected on the M10 until you take an image and then you see the lens counter change, where it doesn’t on the M3.

Oh well, I’ll just restrict the script to run in the M3 for now, which is my main CHDK camera ;-)

Re: InitializeAdjustmentSystem and exposure control on M3 (was Help!)
« Reply #27 on: 16 / August / 2022, 02:01:23 »
@reyalp

Here's a test script that shows the difference in behaviour between the M3 and M10.

Code: [Select]
--[[
@title Test
--]]

props=require'propcase'
bi = get_buildinfo()

if (bi.platform=="m3") and (bi.platsub=="101a") then
    FocusSearchFar_FW = 0xfc43dfd9
    FocusSearchNear_FW = 0xfc43dfff
    FocusPositionWithLensCom = 0xfc5a85c7
    shutter_trigger = "print"
  elseif (bi.platform=="m3") and (bi.platsub=="120f") then
    FocusSearchFar_FW = 0xfc43e349
    FocusSearchNear_FW = 0xfc43e36f
    FocusPositionWithLensCom = 0xfc5a8adf
    shutter_trigger = "print"
  elseif (bi.platform=="m3") and (bi.platsub=="121a") then
    FocusSearchFar_FW = 0xfc43e379
    FocusSearchNear_FW = 0xfc43e39f
    FocusPositionWithLensCom = 0xfc5a8b0f
    shutter_trigger = "print"
  elseif (bi.platform=="m10") and (bi.platsub=="111a") then
    FocusSearchFar_FW = 0xfc42f83b
    FocusSearchNear_FW = 0xfc42f861
    FocusPositionWithLensCom = 0xfc5be647
    shutter_trigger = "video"
  else
    print("Only runs on the M3")
    sleep(3000)
    return
end

temp = call_func_ptr(FocusPositionWithLensCom)
print(temp)
ecnt = get_exp_count()
shoot()
repeat sleep(10) until (get_exp_count() ~= ecnt)
temp = call_func_ptr(FocusPositionWithLensCom)
print(temp)

On the M3 the print out of the lens position is the same either side of the image capture, including after a refocus.

On the M10 it varies either side.


 

Related Topics