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

InitializeAdjustmentSystem and exposure control on M3 (was Help!)

  • 27 Replies
  • 2469 Views
*

Offline c_joerg

  • *****
  • 1248
Re: Help!
« Reply #10 on: 07 / August / 2022, 09:07:15 »
Advertisements
In the scripts that I use, everything works perfectly.
There must then be a problem setting the ISO in your code.
M100 100a, M3 121a, G9x II (1.00c), 2*G1x (101a,100e), S110 (103a), SX50 (100c), SX230 (101a), S45,
Flickr https://www.flickr.com/photos/136329431@N06/albums
YouTube https://www.youtube.com/channel/UCrTH0tHy9OYTVDzWIvXEMlw/videos?shelf_id=0&view=0&sort=dd

Re: Help!
« Reply #11 on: 07 / August / 2022, 09:11:19 »
I’m sure it’s me, but at the moment I can’t see what’s going on.


I’ll obviously keep investigating.

Re: Help!
« Reply #12 on: 07 / August / 2022, 09:39:22 »
OK, I've got somewhere, as it looks like the following piece of code 'buggers things up'.

If I don't call the function, all is as expected.

The implication being that something to do with focus, eg FA.create?, is negatively interfering with the Canon capture side.

Code: [Select]
function lens_cal() -- called at the start and when focal length changes: sets lens to MFD
    reset_lens = false
    call_event_proc('FA.Create')
    draw.clear()
    draw.replace(bar,"rectf",hdmi,0,hdmi+360,20,"black","black")
    draw.replace(cal,"string",hdmi+180-50,2,"Calibrating","white","black")
    draw.overdraw()
    call_event_proc('InitializeAdjustmentSystem')
    sleep(100)
    temp = call_event_proc('GetEFLensFocusPositionWithLensCom')
    repeat
        temp = call_event_proc('GetEFLensFocusPositionWithLensCom')
        sleep(50)
        call_event_proc("EFLensCom.FocusSearchFar")
    until temp == call_event_proc('GetEFLensFocusPositionWithLensCom') -- make sure we are at 'infinity'
    max_count = temp
    repeat -- to find some useful data
        call_event_proc("EFLensCom.MoveFocus", -1, 1)
        sleep(50)
    until get_focus_distance_lower() < 81910 -- lower data infinity
    far_count = call_event_proc('GetEFLensFocusPositionWithLensCom')+1

    temp = call_event_proc('GetEFLensFocusPositionWithLensCom')
    repeat
        temp = call_event_proc('GetEFLensFocusPositionWithLensCom')
        sleep(50)
        call_event_proc("EFLensCom.FocusSearchNear")
    until temp == call_event_proc('GetEFLensFocusPositionWithLensCom') -- make sure we are at MFD
    near_count = call_event_proc('GetEFLensFocusPositionWithLensCom')
    MFD = get_focus_distance_lower()
    draw.clear()
end
« Last Edit: 07 / August / 2022, 09:41:12 by pigeonhill »

Re: Help!
« Reply #13 on: 07 / August / 2022, 09:56:03 »
Just confirming, ie repeatable.
Without running the function in the last post, the histogram responds as expected.
If you run the function, the histogram freezes as reported above and the ISO doesn't get captured.
I'm mystified.


Re: Help!
« Reply #14 on: 07 / August / 2022, 16:27:54 »
Finally found what is throwing things out.

Code: [Select]
call_event_proc('InitializeAdjustmentSystem')

If I pause before calling the above, the Canon and CHDK histograms respond as expected, ie as I change the shutter.

If I pause after calling the above, ie no other code has run, I see the corrupted behaviour, ie the histogram freezes between arounf 1/30s to 4s.

All very repeatable.

So it looks like the above call is either wrong, inconplete or I'm calling it incorrectly.

Does anyone have any ideas?

*

Offline reyalp

  • ******
  • 14080
Re: Help!
« Reply #15 on: 07 / August / 2022, 20:43:28 »
Finally found what is throwing things out.

Code: [Select]
call_event_proc('InitializeAdjustmentSystem')
I'm afraid I don't really follow your description of the symptoms, but InitializeAdjustmentSystem having side effects is not a surprise.

Quote
If I pause before calling the above, the Canon and CHDK histograms respond as expected, ie as I change the shutter.
What does "pause" mean here? A sleep immediately before the call? How long? What else precedes the call?
 
CHDK histogram is based on the live view. So, how does the behavior of the live differ in the cases?

