Infinity subject distance problem - General Discussion and Assistance - CHDK Forum supplierdeeply

Infinity subject distance problem

  • 4 Replies
  • 4078 Views
*

Offline funnel

  • ****
  • 349
Infinity subject distance problem
« on: 16 / April / 2012, 14:23:08 »
Advertisements
The infinity distance is not working on sx220. It gets set to 0 instead of MAX_DIST (or -1 in the prop). The only solution I found was setting INFINITY_DIST to MAX_DIST in include/platform.h.

Does it work on other cameras?
I know it's not a big problem, I'd just like to know why 0xFFFFFFFF is not a valid number later in the code. Everything looks correct to me there so I'm asking.
« Last Edit: 18 / April / 2012, 05:55:34 by funnel »

*

Offline funnel

  • ****
  • 349
Re: Infinity distance problem
« Reply #1 on: 16 / April / 2012, 17:42:19 »
I looked at this and the reason is that _MoveFocusLensToDistance() doesn't accept 0xFFFFFFFF as a valid value for infinity. Max I could go from a script was about 0xFFFFF00.

*

Offline funnel

  • ****
  • 349
Re: Infinity distance problem
« Reply #2 on: 17 / April / 2012, 04:46:28 »
I was wrong in the previous post. I used set_focus() from a lua script to determine that but the problem is later in the code. 0xFFFFFFFF is a good value for infinity.

The solution is an additional check before setting the subject distance
Code: [Select]
void lens_set_focus_pos(long newpos)
{
    if (newpos >= MAX_DIST) newpos = INFINITY_DIST;

to

Code: [Select]
void lens_set_focus_pos(long newpos)
{
    if (newpos >= MAX_DIST || newpos < MIN_DIST) newpos = INFINITY_DIST;


*

Offline funnel

  • ****
  • 349
Re: Infinity distance problem
« Reply #3 on: 18 / April / 2012, 05:55:15 »
Well. I still wasn't satisfied with my answers so I investigated further.

The problem is in this line

Code: [Select]
void shooting_set_focus(int v, short is_now)
{
...
           if (!conf.dof_use_exif_subj_dist)
                s+=shooting_get_lens_to_focal_plane_width();
            lens_set_focus_pos(s);
...
}

but the thing is that shooting_get_lens_to_focal_plane_width() returns the distance between the end of the lens and the sensor.

So if I pass 0xFFFFFFFF to shooting_set_focus(0xffffffff,is_now) it will always add 49 (in my case without zoom).
So the acual value that gets passed to lens_set_focus_pos(s) is 0xffffffff+49 which then sets the focus to 48 and not infinity like it should.

A simple fix would be

Code: [Select]
if (!conf.dof_use_exif_subj_dist && (s != INFINITY_DIST))
I guess this issue should be noticeable on all cameras.



*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: Infinity subject distance problem
« Reply #4 on: 20 / April / 2012, 22:44:37 »
Thanks for the investigation.

Should be fixed in revision 1811 (trunk) and 1812 (release-1.0).

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)
  g7x2 (1.01a, 1.01b, 1.10b)

 

Related Topics


SimplePortal 2.3.6 © 2008-2014, SimplePortal