A4000IS porting thread - page 17 - DryOS Development - CHDK Forum
supplierdeeply

A4000IS porting thread

  • 205 Replies
  • 70958 Views
*

Offline srsa_4c

  • ******
  • 4451
Re: A4000IS porting thread
« Reply #160 on: 04 / July / 2013, 21:58:44 »
Advertisements
If I call set_aflock(1) first, then call set_focus(403), and then shoot, the camera crashes.
Whoops. So far even the most problematic cameras were able to successfully override subject distance when in AF lock. Looks like yours is a new category :(

Quote
I can't do the last test easily yet.  I'm using CHDKPTP to pass the commands, and the physical buttons don't work when the USB is plugged in.  I'll have to write a lua script to set the focus before I can test that.
Just press the ALT button once on camera if it doesn't react to physical buttons while in rec mode and connected to USB. That should make the buttons work.

edit: try to get romlogs after these crashes, maybe those can tell what's wrong.

Re: A4000IS porting thread
« Reply #161 on: 05 / July / 2013, 16:08:56 »
Here are the romlogs from my two cameras.  One (ptptest) is built from ptp-remote-capture-test4 + nafraf's rs patch for the A4000, the other (noexmem) is built from development CHDK sources (rev. 2698) except that I disabled EXMEM in it.  Both show the same assert being hit in "FocusLensController.c Line 829".  Both A4000 cameras have firmware version 101B.

*

Offline srsa_4c

  • ******
  • 4451
Re: A4000IS porting thread
« Reply #162 on: 06 / July / 2013, 13:57:59 »
Here are the romlogs from my two cameras.
The assert happens due to a check that I don't understand (it's nothing new, even the old a430 firmware has it).

Can you try the following:
Locate shooting_expo_param_override_thumb() in core/shooting.c
Comment out the following part of that function:
Code: [Select]
    if (((camera_info.state.state_kbd_script_run) || (usb_remote_active)) && (photo_param_put_off.subj_dist))
    {
        shooting_set_focus(photo_param_put_off.subj_dist, SET_NOW);
        photo_param_put_off.subj_dist=0;
    }
    else if (is_sd_override_enabled)
        shooting_set_focus(shooting_get_subject_distance_override_value(), SET_NOW);
If the above isn't there, CHDK will not attempt to set the focus right before shooting. This obviously will cripple CHDK, but you'll still be able to use either set_focus() from a script, or the manual SD override options. You'll need to be in AF lock of course, or SD override will be ineffective.

Can you get better results with the above?

edit:
According to the documentation, set_focus has no immediate effect. Try adjusting the SD override manually, and see whether you get the crash when you try to shoot.
« Last Edit: 06 / July / 2013, 14:54:36 by srsa_4c »

Re: A4000IS porting thread
« Reply #163 on: 06 / July / 2013, 17:25:54 »
I haven't tried commenting out that code yet, but I'll report on what I did yesterday.  I tried not using set_aflock(1), and just calling set_focus() just before each call to shoot().  I took multiple shots with my camera in my rig, and the shots were consistent, but out of focus.  Looking at the "Subject distance" EXIF entry showed that it also was consistent across all shots, but also different from what I passed to set_focus() (I was passing 871(mm) to set_focus(), but seeing 93(cm) for "Subject distance").  I got the same results when I removed the set_focus() call and overrode the subject distance to 871mm in the CHDK menu.  I thought to myself "Maybe I just need to pass a smaller value and I'll get the right result", so I passed 800mm to set_focus() for one set of tests, and 800mm to the CHDK override menu for the second set.  Once again, the results were consistent within each set, but the "Subject distance" EXIF entry was different in both sets of tests (83cm in one, and 84cm in the other).  So, it's as if set_focus() isn't setting the focus to the correct value.

You're right about set_focus() not having an immediate effect; from searches I've done in this forum, it looks like the focus isn't changed until the shoot operation.  That's why I'm a bit confused about commenting out that code.  Will the focus ever be changed then?


*

Offline reyalp

  • ******
  • 14080
Re: A4000IS porting thread
« Reply #164 on: 06 / July / 2013, 17:37:08 »
You're right about set_focus() not having an immediate effect; from searches I've done in this forum, it looks like the focus isn't changed until the shoot operation.
On exception: If the camera has an MF mode, set_focus() should take immediate effect.
Don't forget what the H stands for.

Re: A4000IS porting thread
« Reply #165 on: 06 / July / 2013, 18:06:29 »
On exception: If the camera has an MF mode, set_focus() should take immediate effect.

That's good to know.  I'll try using my sucky method for setting the focus, but if it get's too frustrating, I'll buy a couple of cameras with support for manual focusing.  The SX150/160 are pretty cheap these days.

*

Offline srsa_4c

  • ******
  • 4451
Re: A4000IS porting thread
« Reply #166 on: 06 / July / 2013, 18:35:10 »
There's another method to try... the event procedure method. CHDK uses MoveFocusLensToDistance to set focus.

The following 2 calls are only needed once:
Code: [Select]
call_event_proc("FA.Create")
call_event_proc("InitializeAdjustmentFunction")
After these are executed, MoveFocusLensToDistance becomes available, and can be used like
Code: [Select]
call_event_proc("MoveFocusLensToDistance", <distance>)where <distance> is a 32bit integer. Since this is a Canon function, it has immediate effect. Calling it only makes sense in AF lock.

The call_event_proc() function is only available when "Lua native calls" are enabled in the Misc. menu (CHDK 1.2).

edit: Registering lots of event procedures (which is what FA.Create and InitializeAdjustmentFunction do) will consume some memory, hopefully not too much.

edit2: using event procedures is a kind of desperate measure, but I don't have a better idea - ideally, a developer could work something out to make this camera work like the others. I'm a bit surprised that this model has this SD override problem, and the same generation a810 doesn't.
« Last Edit: 06 / July / 2013, 18:44:04 by srsa_4c »

*

Offline reyalp

  • ******
  • 14080
Re: A4000IS porting thread
« Reply #167 on: 13 / July / 2013, 22:54:22 »
A user reported that set_zoom doesn't reach the end of the optical zoom. According to the sig finder, NUM_FL should be 127 rather than 63.

Here's a build for 101a with that set.
Don't forget what the H stands for.


Re: A4000IS porting thread
« Reply #168 on: 13 / July / 2013, 23:05:51 »
A user reported that set_zoom doesn't reach the end of the optical zoom. According to the sig finder, NUM_FL should be 127 rather than 63.

Here's a build for 101a with that set.

I confirm it works!

*

Offline reyalp

  • ******
  • 14080
Re: A4000IS porting thread
« Reply #169 on: 13 / July / 2013, 23:42:44 »
Don't forget what the H stands for.

 

Related Topics