Quote
If I pause after calling the above, ie no other code has run,
Again, what specifically does this mean? The 100ms sleep shown in your quoted code? Or something else? How does that interact with the pause before?

edit: More generally, if you can reduce this to a minimal, reproducible case, that would help a lot.

Quote
I see the corrupted behaviour, ie the histogram freezes between arounf 1/30s to 4s.
Do you mean that when you change the shutter between 1/30 and 4s, the histogram doesn't change?
How are you changing exposure: Physically with camera controls, using script functions, propcases?
What happens to the live view?
Does the histogram change after you go outside that range?

Quote
So it looks like the above call is either wrong, inconplete or I'm calling it incorrectly.
InitializeAdjustmentSystem is a Canon service or development function. It registers some eventprocs and initializes other stuff that has not been specifically reverse engineered. It takes no parameters so there isn't a "incorrect" way to call it (aside from the fact that FA.Create needs to be called to register InitializeAdjustmentSystem), but side effects or interactions with other calls are not well understood.
« Last Edit: 07 / August / 2022, 20:47:00 by reyalp »
Don't forget what the H stands for.

Re: InitializeAdjustmentSystem and exposure control on M3 (was Help!)
« Reply #16 on: 08 / August / 2022, 00:58:32 »
Sorry for not being clearer.

The attached test script demonstrates the issue.

BTW I'm testing on on my M3 with the XIMR build and I'm in M mode.

If you switch on the camera, but don't switch on CHDK, and change shutter speed, the histogram changes in response, as expected.

If you switch on CHDK (press ALT) things still look OK.

If run the Test script the histogram freezes inbetween about 1/30s and 2s. Either side the histogram responds as expected.

Also if you come out of ALT, with the script running, and take two images, but only change ISO, you will see the impact on the images. That is EXIF changed, but exposure hasn't. This is also the same if I capture those two images in the script.

Cheers

Garry

*

Offline reyalp

  • ******
  • 14080
Re: InitializeAdjustmentSystem and exposure control on M3 (was Help!)
« Reply #17 on: 10 / August / 2022, 01:56:27 »
The attached test script demonstrates the issue.
Thanks

Quote
If run the Test script the histogram freezes inbetween about 1/30s and 2s. Either side the histogram responds as expected.
Does the live view reflect the exposure change?

Quote
Also if you come out of ALT, with the script running, and take two images, but only change ISO, you will see the impact on the images. That is EXIF changed, but exposure hasn't. This is also the same if I capture those two images in the script.
I assume you mean changing the ISO manually in the regular Canon UI?

I don't have any M cams, but on G7 X, calling
call_event_proc('FA.Create'),call_event_proc('InitializeAdjustmentSystem')
does appear to interfere with exposure control, similar to what you described. Changing the shutter speed in the Canon UI does not change the live view or histogram every click. Instead, it seem to stay fixed for several clicks and then jump.
Additionally, using half press crashes the cam, which IIRC has previously been observed when using InitializeAdjustmentSystem

This appears to be an interaction between InitializeAdjustmentSystem and the stock Canon firmware, so, my advice is not to use InitializeAdjustmentSystem.

This probably means you need to call the functions registered by InitializeAdjustmentSystem directly using call_func_ptr, or get them added to CHDK (not being able to call them as event procs is a good reason to add them, so I'm open to that).

Using call_func_ptr means you have to find the appropriate firmware specific address, and may need to pass arguments differently in some cases. It is also possible that functions you are using depend on some initialization done by InitializeAdjustmentSystem, in which case additional workarounds will be needed. I or others here can provide addresses and advice if you identify the specific functions you need.

I did notice that InitializeAdjustmentFunction registers some the same functions as InitializeAdjustmentSystem, without doing some of the other stuff, so I thought it might have less side effects, but on G7 X at least, it appears to suffer the same problems.
« Last Edit: 10 / August / 2022, 01:58:00 by reyalp »
Don't forget what the H stands for.


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

Many thanks for confirming my findings on the M3, which replicate your findings.

Having access to the lens counter is essential and, at the same time, being able to control exposure etc. So I really would like to see a ‘fix’ introduced.

I appreciate developers like yourself have other priorities, so I know I will have to wait.

The bottom line being that I can access the lens counter in Lua.

Sorry, rushing off to work now.

Cheers

Garry

Re: InitializeAdjustmentSystem and exposure control on M3 (was Help!)
« Reply #19 on: 10 / August / 2022, 09:27:11 »
@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 ;-)
« Last Edit: 10 / August / 2022, 11:23:07 by pigeonhill »

 

Related Topics