Focus function for EOS M3 / M10 - General Help and Assistance on using CHDK stable releases - CHDK Forum

Focus function for EOS M3 / M10

  • 72 Replies
  • 28453 Views
*

Offline c_joerg

  • *****
  • 1251
Focus function for EOS M3 / M10
« on: 11 / April / 2019, 04:10:34 »
Advertisements
@Ant
https://chdk.setepontos.com/index.php?topic=12758.msg135783#msg135783


You can play with EFLensCom.* event procedures to control your lens.
For example type in chdkptp: lua call_event_proc("EFLensCom.FocusSearchFar")

I tried it and it works really well. But I only tried it with my cheapest lens ;)

add.
This command moves the focus 2500 steps forward with speed 10:
lua call_event_proc("EFLensCom.MoveFocus",2500,10)
Which influence could have greater speed? Where is the limit of speed?

What is the difference to 
Code: [Select]
EFLensCom.MoveFocusBySync ?


But we can get some info:
Code: [Select]
Subject Distance Near = 13 cm
Subject Distance Far  = 14 cm
Defocus Near = 1 mm
Defocus Far  = 6 mm

Target: 2500, Speed: 10

Focus Move Complete!!

Subject Distance Near = 232 cm
Subject Distance Far  = 316 cm
Defocus Near = 5 mm
Defocus Far  = 1 mm

Target: 2500, Speed: 10

Focus Move Complete!!

Subject Distance Near = 65535 cm
Subject Distance Far  = 65535 cm
Defocus Near = 6 mm
Defocus Far  = 1 mm

How do you get this information?
Does it comes from
Code: [Select]
EFLensCom.DistanceInfoget_focus() or DOF function delivers only 0.




Add Test Script

Update 0.4
  For log mode: If  shots=0 then the ‘log’ mode stops when
  focus_distace_lower > 8190  and focus_distace_upper > 65534
  Values for Focus Speed, Focus_Steps and Sleep are logged now.
Update 0.5
  Update default Params
  Add sleepv for Focus Braketing
  Add log for Focus Braketing (Stack,Stackf)
Update 0.6
  Add M100 from srsa_4c
Update 0.7
 Disable AF in Stack Mode, when cam is in AF Mode
Version 0.8
  Add M3 121a
« Last Edit: 29 / April / 2021, 14:30:17 by c_joerg »
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

*

Offline Ant

  • *****
  • 509
Re: Focus function for EOS M3 / M10
« Reply #1 on: 11 / April / 2019, 10:48:07 »
Which influence could have greater speed? Where is the limit of speed?

What is the difference to 
Code: [Select]
EFLensCom.MoveFocusBySync ?
I did not check this in detail.


Quote
How do you get this information?
Does it comes from
Code: [Select]
EFLensCom.DistanceInfo
Yes. This info was taken from console output captured using UART redirection.

Quote
get_focus() or DOF function delivers only 0.

These functions were not implemented because of EF communication protocol limitations.
https://chdk.setepontos.com/index.php?topic=12542.500

*

Offline c_joerg

  • *****
  • 1251
Re: Focus function for EOS M3 / M10
« Reply #2 on: 11 / April / 2019, 11:47:18 »
This info was taken from console output captured using UART redirection.


Really useful information…

On EOS M3 these values can be taken directly from the lens using EFLensCom.DistanceInfo (0xFC43DF5E), or from structure in RAM at address 0x00244918.
The second way IMHO is better becuse it does not waste Camera<>Lense traffic.
That’s the way to get the Information in lua?
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

*

Offline Ant

  • *****
  • 509
Re: Focus function for EOS M3 / M10
« Reply #3 on: 11 / April / 2019, 13:00:21 »
That’s the way to get the Information in lua?

There need more firmware research because of some problems described there:
https://chdk.setepontos.com/index.php?topic=12542.msg139035#msg139035
Addresses can be vary for various lenses

How are you going to use "Subject Distance" information if it's readonly?
« Last Edit: 11 / April / 2019, 13:01:59 by Ant »


*

Offline c_joerg

  • *****
  • 1251
Re: Focus function for EOS M3 / M10
« Reply #4 on: 11 / April / 2019, 13:18:45 »
How are you going to use "Subject Distance" information if it's readonly?

You could find out how big the MoveFocus increment is.
Example for stacking:
You take a picture with the actual focus.  Then you move the focus. The new Distance Near should be less than Distance Far from the previous picture to get an overlap. If there is no overlap, you have to move the focus back (may be with half steps). Or you do a lot of small steps.
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: Focus function for EOS M3 / M10
« Reply #5 on: 11 / April / 2019, 15:58:32 »
@Ant

Not sure if it helps you or not, in my focus stacking script, https://chdk.fandom.com/wiki/Landscape_Focus_Bracketing_:_perfect_near_to_far_focus_brackets

I explicitly work out the next focus position, ie no need to muck about checking if the last far DoF overlaps the current near DoF.
« Last Edit: 11 / April / 2019, 16:18:06 by pigeonhill »

*

Offline Ant

  • *****
  • 509
Re: Focus function for EOS M3 / M10
« Reply #6 on: 15 / April / 2019, 13:27:09 »
On EOS M3 these values can be taken directly from the lens using EFLensCom.DistanceInfo (0xFC43DF5E), or from structure in RAM at address 0x00244918.
The second way IMHO is better becuse it does not waste Camera<>Lense traffic.
That’s the way to get the Information in lua?
Hmm. I didn't find there any script command related with the subject distance.
So there need to define it's name.
Then I can produce slightly modified function EFLensCom.DistanceInfo which will return the arithmetic mean value between near and far subject distance.

The variable at 0x00244916(0x00244918) is updated regularly only with my Canon lenses.
With my Sigma lens this variable is updated only when I take photo or switch play/rec mode.
You can check its behaviour with your lenses.

« Last Edit: 15 / April / 2019, 13:40:16 by Ant »

Re: Focus function for EOS M3 / M10
« Reply #7 on: 15 / April / 2019, 13:50:34 »
Hmm. I didn't find there any script command related with the subject distance.
What about get_focus( ) & set_focus( ) - which are linked in the Lens Functions section of the Scripting Cross Reference Page.
Ported :   A1200    SD940   G10    Powershot N    G16


*

Offline Ant

  • *****
  • 509
Re: Focus function for EOS M3 / M10
« Reply #8 on: 15 / April / 2019, 14:18:53 »
Ok. But currently my Sigma lens reports:
Quote
Subject Distance Near = 5442 cm
Subject Distance Far  = 8256 cm
Defocus Near = 255 mm
Defocus Far  = 3 mm

8256 cm is more than 65535 mm. What to do with the limit?
Is it necessarily to use millimeters as units?

Another quirk: with Sigma lens variables at 0x00244916/0x00244918 are updated regularly at playback mode but not in rec mode.

*

Offline srsa_4c

  • ******
  • 4451
Re: Focus function for EOS M3 / M10
« Reply #9 on: 15 / April / 2019, 15:07:06 »
8256 cm is more than 65535 mm. What to do with the limit?
Newer cameras go over 65535, there is no such limit.

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal